Skip to Content
avatar image
Former Member

BAPI_PO_CHANGE add line

Hello

I have read all possible topics regarding my problem but still i did manage to add a line in my PO.

I want to copy the existing purchase order lines and add new lines with another purchase requisition.

I appended the po lines to the table POITEM and added de po item number in the POITEMX table but still i just get the error message : item XXX does not exist

It is refering to the item number that i gave for the items to be added.Which is the indicator telling the bapi to add the lines?

thank you

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Jul 07, 2010 at 03:48 PM

    Hello,

    Could you please try to padding zero's before the line item number?

    Exaxmple:

    Item number if you are passing 10, it should be 00010 like.

    Thanks.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 08, 2010 at 05:18 AM

    Hi

    I believe this is because as you said you have added new line from another PR.

    If you want to change the value then the flow should be like.

    first get the details.

    then make the changes and then

    call BAPI_TRANSACTION_COMMIT.

    I hope you are follwoing the same sequence and also you have mainteained the values for BAPIMEPOITEMX table as well.

    you cannot add another line item in existing PO items therefore you are getting the error message as you have mentioned. because that line item does not exists in the PO and you are trying to add it via BAPI_CHANGE which is not possible in my knowledge.

    you can make changes only in existing values.

    hopw I make this clear to you.

    Thanks

    Lalit Gupta

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Well,i have managed to create PO lines with this BAPI_PO_CHANGE fm,bellow is the code:

      we have to set the X mark for the mandatory fields that need to be inserted,just like the ones that you have to provide in ME22N when adding a line.This X marks are enterred only for the lines to be added,so,for the existing ones i have not added any X in the X tables.

      In the tables LT_POITEM, LT_POSCHEDULE and LT_POACCOUNT i have all the lines that are already existing in the PO and additional i have added new entries with all the fields that are bellow filled with custom po item number.

      LT_POITEMX-PO_ITEM = LV_ITM.

      LT_POITEMX-PO_ITEMX = 'X'.

      LT_POITEMX-ACCTASSCAT = 'X'.

      LT_POITEMX-SHORT_TEXT = 'X'.

      LT_POITEMX-QUANTITY = 'X'.

      LT_POITEMX-PO_UNIT_ISO = 'X'.

      LT_POITEMX-PLANT = 'X'.

      LT_POITEMX-NET_PRICE = 'X'.

      LT_POITEMX-PRICE_UNIT = 'X'.

      LT_POITEMX-MATL_GROUP = 'X'.

      LT_POITEMX-ORDERPR_UN = 'X'.

      LT_POITEMX-PREQ_NO = 'X'.

      LT_POITEMX-PREQ_ITEM = 'X'.

      LT_POITEMX-PREQ_NAME = 'X'.

      APPEND LT_POITEMX.

      LS_POACCOUNTX-PO_ITEM = LV_ITM.

      LS_POACCOUNTX-PO_ITEMX = 'X'.

      LS_POACCOUNTX-GL_ACCOUNT = 'X'.

      LS_POACCOUNTX-NETWORK = 'X'.

      LS_POACCOUNTX-ACTIVITY = 'X'.

      APPEND LS_POACCOUNTX TO LT_POACCOUNTX.

      LS_POSCHEDULEX-PO_ITEM = LV_ITM.

      LS_POSCHEDULEX-DELIVERY_DATE = 'X'.

      APPEND LS_POSCHEDULEX TO LT_POSCHEDULEX.

      CALL FUNCTION 'BAPI_PO_CHANGE'

      EXPORTING

      PURCHASEORDER = LS_RSDB-EBELN

      • POHEADER =

      • POHEADERX =

      • POADDRVENDOR =

      • TESTRUN =

      • MEMORY_UNCOMPLETE =

      • MEMORY_COMPLETE =

      • POEXPIMPHEADER =

      • POEXPIMPHEADERX =

      • VERSIONS =

      • NO_MESSAGING =

      • NO_MESSAGE_REQ =

      • NO_AUTHORITY =

      • NO_PRICE_FROM_PO =

      • IMPORTING

      • EXPHEADER =

      • EXPPOEXPIMPHEADER =

      TABLES

      RETURN = LT_RETURN

      POITEM = LT_POITEM

      POITEMX = LT_POITEMX

      • POADDRDELIVERY =

      POSCHEDULE = LT_POSCHEDULE

      POSCHEDULEX = LT_POSCHEDULEX

      POACCOUNT = LT_POACCOUNT

      • POACCOUNTPROFITSEGMENT =

      POACCOUNTX = LT_POACCOUNTX