2007 Jul 17 10:22 AM
Hi all,
I'm using method POST of Badi ME_PROCESS_PO_CUST. I'm trying to change some data at item level (numeration of the items). For that i'm using get data and set data methods. The problem is my PO item info doesn't get updated from my bady implementation. Here's a sample of my code:
lt_items = im_header->get_items( ).
loop at lt_items INTO l_one.
call method l_one-item->get_data
receiving
re_data = l_data.
l_data-ebelp = aux_ebelp.
call method l_one-item->set_data
exporting
im_data = l_data.
aux_ebelp = aux_ebelp + 10.
endloop.
Regards,
Pedro
2007 Jul 17 10:45 AM
Hi
Generally we don't change the Values of Item Numbers (they are key fields in Item Tables) in any application documnet
If you see the application doc creation (any doc like PO or sales order, or PR etc)
we don't enter the Item number, the system by defaults defaults this field
So I feel using the BADI you can't change this particular field.
Try to change someother field in PO and see
they may change.
But I doubt this EBELP (item Number field you can't update)
and one more thing is that this is a key field in EKPO..So you can't change/update it.
<b>Reward points for useful Answers</b>
Regards
Anji
2007 Jul 17 11:03 AM
Hi Anji,
I had thought of that possibility, that might block any change to item numbers, but then i tried (still in method post) to change other item info (i changed the quantity of the item order - MENGE) still it did not get changed. That's why i was wondering i had somthing wrong with my code...
2007 Jul 17 11:29 AM
Hi
See the sample code for this BADI
Use the POST method for changing some data and see
BAdI Name: ZCHECK_PO_LINE_ITEM (Implementation name) PO Account assignment
Definition Name: ME_PROCESS_PO_CUST
Interface Name : IF_EX_ME_PROCESS_PO_CUST
Implementing Class: ZCL_IM_BADIN_ACCOUNT_ASSGN
Method : PROCESS_HEADER
************************************************************************
METHOD if_ex_me_process_po_cust~process_header .
DATA : re_data TYPE mepoheader.
*get the item data
CALL METHOD im_header->get_data
RECEIVING
re_data = re_data.
re_header = re_data.
IF ( re_data-bsart NE 'ZOC' AND re_data-bsart NE 'ZPC' ).
IF ( re_data-bsart <> 'ZIC' AND re_data-bsart <> 'UB' ).
IF re_data-bukrs NE '1001'.
MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'Use only Sipchem Company'
'Code for External Procurement'.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
************************************************************************
Method : PROCESS_ITEM
************************************************************************
METHOD if_ex_me_process_po_cust~process_item .
DATA: v_menge TYPE bamng, " PR Quantity
v_statu. " PR Status
DATA : re_data TYPE mepoitem,
re_data1 TYPE mepoaccounting,
re_accountings TYPE purchase_order_accountings ,
header TYPE purchase_order_accounting.
*get the item data
CALL METHOD im_item->get_data
RECEIVING
re_data = re_data.
IF ( re_header-bsart NE 'ZOC' AND re_header-bsart NE 'ZPC' ).
IF re_header-bsart EQ 'ZRL'.
IF re_data-konnr EQ space.
MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'You cant create a Release order'
'without a reference to Outline Agreeement'.
ENDIF.
ENDIF.
IF ( re_data-banfn EQ space AND re_data-anfnr EQ space ).
MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'You can create a Purchase order'
'only with reference to a PR or RFQ'.
ENDIF.
IF re_data-knttp NE 'K' AND re_data-pstyp NE '9' .
IF syst-cprog EQ 'RM_MEPO_GUI'.
IF re_data-uebto IS NOT INITIAL OR
re_data-uebtk IS NOT INITIAL OR
re_data-untto IS NOT INITIAL.
MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH 'You cant change delivery settings'.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
ENDMETHOD.
<b>Reward points for useful Answers</b>
Regards
Anji
2007 Jul 17 10:53 AM
Hi,
Refer the below therds:
https://forums.sdn.sap.com/click.jspa?searchID=3904329&messageID=1012777
https://forums.sdn.sap.com/click.jspa?searchID=3904329&messageID=1562955
<b>Reward points</b>
Regards