Codes:
REPORT zchangeqty.
* DO update
DATA gw_do_header TYPE bapiobdlvhdrchg.
DATA gw_do_ctrl TYPE bapiobdlvhdrctrlchg.
DATA gv_delivery TYPE vbeln_vl.
DATA gt_doitem TYPE STANDARD TABLE OF bapiobdlvitemchg.
DATA gt_doitemctrl TYPE STANDARD TABLE OF bapiobdlvitemctrlchg.
DATA gt_doretn TYPE STANDARD TABLE OF bapiret2.
DATA lw_doitem TYPE bapiobdlvitemchg.
DATA lw_doitemctrl TYPE bapiobdlvitemctrlchg.
DATA lw_doretn TYPE bapiret2.
DATA lw_lips TYPE lips.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = '80000349'
IMPORTING
output = gv_delivery.
"header
gw_do_header-deliv_numb = gv_delivery.
"header control
gw_do_ctrl-deliv_numb = gv_delivery.
"items
CLEAR lw_doitem.
lw_doitem-deliv_numb = gv_delivery.
lw_doitem-dlv_qty = '9'. "<----new qty from 10 to 9
SELECT SINGLE * FROM lips INTO lw_lips
WHERE vbeln = lw_doitem-deliv_numb.
IF sy-subrc = 0.
lw_doitem-fact_unit_nom = lw_lips-umvkz.
lw_doitem-fact_unit_denom = lw_lips-umvkn.
lw_doitem-conv_fact = lw_lips-umrev.
lw_doitem-deliv_item = lw_lips-posnr.
lw_doitem-sales_unit = lw_lips-vrkme.
ENDIF.
APPEND lw_doitem TO gt_doitem.
"item control
lw_doitemctrl-deliv_numb = gv_delivery.
lw_doitemctrl-deliv_item = lw_doitem-deliv_item.
lw_doitemctrl-chg_delqty = 'X'.
APPEND lw_doitemctrl TO gt_doitemctrl.
CALL FUNCTION 'BAPI_OUTB_DELIVERY_CHANGE'
EXPORTING
header_data = gw_do_header
header_control = gw_do_ctrl
delivery = gv_delivery
TABLES
item_data = gt_doitem
item_control = gt_doitemctrl
return = gt_doretn.
READ TABLE gt_doretn INTO lw_doretn WITH KEY type = 'E'.
IF sy-subrc = 0.
"Error handling
ELSE.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDIF.
Before:
After:
Subscribe to:
Post Comments
(
Atom
)
1 comment :
Very informative article, really big help for newbie in SAP ABAP... Very thankyou..
Post a Comment