Skip to Content
Author's profile photo Christine Kühberger

Sample code for changing delivery address in purchase requisition with IF_EX_ME_PROCESS_REQ_CUST~PROCESS_ITEM

The business requirement for this piece of coding was the following: a user-specific delivery address is to be created with transaction MEAN. The assignment of the address number to a user is stored in a z-table. When a purchase requisition is created, the address number is read from the table and written to the field adrn2 in the structure mereq_item.

Please note: to simplify the example, a hard coded value was used for the address number.

First check whether field to be changed is contained in MEREQ_ITEM_S_CUST_ALLOWED. If not, create append structure and add field adrn2.

Implementation of Method IF_EX_ME_PROCESS_REQ_CUST~PROCESS_ITEM:

DATA: ls_item_mereq TYPE MEREQ_ITEM.
* get item data
ls_item_mereq = im_item->get_data( ).
* change delivery address
if ls_item_mereq-adrn2 is initial.

ls_item_mereq-adrn2  = ‘0000022297’.

im_item->set_data( ls_item_mereq ) .

MOVE: ‘X’ TO ls_datax-adrn2.

im_item->set_datax( ls_datax ) .
endif.

Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Thanks a lot for this post !

      Indeed, in our case, address fields (ADRNR and ADRN2) were not contained in standard structure MEREQ_ITEM_S_CUST_ALLOWED, but it worked fine after adding an append structure.

       

      Sébastien