Guten Tag,
ich habe eine Frage zum bzw. ein Problem mit dem Funktionsbaustein BAPI_PO_CHANGE.
Ich rufe den Baustein mit (für mein Verständnis) allen nötigen Parametern (inkl. "X-Strukturen")auf, dennoch wird am Ende keine Änderung durchgeführt und in der RETURN Tabelle steht "Es wurden keine Daten verändert".
Ziel sollte es sein, die Versanddaten einer Umlagerungsbestellung hinsichtlich Versandstelle und Versandbedingung anzupassen.
Hat hier ggf. jemand eine Idee oder einen Tipp, woran es liegen könnte?
Vielen Dank!
Hier mal der Auszug aus dem Programmcode:
DATA: ls_mepoheader LIKE bapimepoheader.
DATA: ls_mepoheaderx LIKE bapimepoheaderx.
DATA: lt_mepoitem TYPE STANDARD TABLE OF bapimepoitem.
DATA: ls_mepoitem TYPE bapimepoitem.
DATA: lt_mepoitemx TYPE STANDARD TABLE OF bapimepoitemx.
DATA: ls_mepoitemx TYPE bapimepoitemx.
DATA: lt_poshipping TYPE STANDARD TABLE OF bapiitemship.
DATA: ls_poshipping TYPE bapiitemship.
DATA: lt_poshippingx TYPE STANDARD TABLE OF bapiitemshipx.
DATA: ls_poshippingx TYPE bapiitemshipx.
DATA: lt_return LIKE TABLE OF bapiret2.
DATA: ls_ekko TYPE ekko,
lt_ekpo TYPE TABLE OF ekpo,
ls_ekpo TYPE ekpo,
ls_ekpv TYPE ekpv,
ls_tvstz TYPE tvstz.
SELECT SINGLE * FROM ekko INTO CORRESPONDING FIELDS OF ls_ekko
WHERE ebeln = g_exp_ebeln
AND bsart EQ 'ZRIC'.
SELECT * FROM ekpo INTO CORRESPONDING FIELDS OF TABLE lt_ekpo
WHERE ebeln = ls_ekko-ebeln.
LOOP AT lt_ekpo INTO ls_ekpo.
SELECT SINGLE * FROM ekpv INTO CORRESPONDING FIELDS OF ls_ekpv
WHERE ebeln = ls_ekko-ebeln
AND ebelp = ls_ekpo-ebelp.
" Versanddaten sind in Tabelle EKPV gespeichert.
IF ls_ekpv IS NOT INITIAL.
" Aus Customizingtabelle die Versandstelle suchen für Versandbedingung 'RU':
SELECT SINGLE * FROM tvstz INTO CORRESPONDING FIELDS OF ls_tvstz
WHERE vsbed = 'RU'
AND ladgr = ls_ekpv-ladgr
AND werks = ls_ekko-reswk.
ENDIF.
ls_mepoheader-po_number = g_exp_ebeln.
ls_mepoheaderx-po_number = 'X'.
ls_mepoitem-po_item = ls_ekpo-ebelp.
ls_mepoitemx-po_item = ls_ekpo-ebelp.
ls_mepoitemx-po_itemx = 'X'.
APPEND ls_mepoitem TO lt_mepoitem.
APPEND ls_mepoitemx TO lt_mepoitemx.
ls_poshipping-po_item = ls_ekpo-ebelp.
ls_poshippingx-po_item = ls_ekpo-ebelp.
ls_poshippingx-po_itemx = 'X'.
ls_poshipping-ship_cond = 'RU'.
ls_poshippingx-ship_cond = 'X'.
ls_poshipping-ship_point = ls_tvstz-vstel.
ls_poshippingx-ship_point = 'X'.
APPEND ls_poshipping TO lt_poshipping.
APPEND ls_poshippingx TO lt_poshippingx.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
purchaseorder = g_exp_ebeln
poheader = ls_mepoheader
poheaderx = ls_mepoheaderx
TABLES
poitem = lt_mepoitem
poitemx = lt_mepoitemx
return = lt_return
poshipping = lt_poshipping
poshippingx = lt_poshippingx.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'
EXPORTING
wait = 'X'.
ENDLOOP.