on ‎2005 Dec 19 4:09 PM
Hi to all,
i have a question using BAdI ME_PROCESS_PO_CUST.
I wan't to check field MEPOITEM-WEPOS in Purchase Order items according to type of PO MEPOHEADER-BSART.
Example:
IF MEPOHEADER-BSART = 'NB'
AND
MEPOITEM-WEPOS is INITIAL.
MESSAGE xxx
ENDIF.
I found out how to use method GET_DATA
ls_mepoitem = im_item->get_data( ).
to check status of field WEPOS and create a message,
but i did not get it how to use method
GET_HEADER
.Can someone post an example, how to get header data inside method PROCESS_ITEM ???
thanx for any help
regards
Jörg
(BAdI newbie)
Request clarification before answering.
Pls try this to get the header data(bsart)...
data : ls_hdr type ref to IF_PURCHASE_ORDER_MM.
data : l_hdrdata type MEPOHEADER.
ls_hdr = im_item->get_header().
l_hdrdata = ls_hdr->get_data().
if l_hdrdata-BSART = 'NB'.
endif.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi together,
thanx for the quick answers, which all where helpfull !
I prefered solution of <b>Renjith Andrews</b>, because it was the final hint i was searching for,
but also solution of <b>Sam</b> was quite the same with a helpful hint for my next steps to do.
Solution of <b>Phani Kiran</b> looks also as if works, but i was too lazy to create my own fields/table
For all of you (newbies) searching for solutions i attached my source code:
METHOD if_ex_me_process_po_cust~process_item .
DATA: ls_mepoitem TYPE mepoitem.
DATA: ls_mepoheader TYPE mepoheader.
<b> DATA: header_obj TYPE REF TO if_purchase_order_mm.</b>
INCLUDE mm_messages_mac.
<b>* get header data
header_obj = im_item->get_header( ).
ls_mepoheader = header_obj->get_data( ).</b>
* get item data
ls_mepoitem = im_item->get_data( ).
IF ls_mepoheader-ekorg = '1000' .
CASE ls_mepoheader-bsart.
WHEN 'NB'.
IF ls_mepoitem-wepos IS INITIAL.
mmpur_metafield mmmfd_gr_ind .
mmpur_message_forced 'W' 'ME' '303' text-001 '' '' ''.
ENDIF.
WHEN 'IB'.
IF NOT ls_mepoitem-wepos IS INITIAL.
mmpur_metafield mmmfd_gr_ind .
mmpur_message_forced 'W' 'ME' '303' text-002 '' '' ''.
ENDIF.
ENDCASE.
ENDIF.
ENDMETHOD. "IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If you want to do this each timw poitem is entered then you have to implement your method in <b>PROCESS_ITEM</b>
DATA: header_obj TYPE REF TO if_purchase_order_mm,
header TYPE mepoheader,
item TYPE mepoitem.
<b>header_obj = im_item->get_header().
header = header_obj->get_data().
item = im_item->get_data().</b>
IF header-bsart = 'NB' AND item-wepos IS INITIAL.
MESSAGE xxx.
ENDIF.If you want to do a check after all items have been added then you have to implement your method in <b>CHECK</b>
DATA: header TYPE mepoheader,
items TYPE purchase_order_items,
line_item TYPE purchase_order_item,
po_item TYPE mepoitem.
<b>header = im_header->get_data().
items = im_header->get_items().
LOOP AT items INTO line_item.
po_item = line_item-item->getdata().
IF header-bsart = 'NB' AND po_item-wepos IS INITIAL.
MESSAGE xxx.
ENDIF.
ENDLOOP</b>.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
In the method PROCESS_HEADER,export the header data fields & import them in the PROCESS_ITEM.
Below is the sample code:
In the PROCESS_HEADER write:
METHOD IF_EX_ME_PROCESS_PO_CUST~PROCESS_HEADER .
DATA : LS_MEPOHEADER TYPE MEPOHEADER.
DATA : ZZBSART type EKKO-BSART.
read header data
LS_MEPOHEADER = IM_HEADER->GET_DATA( ).
ZZBSART = LS_MEPOHEADER-BSART.
Export the supplying plant to Item method
EXPORT ZZBSART FROM ZZBSART TO MEMORY ID 'ZPDT2'.
ENDMETHOD.
In the PROCES_ITEM Write this code.
METHOD IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM .
DATA : LS_MEPOITEM TYPE MEPOITEM.
DATA : ZZBSART TYPE EKKO-BSART,
IMPORT ZZBSART TO ZZBSART FROM MEMORY ID 'ZPDT2'.
You can write your code here like ....
IF ZZBSART = 'NB'
AND
LS_MEPOITEM-WEPOS is INITIAL.
MESSAGE xxx
ENDIF.
.................
........
ENDMETHOD.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.