constants :gc_x(1) type c value 'X'.
data: begin of gt_return_all occurs 0,
log_nmb(4) type c,
doc_nmb(10) type c,
itm_nmb(6) type c,
log_dsc(100) type c,
end of gt_return_all.
data: "gv_funcname(29) VALUE 'YUSD_GATP_GET_UPDATE_RSC_DONE',
lv_vbeln type bapivbeln-vbeln,
lv_posnr type posnr_va,
" lv_spart TYPE vbap-spart,
ls_order_header_in like bapisdh1,
ls_order_header_inx like bapisdh1x.
data: lt_ord_itm like bapisditm occurs 0 with header line,
lt_ord_itm_x like bapisditmx occurs 0 with header line,
lt_return like bapiret2 occurs 0 with header line,
lt_extensionin like bapiparex occurs 0 with header line.
data: ls_exsi like bape_vbap,
ls_exsx like bape_vbapx.
* DATA: A(1) Value 1.
* WHILE A = 1.
* ENDWHILE.
loop at gt_data.
clear: lv_vbeln, lv_posnr,
ls_order_header_in,
ls_order_header_inx.
ls_order_header_inx-updateflag = 'U'.
lv_vbeln = gt_data-delnr.
lv_posnr = gt_data-delps.
clear: lt_extensionin[],
lt_ord_itm[],
lt_ord_itm_x[],
lt_return.
*
ls_exsi-vbeln = lv_vbeln.
ls_exsi-posnr = lv_posnr.
ls_exsi-zzresch = gc_x.
*
lt_extensionin-structure = 'BAPE_VBAP'.
lt_extensionin-valuepart1 = ls_exsi.
append lt_extensionin.
ls_exsx-vbeln = lv_vbeln.
ls_exsx-posnr = lv_posnr.
ls_exsx-zzresch = 'X'.
lt_extensionin-structure = 'BAPE_VBAPX'.
lt_extensionin-valuepart1 = ls_exsx.
append lt_extensionin.
* CLEAR : lv_spart .
* SELECT SINGLE spart
* FROM vbap
* INTO lv_spart
* WHERE vbeln EQ lv_vbeln
* AND posnr EQ lv_posnr.
lt_ord_itm-itm_number = lv_posnr.
append lt_ord_itm.
lt_ord_itm_x-itm_number = lv_posnr.
lt_ord_itm_x-updateflag = 'U'.
* lt_ord_itm_x-division = 'X'.
append lt_ord_itm_x.
* EXPORT gv_funcname TO MEMORY ID 'gv_funcname'.
call function 'BAPI_SALESORDER_CHANGE'
exporting
salesdocument = lv_vbeln
order_header_in = ls_order_header_in
order_header_inx = ls_order_header_inx
tables
return = lt_return
order_item_in = lt_ord_itm
order_item_inx = lt_ord_itm_x
extensionin = lt_extensionin.
read table lt_return with key type = 'E'.
if sy-subrc ne 0.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.
else.
call function 'BAPI_TRANSACTION_ROLLBACK'.
loop at lt_return.
clear :gt_return_all.
gt_return_all-log_nmb = ''.
gt_return_all-doc_nmb = lv_vbeln.
gt_return_all-itm_nmb = lv_posnr.
gt_return_all-log_dsc = lt_return-message.
append gt_return_all.
endloop.
endif.
endloop.
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP S/4 HANA Logistics Team Lead
Contact : serkurumsal@yandex.com
Social Plugin