You can get the Sale Order Number from Table BDCMSGCOLL after you complete BDC all message will contain in the structure Table LT_MSG, loop LT_MSG and let see what SO you will get in the table
DATA : LT_MSG TYPE TABLE OF BDCMSGCOLL.
PERFORM BDC_TRANSACTION TABLES LT_MSG
USING 'VA01'
CTU
MODE
UPDATE.
FORM BDC_TRANSACTION TABLES P_MESSTAB
USING P_TCODE
P_CTU
P_MODE
P_UPDATE.
DATA: L_SUBRC LIKE SY-SUBRC.
IF P_CTU <> 'X'.
CALL FUNCTION 'BDC_INSERT'
EXPORTING TCODE = P_TCODE
TABLES DYNPROTAB = BDCDATA
EXCEPTIONS OTHERS = 1.
ELSE.
CALL TRANSACTION P_TCODE USING BDCDATA
MODE P_MODE
UPDATE P_UPDATE
MESSAGES INTO P_MESSTAB.
ENDIF.
L_SUBRC = SY-SUBRC.
REFRESH BDCDATA.
SY-SUBRC = L_SUBRC.
ENDFORM.
No comments:
Post a Comment