Hallo zusammen,
in der Hoffnung das mir jemand helfen kann poste ich folgendes.
In unserem Haus soll nach dem Prozess PlanenBuchenBezahlen (PBB) folgender Teilschritt integriert werden: Beim anlegen einer Bestellung (ME21n) im Werk 100 soll ebenfalls, per USER-EXIT (über das BAPI_PO_CREATE1) eine Bestellung im Werk 200 angelegt werden. Im vorliegenden Fall funktioniert dies auch hervorragend wenn die Bestellung keine Meldung als Rückgabewerte enthält. Sind aber doch Meldungen vorhanden, z.B. Lieferdatum kann nicht eingehalten werden, dann öffnet ein Dialog zur Auswahl ob man sichern, bearbeiten oder abbrechen möchte. Nach Auswahl eines der drei Punkte erfolgt ein Kurzdump. An dieser Stelle scheitern alle Versuche die ursprüngliche Bestellung zu sichern oder zu bearbeiten.
Hat jemand eine Idee wie man dieses verhalten beeinflussen kann?
* Beginn Bestellung
DATA: POHEADER LIKE BAPIMEPOHEADER,
POHEADERX LIKE BAPIMEPOHEADERX,
POADDRVENDOR LIKE BAPIMEPOADDRVENDOR,
TESTRUN LIKE BAPIFLAG-BAPIFLAG,
MEMORY_UNCOMPLETE LIKE BAPIFLAG-BAPIFLAG,
MEMORY_COMPLETE LIKE BAPIFLAG-BAPIFLAG,
POEXPIMPHEADER LIKE BAPIEIKP,
POEXPIMPHEADERX LIKE BAPIEIKPX,
VERSIONS LIKE BAPIMEDCM ,
NO_MESSAGING LIKE BAPIFLAG-BAPIFLAG,
NO_MESSAGE_REQ LIKE BAPIFLAG-BAPIFLAG,
NO_AUTHORITY LIKE BAPIFLAG-BAPIFLAG,
NO_PRICE_FROM_PO LIKE BAPIFLAG-BAPIFLAG.
DATA: T_RETURN LIKE TABLE OF BAPIRET2 WITH HEADER LINE,
POITEM LIKE TABLE OF BAPIMEPOITEM WITH HEADER LINE,
POITEMX LIKE TABLE OF BAPIMEPOITEMX WITH HEADER LINE,
POSCHEDULE LIKE TABLE OF BAPIMEPOSCHEDULE WITH HEADER LINE,
POSCHEDULEX LIKE TABLE OF BAPIMEPOSCHEDULX WITH HEADER LINE,
POACCOUNT LIKE TABLE OF BAPIMEPOACCOUNT WITH HEADER LINE,
POACCOUNTX LIKE TABLE OF BAPIMEPOACCOUNTX WITH HEADER LINE.
DATA: EXPPURCHASEORDER LIKE BAPIMEPOHEADER-PO_NUMBER,
EXPHEADER LIKE BAPIMEPOHEADER,
EXPPOEXPIMPHEADER LIKE BAPIEIKP.
DATA: I_SYST LIKE SYST.
DATA: I_KNTTP LIKE EKPO-KNTTP VALUE '',
I_RETURN LIKE BAPIRET2-MESSAGE..
* 1. Eine externe Bestellung erkennt man am Kontierungstyp (F oder K)
LOOP AT TEKPO.
IF TEKPO-KNTTP EQ 'K' OR TEKPO-KNTTP EQ 'F'.
I_KNTTP = TEKPO-KNTTP.
ENDIF.
ENDLOOP.
IF I_KNTTP EQ 'K' AND I_EKKO-BSART EQ 'NB'.
* PURCHASEORDER.
" Kopfdaten übernehmen
POHEADER-COMP_CODE = '1000'.
POHEADER-DOC_TYPE = 'NEBP'.
* POHEADER-VENDOR = I_EKKO-LIFNR.
POHEADER-VENDOR = '0080453100'.
POHEADER-PURCH_ORG = '200'.
POHEADER-PUR_GROUP = '910'.
POHEADERX-COMP_CODE = 'X'.
POHEADERX-DOC_TYPE = 'X'.
POHEADERX-ITEM_INTVL = 'X'.
POHEADERX-VENDOR = 'X'.
POHEADERX-PMNTTRMS = 'X'.
POHEADERX-PURCH_ORG = 'X'.
POHEADERX-PUR_GROUP = 'X'.
" Positionsdaten
LOOP AT TEKPO.
POITEM-PO_ITEM = TEKPO-EBELP.
POITEM-MATERIAL = TEKPO-MATNR.
POITEM-EMATERIAL = TEKPO-MATNR.
POITEM-PLANT = '200'.
POITEM-MATL_GROUP = TEKPO-MATKL.
POITEM-QUANTITY = TEKPO-MENGE.
POITEM-PO_UNIT = TEKPO-MEINS.
POITEM-ACCTASSCAT = TEKPO-KNTTP.
APPEND POITEM.
POITEMX-PO_ITEM = TEKPO-EBELP.
POITEMX-PO_ITEMX = 'X'.
POITEMX-MATERIAL = 'X'.
POITEMX-PLANT = 'X'.
POITEMX-MATL_GROUP = 'X'.
POITEMX-QUANTITY = 'X'.
POITEMX-PO_UNIT = 'X'.
POITEMX-ACCTASSCAT = 'X'.
APPEND POITEMX.
ENDLOOP.
" Kontierungsdaten
LOOP AT TEKKN.
POACCOUNT-PO_ITEM = TEKKN-EBELP.
POACCOUNT-QUANTITY = TEKKN-MENGE.
POACCOUNT-COSTCENTER = TEKKN-KOSTL.
POACCOUNT-CO_AREA = '1000'.
POACCOUNT-GL_ACCOUNT = TEKKN-SAKTO.
APPEND POACCOUNT.
POACCOUNTX-PO_ITEM = TEKKN-EBELP.
POACCOUNTX-QUANTITY = 'X'.
POACCOUNTX-COSTCENTER = 'X'.
POACCOUNTX-CO_AREA = 'X'.
POACCOUNTX-GL_ACCOUNT = 'X'.
APPEND POACCOUNTX.
ENDLOOP.
" Einteilung
LOOP AT TEKET.
POSCHEDULE-PO_ITEM = TEKET-EBELP.
POSCHEDULE-DEL_DATCAT_EXT = 'T'.
WRITE TEKET-EINDT TO POSCHEDULE-DELIVERY_DATE.
POSCHEDULE-QUANTITY = TEKET-MENGE.
APPEND POSCHEDULE.
POSCHEDULEX-PO_ITEM = TEKET-EBELP.
POSCHEDULEX-PO_ITEMX = 'X'.
POSCHEDULEX-DEL_DATCAT_EXT = 'X'.
POSCHEDULEX-DELIVERY_DATE = 'X'.
POSCHEDULEX-QUANTITY = 'X'.
APPEND POSCHEDULEX.
ENDLOOP.
* Rette die Systemparameter
MOVE-CORRESPONDING SYST TO I_SYST.
CALL FUNCTION 'BAPI_PO_CREATE1'
EXPORTING
POHEADER = POHEADER
POHEADERX = POHEADERX
* POADDRVENDOR =
* TESTRUN =
MEMORY_UNCOMPLETE = ''
MEMORY_COMPLETE = ''
* POEXPIMPHEADER =
* POEXPIMPHEADERX =
* VERSIONS =
NO_MESSAGING = 'X'
NO_MESSAGE_REQ = 'X'
* NO_AUTHORITY =
* NO_PRICE_FROM_PO =
IMPORTING
EXPPURCHASEORDER = EXPPURCHASEORDER
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
RETURN = T_RETURN
POITEM = POITEM
POITEMX = POITEMX
* POADDRDELIVERY =
POSCHEDULE = POSCHEDULE
POSCHEDULEX = POSCHEDULEX
POACCOUNT = POACCOUNT
* POACCOUNTPROFITSEGMENT =
POACCOUNTX = POACCOUNTX
* POCONDHEADER =
* POCONDHEADERX =
* POCOND =
* POCONDX =
* POLIMITS =
* POCONTRACTLIMITS =
* POSERVICES =
* POSRVACCESSVALUES =
* POSERVICESTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* POEXPIMPITEM =
* POEXPIMPITEMX =
* POTEXTHEADER =
* POTEXTITEM =
* ALLVERSIONS =
* POPARTNER =
* POCOMPONENTS =
* POCOMPONENTSX =
* POSHIPPING =
* POSHIPPINGX =
* POSHIPPINGEXP =
.
* LOOP AT RETURN TO 1.
* IF RETURN-TYPE = 'E'.
* I_RETURN = RETURN-MESSAGE.
* ENDIF.
* ENDLOOP.
CALL FUNCTION 'Z_POPUP_RETURN_PARAM'
TABLES
RETURN = T_RETURN.
* Für Tests kein commit
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'
* IMPORTING
* RETURN =
.
* PERFORM SALESORDER.
ENDIF.