REPORT ZTEST2.
data wa_csin type CSIN.
data wa_stpob like STPOB.
data wa_stzub like STZUB.
data tab_STPOB type table of STPOB.
data wa_STKOB like STKOB.
data g_warn_stlnr type STZUB-STLNR.
data g_flwarning type CAPIFLAG-FLWARNING.
cLEAR wa_csin.
* wa_csin-aennr = '009900159470'.
wa_csin-MATNR = '000000000000001223'.
wa_csin-EMENG = 2.
wa_csin-datuv = sy-datum.
wa_csin-PSPNR = '00045256'.
wa_csin-werks = '2000' .
wa_csin-stlan = '1'. " 4
wa_csin-stlty = 'P'.
wa_stkob-stlty = 'P'.
CLEAR wa_stzub.
wa_stzub-stlty = 'P'.
CLEAR wa_stpob.
wa_stpob-stlty = 'P'.
wa_stpob-idnrk = '000000000000001040'.
wa_stpob-postp = 'L'.
wa_stpob-posnr = '0012' .
wa_stpob-menge = 3.
wa_stpob-potx1 = 'liu'.
wa_stpob-potx2 = 'jin'.
wa_stpob-datuv = sy-datum.
APPEND wa_stpob TO tab_stpob.
CLEAR wa_stpob.
data: l_text type string.
CALL FUNCTION 'CSAI_BOM_CREATE'
EXPORTING
ecsin = wa_csin
estkob = wa_stkob
estzub = wa_stzub
IMPORTING
fl_warning = g_flwarning
astlnr = g_warn_stlnr
TABLES
t_stpob = tab_stpob
EXCEPTIONS
error = 1
OTHERS = 2.
IF sy-subrc NE 0. " here Sy-subrc is 1
MESSAGE ID SY-MSGID TYPE 'I' NUMBER SY-MSGNO into l_text
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
write l_text.
else.
write 'OK'.
ENDIF.
标签:CSAI,SY,WBS,wa,type,BOM,stpob,data,csin
From: https://blog.51cto.com/u_8215601/7508965