Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Adding new line item while save

Former Member
0 Likes
576

Hi all,

use an implementation of BADI ME_PROCESS_REQ_CUST in the MM-Purchase-Requisition, method IF_EX_ME_PROCESS_REQ_CUST~POST while save.

based on the line items available(USER ENTERED) i have to add few more line items based on the account assignment category and quantity while save.

How to create new line items (copying the existing line item and change the quantity ) and save the requestion with the additional line items. I used this code. while calling the method CRETE_ITEM create based on the object REF_ITEM in the MY_STATE.

the REF_ITEM object is Initial . so while creation the empty object is created.

kindly help to give tips/details to handle.

-


Coding:

data: l_item_list TYPE MMPUR_REQUISITION_ITEMS,

l_item TYPE MMPUR_REQUISITION_ITEM,

l_item_akt TYPE mereq_item,

l_item_ref TYPE ref to IF_PURCHASE_REQUISITION_ITEM.

l_item_list = im_header->get_items().

loop at l_item_list into l_item.

l_item_akt = l_item-item->get_data( ).

IF l_item_akt-MENGE > 1 AND

l_item_akt -KNTTP = 'A'.

DO l_item_akt -MENGE TIMES.

l_item-item= IM_HEADER->CREATE_ITEM( IM_ITEM = l_item-item).

INSERT l_item INTO TABLE IT_ITEMS_list.

%%%%% here i checked useing get data method i am not getting any data other than relesing procedure data.

I used SET_DATA method to set the data. even I am not getting data.

endloop.

-


(Debugging the code, I manage by doubleclicking while create Item method the fieldcontent of l_item (e.g ) to show the content of the class-attribute my_state. This works only if the field “Interface” in the Debugger is empty because then I see the attributes of the class. If the field Interface is filled with “IF_PURCHASE_REQUISITION_ITEM”, there aren’t any attributes shown.)

Thanks in advance for your kind help!!

Nicole

1 REPLY 1
Read only

Former Member
0 Likes
432

I searched sdn and found this not possible.