2014 Oct 15 6:31 AM
Hi to all.
I use an implementation of badi ME_PROCESS_PO_CUST to find changes of subcontracting purchase orders.
In that i use the mathod as IF_EX_ME_PROCESS_PO_CUST~POST.
Here i use the importing parameter im_ebeln for finding the purchase order number.
And i want purchase order item also.
For that i find the sorted internal table as
{O:294*\CLASS=CL_PO_HEADER_HANDLE_MM}-MY_BADI_QUEUE from me_header object.
But my problem is how to access that internal table data.
Please guide me.
Thanks in advance.
Message was edited by: Matthew Billingham - Question text was ALL CAPITALS.
2014 Oct 15 7:45 AM
You cannot access that internal table because it is a private attribute.
But you can get the purchase order items by calling the GET_ITEMS method. There are lots of variations but it should look something like this:
DATA: lo_po_handler TYPE REF TO cl_po_header_handle_mm,
lt_poitem_obj TYPE purchase_order_items.
lo_po_handler ?= im_header.
CALL METHOD lo_po_handler->if_purchase_order_mm~get_items
RECEIVING
re_items = lt_poitem_obj.
Hope that helps.
2014 Oct 15 7:45 AM
You cannot access that internal table because it is a private attribute.
But you can get the purchase order items by calling the GET_ITEMS method. There are lots of variations but it should look something like this:
DATA: lo_po_handler TYPE REF TO cl_po_header_handle_mm,
lt_poitem_obj TYPE purchase_order_items.
lo_po_handler ?= im_header.
CALL METHOD lo_po_handler->if_purchase_order_mm~get_items
RECEIVING
re_items = lt_poitem_obj.
Hope that helps.
2014 Oct 15 11:30 AM
Thanks for fast reply.
Its working but i have one doubt by using of method lo_po_handler->if_purchase_order_mm~get_items i can find one standard table.
In that table i have one item field but it is showing {O:656*\CLASS=CL_PO_ITEM_HANDLE_MM}.
Plz guide me from this object how can i found item number.plz guide me.
Thanks in advance.
2014 Oct 15 12:06 PM
To get to the item number, you need to loop at the table returned by the GET_ITEMS method, and call another method, GET_DATA.
Something like this:
DATA: ls_poitem_obj TYPE purchase_order_item,
lo_po_item_handler TYPE REF TO cl_po_item_handle_mm,
ls_poitem TYPE mepoitem.
LOOP AT lt_poitem_obj INTO ls_poitem_obj.
lcl_po_item_handler ?= lw_poitem_obj-item.
CALL METHOD lcl_po_item_handler->if_purchase_order_item_mm~get_data
RECEIVING
re_data = ls_poitem.
ENDLOOP.
Structure LS_POITEM should contain the item number, field EBELP.
2014 Oct 15 12:48 PM
2014 Oct 15 1:58 PM
Thanks for reply me.
Hi actually i have another doubt in implementation of badi ME_PROCESS_PO_CUST.
Actually i want to get active means current line item I mean in which line item the changes are going on.For that i found one internal table as {O:294*\CLASS=CL_PO_HEADER_HANDLE_MM}-MY_BADI_QUEUE.
And in that table i want the field as {O:294*\CLASS=CL_PO_HEADER_HANDLE_MM}-MY_BADI_QUEUE[2]-VARKEY.
Please guide me how can i access that table for finding of active line item .
please guide me.
Thanks in advance.
2014 Oct 15 2:18 PM
Use the objects provided in the BAdI, that could look like :
INCLUDE mm_messages_mac.
DATA: lt_items TYPE purchase_order_items,
lo_item TYPE purchase_order_item,
lt_accountings TYPE purchase_order_accountings,
lo_accountings TYPE purchase_order_accounting.
" etc.
DATA: new_header TYPE mepoheader,
old_header TYPE mepoheader,
new_item TYPE mepoitem,
old_item TYPE mepoitem,
new_accounting TYPE mepoaccounting.
" etc.
*------------------------------------------------------------------
CHECK me->trtyp NE 'A'.
mmpur_context mmcnt_context_badi.
*------------------------------------------------------------------
* Header
new_header = im_header->get_data( ).
old_header = im_header->get_persistent_data( ).
*------------------------------------------------------------------
* Items
lt_items = im_header->get_items( ).
LOOP AT lt_items INTO lo_item.
new_item = lo_item-item->get_data( ).
old_item = lo_item-item->get_persistent_data( ).
" accounting
lt_accountings = lo_item-item->get_accountings( ).
LOOP AT lt_accountings INTO lo_accountings.
" etc.Then compare old and new values item per item, also available for accounting GET_ACCOUNTINGS, delivery schedule GET_SCHEDULES and conditions GET_CONDITIONS.
Regards,
Raymond
2014 Oct 16 6:16 AM
Hi,Thanks for reply.
But its not working i mean when i use this code it will show the following error.
"get_persistent_data( ) does not having the returning parameter".
Please guide me how can i found active line item.
I mean current line item.
Please guide me.
Thanks in advance.