‎2008 Apr 17 5:21 AM
Hi friends
I want to do some validation at header based on items uisng method PROCESS_HEADER.
please can you tell me how can i get the items in header method.
i am poor OOPS pgming. please any one correct my code as given below.
i am trying to fetch the itm data from hdr as follows , but its going to dump.
DATA:lmepoheader TYPE mepoheader.
data: ls_item type line of PURCHASE_ORDER_ITEMS.
data: ls_itm type ref to IF_PURCHASE_ORDER_ITEM_MM.
data: itm_data type mepoitem.
DATA: lv_reslo TYPE ekpo-reslo.
CALL METHOD im_header->get_data
RECEIVING
re_data = lmepoheader.
CALL METHOD im_header->get_items
receiving
re_items = ls_item.
CALL METHOD ls_itm->get_data
receiving
re_data = itm_data.
lv_reslo = itm_data-reslo. "Issuing Storg
please tell me whre i amdoing wrong.
Thanks
Ramesh
‎2008 Apr 17 5:48 AM
Hi,
Please find the corrected code,
[method IF_EX_ME_PROCESS_PO_CUST~PROCESS_HEADER.
DATA:lmepoheader TYPE mepoheader.
data: itm_data type mepoitem.
DATA: lv_reslo TYPE ekpo-reslo.
DATA: it_items TYPE purchase_order_items,
wa_items LIKE LINE OF it_items.
CALL METHOD im_header->get_data
RECEIVING
re_data = lmepoheader.
CALL METHOD im_header->get_items
receiving
re_items = it_items.
LOOP AT it_items INTO wa_items.
CALL METHOD wa_items-item->get_data
receiving
re_data = itm_data.
lv_reslo = itm_data-reslo.
ENDLOOP.
endmethod.]
Reward points if you find it helpful.
Regards,
Prasanna
‎2008 Apr 17 5:48 AM
Hi,
Please find the corrected code,
[method IF_EX_ME_PROCESS_PO_CUST~PROCESS_HEADER.
DATA:lmepoheader TYPE mepoheader.
data: itm_data type mepoitem.
DATA: lv_reslo TYPE ekpo-reslo.
DATA: it_items TYPE purchase_order_items,
wa_items LIKE LINE OF it_items.
CALL METHOD im_header->get_data
RECEIVING
re_data = lmepoheader.
CALL METHOD im_header->get_items
receiving
re_items = it_items.
LOOP AT it_items INTO wa_items.
CALL METHOD wa_items-item->get_data
receiving
re_data = itm_data.
lv_reslo = itm_data-reslo.
ENDLOOP.
endmethod.]
Reward points if you find it helpful.
Regards,
Prasanna
‎2008 Apr 17 7:34 AM
Hi Ramesh,
You should not validate the items in the PROCESS_HEADER method the reason being that this method is only for processing of PO Header. Method PROCESS_ITEM should be used for processing and checking of PO Items. Please refer to the corresponding methods documentation using the steps below.
1. Execute SE24 and input the Interface name IF_EX_ME_PROCESS_PO_CUST.
2. Place the cursor on the relevant method and follow the menu path Goto->Documentation->To component or simply press F9.
Hope this is clear to you.
If at all you want to still continue the same way as you were doing then the only option I can see to avoid the dump is to add the following code.
DATA:lmepoheader TYPE mepoheader.
data: ls_item type PURCHASE_ORDER_ITEMS.
data: wa_item LIKE LINE OF ls_item.
data: itm_data type mepoitem.
DATA: lv_reslo TYPE ekpo-reslo.
CALL METHOD im_header->get_data
RECEIVING
re_data = lmepoheader.
CALL METHOD im_header->get_items
receiving
re_items = ls_item.
loop at ls_item into wa_item.
CALL METHOD wa_item-item->get_data
receiving
re_data = itm_data.
lv_reslo = itm_data-reslo. "Issuing Storg
endloop.
Reward if useful.
Thanks and Regards,
Maddineni Bharath.