cancel
Showing results for 
Search instead for 
Did you mean: 

Change ekpo-adrn2 per BAPI

hutner
Explorer
0 Kudos
139

Hello,

I want to change the delivery address for each purchase order item (ekpo-adrn2). The whole adress and not only the street ... -> So how can I set adrn2 number per BAPI?

I try BAPI_PO_CHANGE and BAPI_ADDRESSORG_CHANGE. But it does not work for me. Maybe I use both of them wrong.

 

Accepted Solutions (1)

Accepted Solutions (1)

jaroslav_hrbacek
Participant
0 Kudos

you have three options:

This table contains the delivery address for the PO item. The central
address management fields are used for this purpose.

Note
Note the following for addresses:
- If you want to use an existing delivery address, you can transfer
the corresponding address number to the method by entering it in
the ADDR_NO field. The system then checks to make sure this address
exists.
- If the delivery address does not exist, you can use the method to
create it. The address data is not checked by the system. This
means that an SAPEnjoy purchase order may contain incorrect address
data.
- If you want to change an address, use method BAPI_ADDRESSORG_CHANGE
(Basis -> Basis Services/Communication Interfaces -> Address Org ->
Change).

For more information on the individual parameter fields, see the data
element documentation in the ABAP Dictionary.

 

here is my example for option two:

    DATA: fm_addrdelivery TYPE STANDARD TABLE OF bapimepoaddrdelivery,
          fm_return TYPE STANDARD TABLE OF bapiret2,
          fm_poitem TYPE STANDARD TABLE OF bapimepoitem,
          fm_poitemx TYPE STANDARD TABLE OF bapimepoitemx.

    fm_addrdelivery = VALUE #( ( po_item = '00010' name = 'my_name' name_2 = 'hi' street = 'Nothinghill' postl_cod1 = '12345' city = 'Heaven' ) ).
    fm_poitem = VALUE #( ( po_item = '00010' ) ).
    fm_poitemx = VALUE #( ( po_item = '00010' po_itemx = abap_true ) ).

    CALL FUNCTION 'BAPI_PO_CHANGE'
      EXPORTING
        purchaseorder          = '4500351581'
      TABLES
        return                 = fm_return
        poitem                 = fm_poitem
        poitemx                = fm_poitemx
        poaddrdelivery         = fm_addrdelivery
      .

      COMMIT WORK.
hutner
Explorer
0 Kudos
Thanks for your help. I already found my mistake.

Answers (1)

Answers (1)

jaroslav_hrbacek
Participant
0 Kudos

Hello Hutner,

That's strange. I have been using BAPI_PO_CHANGE in many projects and it is very powerfull and usefull. Can you share your coding? Maybe I can help you.

Jarda

hutner
Explorer
0 Kudos

I found my mistake... Now it works!