Skip to Content
avatar image
-2
Former Member

BAPI_PO_CHANGE (PO changed) without update in ME22N

I want to add service in ME22N.

LOOP AT IT_PO ASSIGNING FIELD-SYMBOL(<FS_PO>).
READ TABLE IT_POITEM INTO WA_POITEM INDEX SY-TABIX.
READ TABLE IT_POSERVICES INTO WA_POSERVICES INDEX SY-TABIX.
WA_POSERVICES-SHORT_TEXT = <FS_PO>-KTEXT1.
WA_POSERVICES-GR_PRICE = <FS_PO>-TBTWR.
WA_POSERVICES-BASE_UOM = <FS_PO>-MEINS.
WA_POSERVICES-QUANTITY = <FS_PO>-MENGE.
WA_POSERVICES-PCKG_NO = WA_POITEM-PCKG_NO.
WA_POACCOUNT-COSTCENTER = <FS_PO>-KOSTL.
WA_POACCOUNT-PO_ITEM = WA_POITEM-PO_ITEM.
WA_POSRVACCESSVALUES-PCKG_NO = WA_POITEM-PCKG_NO.
WA_POSRVACCESSVALUES-LINE_NO = WA_POSERVICES-LINE_NO.

CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = WA_POACCOUNT-COSTCENTER
IMPORTING
OUTPUT = WA_POACCOUNT-COSTCENTER.

APPEND WA_POACCOUNT TO IT_POACCOUNT.
MODIFY IT_POSERVICES INDEX SY-TABIX FROM WA_POSERVICES TRANSPORTING SHORT_TEXT GR_PRICE BASE_UOM QUANTITY PCKG_NO LINE_NO.
APPEND WA_POSRVACCESSVALUES TO IT_POSRVACCESSVALUES.

WA_POACCOUNTX-PO_ITEM = WA_POITEM-PO_ITEM.
WA_POACCOUNTX-PO_ITEMX = 'X'.
WA_POACCOUNTX-COSTCENTER = 'X'.
WA_POITEM-PCKG_NO = WA_POITEM-PCKG_NO.
WA_POITEMX-PO_ITEM = WA_POITEM-PO_ITEM.
WA_POITEMX-PO_ITEMX = 'X'.
WA_POITEMX-QUANTITY = 'X'.
WA_POITEMX-PCKG_NO = 'X'.
WA_POCOND-ITM_NUMBER = WA_POITEM-PO_ITEM.
WA_POCOND-CHANGE_ID = 'I'.
WA_POCONDX-ITM_NUMBER = WA_POITEM-PO_ITEM.
WA_POCONDX-CHANGE_ID = 'X'.
WA_POCONDX-COND_VALUE = 'X'.
APPEND WA_POACCOUNTX TO IT_POACCOUNTX.
APPEND WA_POITEMX TO IT_POITEMX.
APPEND WA_POCOND TO IT_POCOND.
APPEND WA_POCONDX TO IT_POCONDX.
ENDLOOP.

PR_NUM = P_PR.
CALL FUNCTION 'BAPI_PO_CHANGE'
EXPORTING
PURCHASEORDER = PR_NUM
* POHEADER =
* POHEADERX =
* POADDRVENDOR =
* TESTRUN =
* MEMORY_UNCOMPLETE =
* MEMORY_COMPLETE =
* POEXPIMPHEADER =
* POEXPIMPHEADERX =
* VERSIONS =
* NO_MESSAGING =
* NO_MESSAGE_REQ =
* NO_AUTHORITY =
* NO_PRICE_FROM_PO =
* PARK_UNCOMPLETE =
* PARK_COMPLETE =
* IMPORTING
* EXPHEADER =
* EXPPOEXPIMPHEADER =
TABLES
RETURN = RETURN
POITEM = IT_POITEM
POITEMX = IT_POITEMX
* POADDRDELIVERY =
* POSCHEDULE =
* POSCHEDULEX =
POACCOUNT = IT_POACCOUNT
* POACCOUNTPROFITSEGMENT =
POACCOUNTX = IT_POACCOUNTX
* POCONDHEADER =
* POCONDHEADERX =
POCOND = IT_POCOND
POCONDX = IT_POCONDX
* POLIMITS =
* POCONTRACTLIMITS =
POSERVICES = IT_POSERVICES
POSRVACCESSVALUES = IT_POSRVACCESSVALUES
* POSERVICESTEXT =
* EXTENSIONIN =
* EXTENSIONOUT =
* POEXPIMPITEM =
* POEXPIMPITEMX =
* POTEXTHEADER =
* POTEXTITEM =
* ALLVERSIONS =
* POPARTNER =
* POCOMPONENTS =
* POCOMPONENTSX =
* POSHIPPING =
* POSHIPPINGX =
* POSHIPPINGEXP =
* POHISTORY =
* POHISTORY_TOTALS =
* POCONFIRMATION =
* SERIALNUMBER =
* SERIALNUMBERX =
* INVPLANHEADER =
* INVPLANHEADERX =
* INVPLANITEM =
* INVPLANITEMX =
* POHISTORY_MA =
.
IF SY-SUBRC = 0.
CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
ENDIF.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Mar 16 at 01:34 PM

    Replace this wrong "IF SY-SUBRC = 0." with a more adequate LOOP AT RETURN looking for error 'E' or abort 'A' type messages, only when none found execute the commit, else analyze message.

    Add comment
    10|10000 characters needed characters exceeded