REPORT z_barry_check_cr.
TABLES: sscrfields.
DATA: bdcdata LIKE bdcdata OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF messtab OCCURS 0.
INCLUDE STRUCTURE bdcmsgcoll.
DATA: END OF messtab.
DATA: BEGIN OF itab OCCURS 0 ,
line(20) ,
END OF itab.
DATA: BEGIN OF up_file OCCURS 0 ,
pgmid LIKE e071-pgmid,
object LIKE e071-object,
obj_name LIKE e071-obj_name,
END OF up_file.
PARAMETERS mode LIKE ctu_params-dismode DEFAULT 'E' .
SELECTION-SCREEN SKIP.
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) T1.
SELECTION-SCREEN POSITION 24.
PARAMETERS status1 AS CHECKBOX.
SELECTION-SCREEN COMMENT 26(12) T2.
PARAMETERS status2 DEFAULT 'X' AS CHECKBOX.
SELECTION-SCREEN COMMENT 41(12) T3.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN FUNCTION KEY 1.
INITIALIZATION.
sscrfields-functxt_01 = '限制Request值'.
t1 = 'Request Status'.
t2 = 'Modifiable'.
t3 = 'Released'.
AT SELECTION-SCREEN.
CHECK sy-ucomm = 'FC01'.
EDITOR-CALL FOR itab TITLE '输入Request值'.
DELETE itab WHERE LINE = ''.
START-OF-SELECTION.
PERFORM upfile.
PERFORM bdc.
*&---------------------------------------------------------------------*
*& Form upfile
*&---------------------------------------------------------------------*
FORM upfile.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = 'C:\checkcr.txt'
has_field_separator = 'X'
TABLES
data_tab = up_file
EXCEPTIONS
OTHERS = 17.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
DELETE up_file WHERE pgmid = '' AND object ='' AND obj_name = '' .
LOOP AT up_file WHERE pgmid = '' OR object ='' OR obj_name = '' .
MESSAGE e000(oo) WITH '文件有错,存在空字段'.
ENDLOOP.
ENDFORM. "upfile
*&---------------------------------------------------------------------*
*& Form bdc
*&---------------------------------------------------------------------*
FORM bdc.
CLEAR: bdcdata,bdcdata[].
PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=STRT'.
PERFORM bdc_field USING 'RS38M-PROGRAMM' 'RSWBO040'.
PERFORM bdc_field USING 'RS38M-FUNC_EDIT' 'X'.
IF itab[] IS NOT INITIAL.
PERFORM bdc_dynpro USING 'RSWBO040' '1000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=%104'.
LOOP AT itab.
PERFORM bdc_dynpro USING 'SAPLALDB' '3000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=P+'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RSCSEL-SLOW_I(02)'.
PERFORM bdc_field USING 'RSCSEL-SLOW_I(02)' itab-line .
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPLALDB' '3000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ACPT'.
ENDIF.
LOOP AT up_file.
PERFORM bdc_dynpro USING 'RSWBO040' '1000'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ONLI'.
PERFORM bdc_field USING 'CHECKA' 'X'.
PERFORM bdc_field USING 'OBJECTA' up_file-object .
PERFORM bdc_field USING 'OBJNAMEA' up_file-obj_name .
PERFORM bdc_field USING 'STATUS1' status1.
PERFORM bdc_field USING 'STATUS2' status2 .
ENDLOOP.
PERFORM bdc_dynpro USING 'RSWBO040' '1000'.
PERFORM bdc_field USING 'BDC_OKCODE' '/EE'.
PERFORM bdc_dynpro USING 'SAPLWBABAP' '0100'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BACK'.
CALL TRANSACTION 'SE38' USING bdcdata MODE mode .
ENDFORM. "bdc
*----------------------------------------------------------------------*
* Start new screen *
*----------------------------------------------------------------------*
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
*----------------------------------------------------------------------*
* Insert field *
*----------------------------------------------------------------------*
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
CONDENSE bdcdata-fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
阅读(2956) | 评论(0) | 转发(0) |