目的:
标准值1-6检查----最多保留小数点后3位 ,如果超出3位,显示错误信息”请检查父件XXX工序XXX的标准值X 的数值XXXX超出3位 “,退出。
关键语法1. SPLIT , 通过字符B拆分 字符串A
2. strlen( lv_decimal ). 得到字符串的长度
字段定义:
DATA: vgw01 TYPE c LENGTH 13."plpo-vgw01,"标准值1-机器加工时"
DATA: gv_ctype TYPE char01,
gv_cmsg(220) TYPE c.
CLEAR: gv_ctype.
PERFORM frm_check_vgw USING <lfs_upload>-vgw01.
IF gv_ctype = gc_e.
<lfs_upload>-ctype = gv_ctype.
<lfs_upload>-cmsg = '请检查物料/工序'(005) && <lfs_upload>-matnr && '/' && <lfs_upload>-vornr
&& '的标准值1'(006) && <lfs_upload>-vgw01 && '小数位 超出3位'(007) .
ENDIF.
*&---------------------------------------------------------------------*
*& Form FRM_CHECK_VGW
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
*& --> <LFS_UPLOAD>_VGW01
*& <-- <LFS_UPLOAD>
*&---------------------------------------------------------------------*
FORM frm_check_vgw USING p_vgw01 TYPE char13.
DATA: lv_1(10) TYPE c,
lv_decimal(10) TYPE c,
lv_len TYPE i.
SPLIT p_vgw01 AT '.' INTO lv_1 lv_decimal.
lv_len = strlen( lv_decimal ).
IF lv_len > 3.
gv_ctype = 'E'.
ENDIF.
ENDFORM.