REPORT程序中用BDC录入
DATA: GS_BDC TYPE BDCDATA, GT_BDC TYPE TABLE OF BDCDATA, GS_MSG TYPE BDCMSGCOLL, GT_MSG TYPE TABLE OF BDCMSGCOLL.
FORM FRM_BDC_BUILD USING DYNBEGIN FNAM FVAL. CLEAR : GS_BDC. IF DYNBEGIN = 'X'. GS_BDC-DYNBEGIN = 'X'. GS_BDC-PROGRAM = FNAM. GS_BDC-DYNPRO = FVAL. APPEND GS_BDC TO GT_BDC. ELSE. GS_BDC-FNAM = FNAM. GS_BDC-FVAL = FVAL. APPEND GS_BDC TO GT_BDC. ENDIF. ENDFORM.
BDC录屏T-CODE:SM35、SHDB
录屏之后整理BDC代码
LOOP AT GT_P0001 INTO GS_P0001. REFRESH: GT_BDC, GT_MSG. PERFORM FRM_BDC_DYNPRO USING: 'X' 'SAPMP50A' '1000', ' ' 'BDC_OKCODE' 'COP', ' ' 'RP50G-PERNR' GS_P0001-PERNR, ' ' 'RP50G-TIMR6' 'X', ' ' 'RP50G-CHOIC' '0000', 'X' 'MP000000' '2000', ' ' 'BDC_OKCODE' 'UPD', ' ' 'P0000-BEGDA' SY-DATUM, ' ' 'P0000-MASSN' 'A4', ' ' 'P0000-MASSG' '01', 'X' 'MP000100' '2000', ' ' 'BDC_OKCODE' 'UPD', ' ' 'P0001-BTRTL' GS_P0001-BTRTL, ' ' 'P0001-ABKRS' GS_P0001-ABKRS, 'X' 'MP001600' '2000', ' ' 'BDC_OKCODE' 'EBCK'. CALL TRANSACTION 'PA30' USING GT_BDC MODE P_MODE "A:调试 N:不显示 E:错误时调试 UPDATE P_UPDATE "A:异步 S:同步 L:本地更新 MESSAGES INTO GT_MSG. IF SY-SUBRC <> 0. DATA LV_MTEXT TYPE STRING. LOOP AT GT_MSG INTO GS_MSG. CLEAR LV_MTEXT. MESSAGE ID GS_MSG-MSGID TYPE GS_MSG-MSGTYP NUMBER GS_MSG-MSGNR INTO LV_MTEXT WITH GS_MSG-MSGV1 GS_MSG-MSGV2 GS_MSG-MSGV3 GS_MSG-MSGV4. WRITE: / GS_P0001-PERNR . WRITE LV_MTEXT. ENDLOOP. ENDIF. ENDLOOP.