2008 Mar 22 5:04 PM
Hi friends
first time i am using BADIs
i want pass po item material number as ' 100-100' thorugh BADI, tcode ME21n and i tried as given below but getting infinite loop.
METHOD if_ex_me_process_po_cust~process_item.
DATA:ls_poheader TYPE mepoheader,
lm_poheader TYPE REF TO if_purchase_order_mm,
wa_item TYPE mepoitem,
lm_poheader = im_item->get_header( ).
ls_poheader = lm_poheader->get_data( ).
CALL METHOD im_item->get_data
RECEIVING
re_data = wa_item.
IF ls_poheader-bsart = 'UB' .
wa_item.matnr = '100-100'.
CALL METHOD im_item->set_data
EXPORTING
im_data = WA_ITEM.
endif.
please help me why my code is going to infinite loop.
Thanks
Ramesh
2008 Mar 24 9:27 AM
Hi,
I am not able to figure out why its getting into infinite loop.
Try changing your code
wa_item.matnr = '100-100' to
wa_item-matnr = '100-100' .
Try the below code.
DATA:ls_poheader TYPE mepoheader,
lm_poheader TYPE REF TO if_purchase_order_mm,
wa_item TYPE mepoitem.
lm_poheader = im_item->get_header( ).
ls_poheader = lm_poheader->get_data( ).
wa_item = im_item->get_data( ).
IF ls_poheader-bsart = 'UB' .
wa_item-matnr = '100-100'.
CALL METHOD im_item->set_data
EXPORTING
im_data = WA_ITEM.
endif.
Hope this works. Reward points if helpful.
Thanks,
Balaji
2008 Mar 22 9:03 PM
Hi,
I dont see any reason from the code why it should loop.
It is possibly caused by format of MATNR field - internal versus external - as material number uses conversion exit (MATN1 I think).
instead of
wa_item.matnr = '100-100'.try a call to function 'CONVERSION_EXIT_MATN1_INPUT' (check this is correct one by looking at the data element / domain for MATNR).
Andrew
2008 Mar 23 1:47 AM
Hi Andrew,
thanks for your reply, i tried to use Conversion exit, still the code is going to infinite loop.
please help.
Thanks
Ramesh
2008 Mar 24 9:27 AM
Hi
write like this and try
wa_item-matnr = '100-100'.
regards
Shiva
2008 Mar 24 9:27 AM
Hi,
I am not able to figure out why its getting into infinite loop.
Try changing your code
wa_item.matnr = '100-100' to
wa_item-matnr = '100-100' .
Try the below code.
DATA:ls_poheader TYPE mepoheader,
lm_poheader TYPE REF TO if_purchase_order_mm,
wa_item TYPE mepoitem.
lm_poheader = im_item->get_header( ).
ls_poheader = lm_poheader->get_data( ).
wa_item = im_item->get_data( ).
IF ls_poheader-bsart = 'UB' .
wa_item-matnr = '100-100'.
CALL METHOD im_item->set_data
EXPORTING
im_data = WA_ITEM.
endif.
Hope this works. Reward points if helpful.
Thanks,
Balaji
2008 Mar 25 10:17 PM
Hello Ramesh
Using the following implementation of BAdI ME_PROCESS_PO_CUST I have been able to change the material number in the item detail section of the purchase order. However, in the table control showing the item overview the material number is not exchanged.
METHOD if_ex_me_process_po_cust~process_item.
* define local data
DATA:
lo_item TYPE REF TO cl_po_item_handle_mm,
ls_item TYPE mepoitem,
ls_itemx TYPE mepoitemx,
ls_header TYPE mepoheader.
INCLUDE mm_messages_mac. "useful macros for message handling
ls_header = me->mo_header->get_data( ).
ls_item = im_item->get_data( ).
CHECK ( ls_header-bsart = 'NB' ).
CHECK ( ls_item-matnr NE '80-110C' ).
ls_item-matnr = '80-110C'. " another type of bulbs
" Casting to implementing class CL_PO_ITEM_HANDLE_MM
" Why? Method SET_DATAX is not accessible via interface.
lo_item ?= im_item.
CALL METHOD lo_item->set_data
EXPORTING
im_data = ls_item.
clear: ls_itemx. " update structure
ls_itemx-ebelp_key = ls_item-ebelp.
ls_itemx-matnr = 'X'. " update material number
CALL METHOD lo_item->set_datax
EXPORTING
im_data = ls_itemx.
ENDMETHOD.
Regards
Uwe
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |