01-11-2008 6:21 AM
Dear All,
i want to use user badi for transaction ME51N as i want to put a check for cost centre with plant such that if it does not belong to a particular plant it should throw an error message
now the thing is that i m new to badi can anyone plz guide me in which parameter of which BADI would i get costcentre and plant together so that i can insert a check i hav found one
ME_PROCESS_REQ_CUST but i dont know how to use it and whether i would get my required parameters
thanks to all
Ronak
01-11-2008 6:24 AM
i can help u out in getting the values to the fields mentioned irrespective of document type which u can do i think and i'm here with the piece of code as follows :
Go to se19 to implement badi and give the name say zxyz and give the definition name as me_process_req_cust and implement the method called process_item
and write the following code.
data : wa_item type mereq-item,
v_ekgrp type marc-ekgrp,
v_preis type mbew-verpr.
select single ekgrp
from marc
into (v_ekgrp)
where werks = '1000' and matnr = '100-100'.
select single verpr
from mbew
into (v_preis)
where matnr = '100-100'
and bwkey = '000'.
call method im_item->get_data
receiving
re_data = wa_item.
wa_item-ekgrp = v_ekgrp.
wa_item-preis = v_preis.
wa_item-waers = 'INR'.
if im_count = 1.
call method im_item->set_data
exporting
im_data = wa_item.
endif.
hope this code will help in passing the data to the tcode me51n and if any issues let me know.
reward point if helpful
01-11-2008 6:25 AM
Hi ,
1.Go the transaction SE80.
2.Give the package name for tcode me51n.
3.It will display all BADI used for this tcode.
Regards
pardeep
Edited by: pardeep kumar on Jan 11, 2008 11:55 AM
Edited by: pardeep kumar on Jan 11, 2008 11:56 AM
01-11-2008 6:26 AM
Hi Ronak
You have to drill down as below:
ME_PROCESS_REQ_CUST->PROCESS_ITEM->Get Accountings->Get_Data
Strucutre is MEPOACCOUNTING.
Fields KOSTL.
Kind Regards
Eswar
01-11-2008 6:36 AM
Dear Sravan Pradeep and Eswar,
thanks a lot for sharing ur knowledge i would try to go about as u all have said and would let u all know if i m stuck
anyways thanks once again keep sharing knowledge.
cheers Ronak