2010 Mar 04 12:30 PM
Hi,
I have to update the vendor material field through BADI ME_PROCESS_PO_CUST.
I have created an implementation for this BADI.Can anyone help me find the solution for the same.
Thanks.
2010 Mar 04 12:35 PM
Hi,
Check example class for this badi CL_EXM_IM_ME_PROCESS_PO_CUST.
You need to use method SET_DATA to modify values.
Regards,
Ashok.
2010 Mar 04 3:28 PM
Hi Ashok,
Thanks for the prompt reply.I will currently check the Sample code in SE18 and then change the code as per the requirement.
Thanks.
2010 Mar 04 12:49 PM
Hi,
You see the sample coding in SE18 transaction then GO TO -> SAMPLE CODE -> DISPLAY.
This will help you how to implement the BADi.
Regards,
Shanmugavel chandrasekaran.
2010 Mar 04 3:33 PM
Hi Shanmugavel,
Thanks for the suggestion.I am checking the code for the requirement.
2010 Mar 04 1:54 PM
Hi,
Implemeent the method PROCESS_ITEM ....
DATA : lt_item TYPE MEREQ_ITEM.
CALL METHOD im_item->GET_DATA
RECEIVING
RE_DATA = lt_item .
lt_item will contain the data ....
now update the value ....by......lt_item-IDNLF = < >
now set the data by
CALL METHOD im_item->GET_DATA
EXPORTING
RE_DATA = lt_item .
Thanks,
Shailaja Ainala.
2010 Mar 04 3:40 PM
Hi Shailaja,
Thanks for the reply.I saw ur previous reply in some earlier post too.I am currently looking at the sample code in se18.
Please advice,I have a few set of checks from EKKO EKKN AND A Z TABLE,after the checks i Need to fetch data from VBAP.Can I do the calculation before the final Call Method.
Also if i set the break point in the code.and run me23n will I be able to check the values.?
Thanks a lot for the prompt reply.
2010 Mar 05 4:21 AM
2010 Mar 05 4:32 AM
the following error gets displayed when i am cheking the code:
"Exception CX_SY_NO_HANDLER triggered"
"An exception with the type CX_SY_REF_IS_INITIAL occurred, but was neither handled".
please advice.
2010 Mar 05 4:34 AM
Hi,
When you are facing this problem .....did you implement the badi correctly.....
Thanks,
Shailaja Ainala.
2010 Mar 05 4:49 AM
yes.
Implementation created in SE18 for BADI ME_PROCESS_PO_CUST.
2010 Mar 05 4:52 AM
DATA: wa_ekko TYPE ekko,
wa_ekkn TYPE ekkn,
wa_ekpo TYPE ekpo,
wa_vbap TYPE vbap.
DATA : lt_item TYPE mepoitem.
IF im_item->is_persistent( ) EQ mmpur_no. "Only check for new items
* Retrieve item data into BADI buffer
*get data
CALL METHOD im_item->get_data
RECEIVING
re_data = lt_item.
ENDIF.
SELECT SINGLE * FROM ekko
INTO wa_ekko
WHERE reswk NE ''.
IF sy-subrc EQ 0.
SELECT SINGLE * FROM ekkn
INTO wa_ekkn
WHERE ebeln = wa_ekko-ebeln.
IF wa_ekkn-vbeln <> ''.
SELECT SINGLE * FROM ekpo
INTO wa_ekpo
WHERE ebeln = wa_ekko-ebeln
AND idnlf = ''.
IF sy-subrc EQ 0.
SELECT SINGLE * FROM vbap
INTO wa_vbap
WHERE vbeln = wa_ekkn-vbeln
AND posnr = wa_ekkn-ebelp.
IF sy-subrc EQ 0.
lt_item-idnlf = wa_vbap-kdmat.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
* Update changes
CALL METHOD im_item->set_data
EXPORTING
im_data = lt_item.
2010 Mar 05 5:51 AM
when i am cheking the code the following error gets displayed in the implementation of BADI: ME_PROCESS_PO_CUST :
"Exception CX_SY_NO_HANDLER triggered"
"An exception with the type CX_SY_REF_IS_INITIAL occurred, but was neither handled".
please advice.
any suggestions ...
thanks.
2010 Mar 05 7:33 AM
Hi ,
I used your coding it is working fine , only thing is you need to use SET_DATA within IF...ENDIF..
Regards,
Ashok.
2010 Mar 05 7:48 AM
Hi,
I think some problem in implementation of the badi ....do the process again from start
Thanks,
Shailaja Ainala.
2010 Mar 05 9:02 AM
HI,
Thanks for your quick replies.
I have changed the code location of call method set data.
I have one more doubt,I need to call this piece of code at the time of PO creation.Should i mention that the tcode = ME21n?
Also if I am fetching the data from EKKO,then what fields will i compare in the where clause?
Thanks.
2010 Mar 05 9:27 AM
Hi,
You can use in create mode also .....check for tcode .....get the header data using...
get header data as below..
data : lo_reF_header type ref to IF_PURCHASE_ORDER_MM,
lt_header type MEPOHEADER.
CALL METHOD im_item->GET_HEADER
RECEIVING
RE_HEADER = lo_reF_header.
CALL METHOD lo_reF_header->GET_DATA
RECEIVING
RE_DATA = lt_header.
Thanks,
Shailaja Ainala.
2010 Mar 05 11:22 AM
In the trx SE24 enter the class name for the badi implementation and edit method process_item:
data:
it_mepo type mepoitem,
mepo_mm type ref to if_purchase_order_item_mm,
mepo_item type mepoitem,
"- Get the data from the purchase item
call method im_item->get_data
receiving re_data = it_mepo.
"- Check the structure mepoitem and change the field that you need. For example idnlf
it_mepo-idnlf = 'SomeData'
"- Update de object
call method im_item->set_data
exporting im_data = it_mepo.
NOTE: The IM_ITEM object its a parameter. Automatically apears once the method is invoked.
Edited by: MARCOS CARRASCO on Mar 5, 2010 6:53 AM
2010 Mar 09 3:27 AM