‎2006 Feb 23 8:04 PM
Hi,
I am trying to create POs via BAPI_PO_CREATE1. There is a field EAN11(International Article Numer) in the PO Item level EKPO table which I want to populate while creating the PO. But this field is not covered in the BAPI in any of the structures. We can enter/edit this field while creating PO online i.e. via ME21N, but in the BAPI it seems that this is automatically picked up from material master and it cannot be edited via BAPI(this field is contained in a structure MEPOITEM_TECH whose description is 'Purchase Order Item (Non-Directly-Changeable Fields)' which implies that. Does anyone know if there is anyway I can populate this field while creating the PO from the incoming data? We are not using material master, so this can't be picked up from material master.
‎2006 Feb 23 9:33 PM
You can try to populate this field by implementing BADI ME_PROCESS_PO_CUST (in method PROCESS_ITEM).
You have there reference to PO item (IF_PURCHASE_ORDER_ITEM_MM) as an parameter. This interface has got method SET_DATA which takes structure MEPOITEM as an import param. There is field EAN11 in MEPOITEM
‎2006 Feb 23 9:45 PM
No, I have already tried this. That does not change values of EAN11. If you go inside the method set_data, you will see that this method does not update any of the fields of MEPOITEM_TECH(Purchase Order Item (Non-Directly-Changeable Fields)) and EAN11 is a field of that structure. In fact, the set_data is being used in the BAPI_PO_CREATE1 itself and that is the reason I could not anyway populate EAN11 in the BAPI also.
‎2006 Feb 24 12:18 AM
Hi Sandip,
I tried implementing the BADI ME_PROCESS_PO_CUST, for the method PROCESS_ITEM, it worked.
you need to call:
DATA:LS_MEPOITEM TYPE MEPOITEM,
L_ITEM TYPE REF TO CL_PO_ITEM_HANDLE_MM,
L_IF_ITEM TYPE REF TO IF_PURCHASE_ORDER_ITEM_MM.
Call Method to get the Item Data
MMPUR_DYNAMIC_CAST L_ITEM IM_ITEM.
CHECK NOT L_ITEM IS INITIAL.
CALL METHOD L_ITEM->GET_DATA
IMPORTING
EX_DATA = LS_MEPOITEM.
Now manipulate the structure LS_MEPOITEM to populate the field EAN11, and then call the below method.
CALL METHOD L_IF_ITEM->SET_DATA( LS_MEPOITEM ).
Rajeev
‎2006 Feb 24 8:17 PM
No this is exactly what I tried before. as i have said,it doesnot update any field in mepoitem_tech.Could you actually update EAN11 this way?
‎2009 Feb 10 12:46 AM
Hi Sandip,
Though this is a very old message, could you please help us. We want to know how did you fixed up the EAN11 issue.
thanks
Ram
‎2008 Dec 17 2:08 AM
Hi Sandeep,
SAP recommends that you should not attempt to change any field which is contained in MEPOITEM_TECH structure (see note 803749). So you should avoid that.
However if you have no choice and you want to change this field, may be the following code helps:
Use badi ME_PROCESS_PO_CUST Method -- PROCESS_ITEM
*declare an object of class cl_po_item_handle_mm
DATA: lr_item TYPE REF TO cl_po_item_handle_mm.
*assign the parameter IM_ITEM of BADI IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM to this *variable
lr_item ?= im_item.
lt_items = im_item->get_data( ).
-
*modify field content in structure lt_items i.e populate the required field in it_items
and then
lr_item->set_data( lt_items ).
This code should do the trick, because now we use method SET_DATA(which has no validation) of class CL_PO_ITEM_HANDLE_MM instead of method IF_PURCHASE_ORDER_ITEM_MM~SET_DATA.
However please check for any other data changes after implementing this solution.
Kind Regards
Ravi
‎2009 Oct 08 4:16 PM
Ravi, I know this is a very old message but I am trying to implement the process_item BADI and update a field included in structure MEPOITEM_TECH. I tried using the method/logic you proposed but the ekpo data is still not saved as expected. Can you suggest anything to add to this logic so that the table data is updated successfully?
Thanks for any help with this!
‎2011 Oct 13 8:44 PM
Hello Mery Lins,
Did you get any success , to update EKPO field , which belongs to MEPOITEM_TECH structure?
I am also facing same issue , when updating MFRPN field.
Please suggest, if any way.
Thanks,
Nilesh
‎2012 Jan 24 8:54 AM
I had the solution for this, see code below. Unfortunately is doesn't work anymore since we're on support stack 10. For those not yet on this level this code may be useful:
data: lo_item TYPE REF TO cl_po_item_handle_mm.
...
...
" 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 = lw_data.
" update structure - ean11 niet aanwezig,
" gebruik idnlf, werkt ook
lw_datax-ebelp_key = lw_data-ebelp.
lw_datax-ebeln = 'X'.
lw_datax-ebelp = 'X'.
lw_datax-idnlf = 'X'.
CALL METHOD lo_item->set_datax
EXPORTING
im_data = lw_datax.
Kind regards,
Erik Mertens
‎2013 Dec 16 7:22 AM