REPORT z_scm_nacr_bdc .
INCLUDE bdcrecx1.
TABLES: b999,zscm_worktime.
DATA: BEGIN OF itab OCCURS 0 ,
lifnr LIKE lfa1-lifnr,
END OF itab.
DATA: BEGIN OF itab_log OCCURS 0,
message(132) TYPE c,
END OF itab_log.
DATA: day LIKE sy-datum.
PARAMETERS: p_mode LIKE ctu_params-dismode DEFAULT 'E' ,
pri_all AS CHECKBOX . "全部打印
START-OF-SELECTION.
PERFORM getdata.
PERFORM bdc.
*---------------------------------------------------------------------*
* FORM getdata *
*---------------------------------------------------------------------*
FORM getdata.
day = sy-datum - 9 .
SELECT lifnr INTO TABLE itab FROM zscmvendor
WHERE date_from <= day AND
date_to >= sy-datum .
ENDFORM.
*---------------------------------------------------------------------*
* FORM bdc *
*---------------------------------------------------------------------*
FORM bdc .
PERFORM open_group.
REFRESH bdcdata .
CLEAR bdcdata .
PERFORM bdc_dynpro USING 'SAPMV13B' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RV130-KAPPL'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ANTA'.
PERFORM bdc_field USING 'RV130-KAPPL' 'EF'.
PERFORM bdc_field USING 'RV13B-KSCHL' 'NEU'.
PERFORM bdc_dynpro USING 'SAPLV14A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RV130-SELKZ(01)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=WEIT'.
PERFORM bdc_dynpro USING 'RV13B999' '1000'.
PERFORM bdc_field USING 'F001-LOW' ''.
PERFORM bdc_field USING 'BDC_OKCODE' '=ONLI'.
PERFORM bdc_dynpro USING 'SAPMV13B' '1999'.
PERFORM bdc_field USING 'BDC_OKCODE' '=MARL'.
PERFORM bdc_dynpro USING 'SAPMV13B' '1999'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ENTF'.
PERFORM bdc_dynpro USING 'SAPMV13B' '1999'.
PERFORM bdc_field USING 'BDC_OKCODE' '=SICH'.
SELECT SINGLE * FROM b999 .
IF sy-subrc = 0.
PERFORM bdc_transaction USING 'NACR'.
ENDIF.
CHECK NOT itab[] IS INITIAL.
REFRESH bdcdata .
CLEAR bdcdata .
PERFORM bdc_dynpro USING 'SAPMV13B' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RV130-KAPPL'.
PERFORM bdc_field USING 'BDC_OKCODE' '=ANTA'.
PERFORM bdc_field USING 'RV130-KAPPL' 'EF'.
PERFORM bdc_field USING 'RV13B-KSCHL' 'NEU'.
PERFORM bdc_dynpro USING 'SAPLV14A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RV130-SELKZ(01)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=WEIT'.
PERFORM bdc_dynpro USING 'RV13B999' '1000'.
PERFORM bdc_field USING 'F001-LOW' ''.
PERFORM bdc_field USING 'BDC_OKCODE' '=ONLI'.
LOOP AT itab .
PERFORM bdc_dynpro USING 'SAPMV13B' '1999'.
PERFORM bdc_field USING 'BDC_CURSOR' 'NACH-SPRAS(02)'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'KOMB-LIFNR(02)' itab-lifnr .
PERFORM bdc_field USING 'NACH-PARVW(02)' 'VN'.
PERFORM bdc_field USING 'NACH-NACHA(02)' '1'.
PERFORM bdc_field USING 'NACH-VSZTP(02)' '3'.
PERFORM bdc_field USING 'NACH-SPRAS(02)' 'ZH'.
PERFORM bdc_dynpro USING 'SAPMV13B' '1999'.
PERFORM bdc_field USING 'BDC_OKCODE' '=NEWP'.
PERFORM bdc_dynpro USING 'SAPMV13B' '1999'.
PERFORM bdc_field USING 'BDC_CURSOR' 'KOMB-LIFNR(01)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=KOMM'.
PERFORM bdc_dynpro USING 'SAPMV13B' '0211'.
PERFORM bdc_field USING 'BDC_OKCODE' '=BACK'.
PERFORM bdc_field USING 'NACH-LDEST' 'SAPLPD'.
PERFORM bdc_field USING 'NACH-DIMME' 'X'.
PERFORM bdc_field USING 'NACH-DELET' 'X'.
ENDLOOP.
PERFORM bdc_dynpro USING 'SAPMV13B' '1999'.
PERFORM bdc_field USING 'BDC_OKCODE' '=SICH'.
SELECT SINGLE * FROM zscm_worktime WHERE name = 'SCM' AND
date_from <= sy-datum AND
date_end >= sy-datum .
IF sy-subrc = 0 AND pri_all = '' . " 只有当SCM工作正常时才填入
PERFORM bdc_transaction USING 'NACR'.
ENDIF.
PERFORM close_group.
ENDFORM. " bdc
*************************
相对于直接Call Trancaction的方法,只要前后各加一个函数,然后把Call Trancaction换成PERFORM bdc_transaction即可
Text symbols可以在程序ROCMBIRECORD中COPY
E00 Error opening dataset, return code:
I01 Session name
I02 Open session
I03 Insert transaction
I04 Close session
I05 Rtrn code =
I06 Error session created
S01 Session name
S02 User
S03 Keep session
S04 Lock date
S05 Processing mode
S06 Update session
S07 Generate session
S08 Call transaction
S09 Error sessn
S10 Nodata indicator
阅读(4996) | 评论(0) | 转发(0) |