FUNCION ME_PUR_DOCU_CHANGE
TIPO MM
DESCRIPCION Modifica posiciones de pedidos de compra
REPORT Y_ME_PUR_DOCU_CHANGE .
tables: BAPIEKPOV, BAPIRETURN, ekpo, EKET.
start-of-selection.
data: l_ekpo1 like BAPIEKPOV OCCURS 3 WITH HEADER LINE,
l_ekpo2 like BAPIEKPOV OCCURS 3 WITH HEADER LINE,
L_RETURN LIKE BAPIRETURN OCCURS 3 WITH HEADER LINE.
select single * from ekpo
where ebeln = '4500009473'
and ebelp = '00001'.
select single * from ekET
where ebeln = '4500009473'
and ebelp = '00001'
AND ETENR = '0001'.
L_EKPO1-PO_NUMBER = EKPO-EBELN.
L_EKPO1-PO_ITEM = EKPO-EBELP.
L_EKPO1-DELETE_IND = EKPO-LOEKZ.
L_EKPO1-QUANTITY = EKPO-MENGE.
L_EKPO1-UNIT = EKPO-MEINS.
L_EKPO1-DELIV_DATE = EKET-EINDT.
APPEND L_EKPO1.
L_EKPO2 = L_EKPO1.
L_EKPO2-QUANTITY = '12.000'.
APPEND L_EKPO2.
APPEND L_EKPO2.
CALL FUNCTION 'ME_PUR_DOCU_CHANGE'
EXPORTING
NUMBER = '4500009473'
TABLES
PO_ITEMS_OLD = l_ekpo1
PO_ITEMS_NEW = l_ekpo2
RETURN = L_RETURN
EXCEPTIONS
INVALID_CALL_OF_FB = 1
OTHERS = 2.
LOOP AT L_RETURN.
write / L_return.
ENDLOOP.