BADI ME_PROCESS_PO_CUST Method Post
Hi, how can we know in the method post of the BADI ME_PROCESS_PO_CUST if we are in creation mode (me21n) or change mode (me22n), I need to do some coding only at the creation of the PO but this method is call anytime we click save!
thanks!
Hello Alexandre
It would be possible to check the transaction. However, if the BAPI BAPI_PO_CREATE is used the BAdI is also processed yet the transaction is most likely wrong.
An <u>unambigous </u>approach is to check IMPORTING parameter IM_TRTYP in method IF_EX_ME_PROCESS_PO_CUST~OPEN:
METHOD if_ex_me_process_po_cust~open.
* define local data
DATA:
lo_po TYPE REF TO cl_po_header_handle_mm,
ls_header TYPE mepoheader.
me->md_trtyp = im_trtyp. " save transaction type
IF ( im_trtyp = 'H' ). " add new purchase order
I would add an instance attribute MD_TRTYP to the BAdI implementing class and save the transaction type in method IF_EX_ME_PROCESS_PO_CUST~OPEN (see above).
Now you can simply add the following IF condition to your POST method:
METHOD if_ex_me_process_po_cust~open.
CASE me->md_trtyp.
WHEN 'H'. " add new purchase order
... " do required action for CREATE
WHEN ... .
WHEN others.
ENDCASE.
The possible transaction types can be found at: im_trtyp -> data element -> <b>domain </b>(fixed values).
Regards
Uwe
Similar Messages
-
ME_PROCESS_PO_CUST: Method "POST"
Hi all,
I'm trying to update the 'EKPO', and I will use the BADI 'ME_PROCESS_PO_CUST'.
When you click the 'SAVE' of purchase order, I want to update the 'EKPO-LGORT'. and I will try to use method 'POST'.But the method 'POST' has only 'IM_HEADER'.
Now I don't know how to upate the EKPO-LGORT using method 'IM_HEADER' in 'POST'.
Can someone help me!!
By SomaHai Tomoyuki,
The PROCESS_ITEM method has only IMPORTING parameter, meaning that you cannot change the values in the IM_ITEM parameter.
Use ls_mepoitem = im_item->get_data( ).
and chage your item date. Please read the documentation you can change only some set of data at item level.
Then use im_item->set_data( ).
Also You can refer these links...
ME_PROCESS_PO_CUST: Method "POST"
Implementing BADI's ME_PROCESS_PO_CUST
BADI ME_PROCESS_PO_CUST - FIELDSELECTION_ITEM
Regards,
Srikanth. -
Hi,
in method: IF_EX_ME_PROCESS_PO_CUST~PROCESS_SCHEDULE of Badi ME_PROCESS_PO_CUST
i will get schedule-data and item data.
I try this:
METHOD IF_EX_ME_PROCESS_PO_CUST~PROCESS_SCHEDULE.
DATA: LS_ITEM TYPE MEPOITEM.
LS_ITEM = IM_ITEM->GET_ITEM( ).
DATA: LS_SCHEDULE TYPE MEPOSCHEDULE.
LS_SCHEDULE = IM_SCHEDULE->GET_DATA( ).
BREAK-POINT.
ENDMETHOD.
LS-SCHEDULE are filled correct.
in Line LS_ITEM = IM_ITEM->GET_ITEM( ). i get an syntax error -> IM_ITEM are unknown.
Has anyone an idea how i can get the ITEM Data?
Thanks.
Regards, DieterHi Vinod,
thanks, it solved my Problem.
I have another thread for ME_PROCESS_PO_CUST.
Question to Z_ME_PROCESS_PO_CUST with item catagory L
Do you have an idea for this problem?
Thanks.
Regards, Dieter -
BADI ME_PROCESS_PO_CUST Method:PROCESS_ITEM
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.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. -
How to Purchase Order number in badi ME_PROCESS_PO_CUST~INITIALIZE
Hi SDNers,
I have problem to get purchase order number in badi ME_PROCESS_PO_CUST method INITIALIZE, when purchase order release from ME28 tcode.Hi Suresh,
I just tried that ... it is working fine... You have to use CMOD to implement it by creating a project...
Please documentation on how to implement user exits...
Also Please understand this is a Workflow forum... please do not post ABAP queries here... You would get better answers if you post in ABAP forums...
Regards
Gautam -
BADI ME_PROCESS_PO_CUST get item nr
Hi experts,
I would like to get the item number EBELP in a purchase order ME21N, ME22N.
My problem is that when I change of item, I can't get the item n° in the BADI ME_PROCESS_PO_CUST
Thks for help,
AntYes , you can get that values.check this .
badi: ME_PROCESS_PO_CUST
method:PROCESS_ITEM
data:ls_mepoitem TYPE mepoitem,
ls_mepoitem_prev TYPE mepoitem,
ls_mepoitem = im_item->get_data( ).
CLEAR ls_mepoitem_prev-netpr.
SELECT SINGLE netpr FROM ekpo
INTO ls_mepoitem_prev-netpr
WHERE ebeln = ls_mepoitem-ebeln
AND ebelp = ls_mepoitem-ebelp.
if ls_mepoitem-netpr GT ls_mepoitem_prev-netpr.
MESSAGE 'Not Allowed to change values of Previous years WBS'
TYPE 'E'.
ENDIF. -
ME_PROCESS_PO_CUST - Need Help on Methods POST, PROCESS_HEADER
Hi,
I will explain the requirement and my approach and the problem i am facing.
During save of Purchase order, a confirm popup should be shown and according to the user confirmation, it will hit a Z Field in CI_EKKODB.
For this, i implemented the solution in BADI ME_PROCESS_PO_CUST and Method POST. Even though i use SET_DATA to set the data, it never updates the database table.
For testing purpose, i put the code in Method PROCESS_HEADER, the SET_DATA worked fine and it finally updated the database table. So, I thought of implementing the solution here by checking sy-ucomm and executing only during SAVE of PO. But here my problem is, Not always all the time this PROCESS_HEADER method executes. For example, If you change any header data and Press "Enter", then the "PROCESS_HEADER" is called. and then immediately without changing any data and you Press "SAVE", the Method PROCESS_HEADER will not be called.
Could you please anyone suggest me either how to forcefully call the PROCESS_HEADER method everytime or is there any other way to set the Z Data into the database table.
Thank you in advance.
KarthikI have the same issue. Do you know how you solved ths issue? if so can you please post the reply. Thanks
-
METHOD PROCESS_ACCOUNT OF BADI ME_PROCESS_PO_CUST.
HI,
I need to implement the method PROCESS_ACCOUNT of badi ME_PROCESS_PO_CUST.
can anyone suugest me the samolw code for the same.
i know i can get the account assignment data in the mathod IM_ACCOUNT->get_data.
But how to declare the variable to store the data of im_account->getdata.
so that i can use it in the progra?
i mean for ex for header we will declare
ls_header type mepoheader
and then
ls_header = im_header->get-data.
similarly can you plese tell me the declaration for storing the account assinment data.
which table that variable will refer to.
Smritihai smriti
u can call the method
data: it_data type MEPOACCOUNTING
im_accoutn->get_data importing re_data = it_data.
just click the method type of parameter IM_ACCOUNT which is IF_PURCHASE_ORDER_ACCOUNT_MM an interface
u will get all the methods fro the same u have ur mehtod get_data just click on it and click parameters and u get the paramter type which is MEPOACCOUNTING
regards
m.a
Edited by: mohammad afzal on Jul 9, 2009 7:11 AM -
Badi-- ME_PROCESS_PO_CUST, PROCESS_ACCOUNT method
Hi,
My requirement is that While Creating PO,if the first four characters of Cost Center and FundsCenter is not equal to Plant then an error message should be raised . For this i used
Badi>ME_PROCESS_PO_CUST and Method->PROCESS_ACCOUNT .
The problem is that in PROCESS_ACCOUNT method the parameter IM_ACCOUNT doesn't contain Plant value.
If I am using PROCESS_ITEM method,in this IM_ITEM is not capturing Fundscenter value.
Please help in solving the issue. Is there any User Exit or Badi which gives me Plant,CostCenter,FundsCenter Values.?
Thanks
K SrinivasHi,
You can use same Badi for getting Plant,CostCenter,FundsCenter. what are all values you are not getting for that you use field-symbols. like here for getting Plant value Try these steps.
1. Press F1 on PO Screen Plant value. Get Program name, screen field structure from that.
2. declare one variable as field as field-symbols, in badi.
FIELD-SYMBOLS: <lv_var> type any.
Assign '((SAPLMEGUI)MEPO1211-NAME1) to <lv_var>.
Here SAPLMEGUI is Program Name And MEPO1211-NAME1 is field structure of your program screen.
in <lv_var> you will get the value of plant.
Same process you can try for other fields also.
Regards
Vishnu Gupta -
Urgent Help Needed in BAdI ME_PROCESS_PO_CUST
Hello friends,
I m workin on BAdI ME_PROCESS_PO_CUST , my requirement is to store header level text in po if it is left blank by user , for this i have creadted standard text for every po header text , and implemeted method POST of the badi. so when user is saving the po , i m checking whether all header text is filled by user or not , for this i have called method GET_TEXT , if the text is blank i m reading data from standard text using READ_TEXT function module and setting in perticular text by using method SET_TEXT , every thing is working fine , the respective text ifrom standard text getting filled to the perticular text of the po , if left blank by the user . But the actual problem is that when i m going to display the same po again , the text that i was supplied by standard text is not showing in po.
is there is anything that i missed out , i also done coomit work , but its not working ,
so please suggest.......
dont worry abt pointsDear Mr Mahesh
I also face similar problem . But my limitation is that I am new to BADI . Sir it will be great help if you can please mail me the steps / procedure and code to be written for implementing the above BADI .
Sir , I look forward for your kind help please .
Regards
B V Mittal
[email protected] -
Rollback BAPI in BADI ME_PROCESS_PO_CUST
hi guys,
I used BADI ME_PROCESS_PO_CUST to implement a code before saving the purchase order (Method POST).
This code contains a BAPI to create a delivery BAPI_OUTB_DELIVERY_CREATENOREF. If this BAPI fails (this is when Return parameter contains 'E' message), I execute function BAPI_TRANSACTION_ROLLBACK.
Guess what is happening?
There is no purchase order created even when screen shows message "Standard PO created under the number 45#######".
What do I want to do?
- Rollback the bapi executed and let the system continue saving the purchase order.
- If possible show a message to the user that there is an error, but command MESSAGE doesn't seem to work in this BADI
Could you share your insights with this wannabe-abapper?
PD: it says in documentation that it is required ABAP OO to implement this BADI and I think I used it correctly for gathering all data I needed. But I just don't understand why MESSAGE statement and FM POPUP_TO_CONFIRM don't work.Hello
You may try an approach like this:
IF ( 1 = 1 ).
MESSAGE 'Creation of outbound delivery failed' type 'I'.
data: ld_dummy type string,
ls_msg type SMESG,
lt_msg type tsmesg.
message id '00' type 'E' number '398' with 'Creation of outbound delivery failed'
space space space into gl_dummy.
move-CORRESPONDING syst to ls_msg.
APPEND ls_msg to lt_msg.
CALL FUNCTION 'FB_MESSAGES_DISPLAY_POPUP'
EXPORTING
IT_SMESG = lt_msg
* ID_SMESG_ZEILE =
* IT_RETURN =
* ID_SEND_IF_ONE =
EXCEPTIONS
NO_MESSAGES = 1
POPUP_CANCELLED = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
endif.
Regards
Uwe -
PROCESS_HEADER not fired in BADI ME_PROCESS_PO_CUST
Dear experts,
I face the problem, that the method PROCESS_HEADER of BADI ME_PROCESS_PO_CUST is not fired, when I am changing po header text. My requirement is to set a customer po header field, whenever a po header text is existent.
Does anybody know, if this is the standard behaviour and how I can work around it?
ThanxsHi Aparna,
actually I tried this, too.
In the methods Check and Post (which both are fired normally) I coded my requirements, but in this methods I faced the problem that I was not able to save my programatic header field changes. (Even with the trick to cast the IM_HEADER to CL_PO_HEADER_HANDLE_MM to allow changes of internal attributes, used in method set_data(), any changes of po header fields were not saved.) But maybe I am wrong with my implementation? You may have a look:
DATA: lv_val_id TYPE thead-tdid.
DATA: lv_val_name TYPE thead-tdname.
DATA: lv_val_object TYPE thead-tdobject.
DATA: p_mepo_header TYPE MEPOHEADER.
DATA: it_tline TYPE TABLE OF TLINE.
DATA: lv_cl_po_header_handle_mm TYPE REF TO CL_PO_HEADER_HANDLE_MM.
check existents of po header text
lv_val_id = 'F09'.
p_mepo_header = im_header->get_Data( ).
lv_val_name = p_mepo_header-ebeln.
lv_val_object = 'EKKO'.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client = sy-mandt
id = lv_val_id
language = sy-langu
name = lv_val_name
object = lv_val_object
TABLES
lines = it_tline
EXCEPTIONS
ID = 1
LANGUAGE = 2
NAME = 3
NOT_FOUND = 4
OBJECT = 5
REFERENCE_CHECK = 6
WRONG_ACCESS_TO_ARCHIVE = 7.
any text there, then update customer po header field
IF sy-subrc = 0.
p_mepo_header-zzfield = 'X'.
else.
p_mepo_header-zzfield = ' '.
endif.
QD
lv_cl_po_header_handle_mm ?= im_header.
lv_cl_po_header_handle_mm->my_cust_firewall_on = 'X'.
im_header->set_Data( p_mepo_header ).
im_header->set_changed( ).
po is still same as before and field zzfield was not updated. -
How to issue warning message in BADI ME_PROCESS_PO_CUST
Hi Guys,
I have already checked the forum regarding this. There are lots of threads. Unfortunately none of them helped me. I must be missing some thing in my code.
I tried issuing warning message in BADI ME_PROCESS_PO_CUST and method PROCESS_ITEM.
First i tried with normal message statement
MESSAGE w001(00) WITH text-001 text-002.
Didn't worked.
Next tried calling standard macros
DATA:mmmfd_cust_01 TYPE mmpur_metafield VALUE 90000000.
call method cl_contextfield_mm=>set_current_field
exporting im_field = mmmfd_cust_01.
mmpur_metafield mmmfd_cust_01.
mmpur_message_config 'W' 'X' ' '. "Tried all permutations here
mmpur_message_forced 'W' '00' '001' text-001 text-002 '' ''.
Still no solution
Tried with macro mmpur_message also
Can some one helpme out to solve this issue.
Thanks,
Vinod.Hi all,
Thanks for the responce.
Not sure whether you have looked into BADI documentation or not. Please check below.
"Further notes
The above-mentioned macros are defined in the program MM_MESSAGES_MAC. Please include this program in your own application.
Never issue messages in BAdI ME_GUI_PO_CUST! This is the task of the business logic and must therefore be done via the BAdI ME_PROCESS_PO_CUST.
"Never use the ABAP statement MESSAGE in the BAdI ME_PROCESS_PO_CUST. Please use the macro mmpur_message_forced only. This macro only writes a message in the message collector.
If you wish to mark the business object as invalid in order to prevent posting, you must additionally use the INVALIDATE ( ) method of the relevant interface. In this connection, see also the code example in the PROCESS_ITEM method of the BAdI ME_PROCESS_PO_CUST.
I have tried almost all macros including mmpur_message_forced 'E' 'ME' '083' l_text ' ' ' ' ' '.
Not sure where i am missing:(
If i give error using MESSAGE statement it is working perfectly i.e. give error and save the PO. Only wanted to know if there are any implications.
Thanks,
Vinod -
BADI : ME_PROCESS_PO_CUST Probelm
I am using BADI
ME_PROCESS_PO_CUST
and want to throw error if any Z condition is not maintained , it is throwing error but also it is then existing from the transaction , showing error message , System Error ( Error in Method PO_POST )
Can we send error message thru method POST of this BADI
How to rectify this problem
Ankesh Jindal
Edited by: Ankesh Jindal on Dec 11, 2008 8:00 AMDisplay the samples provided by SAP for this BADI and manage the error messages as prescribed by SAP. (SE18 / GOTO / Sample Code / Display)
(There are already some threads at sdn on [message management in BADI : ME_PROCESS_PO_CUS|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=me_process_po_cust+message&adv=true&sdn_author_name=&sortby=cm_rnd_rankvalue])
Regards -
Custom tab data not saving in ME22N w/ BAdI ME_PROCESS_PO_CUST
Hello all,
I have implemented BAdis ME_PROCESS_PO_CUST & ME_GUI_PO_CUST and created a custom tab at the header level in ME21N/ME22N. I have fields such as Delivery Date and Ex Factory Date in my tab.
We are able to put data in these fields and have that data populate their respective fields in the Purchase Order.
Our users would like to be able to run ME22N and select certain line items and have only those items changed with the data from the custom fields.
So, my question is how do I handle line selection in the context of these BAdIs? Is there a way to know which lines have been selected and then only change the data in those items?
I have looked in Class CL_PO_ITEM_HANDLE_MM for an attribute or method that might help but I haven't found anything as of yet.
I have found that the field MEPO1211-TCSELFLAG is set when a line is selected in ME22N. However, I haven't found a way to work with it. It doesn't get passed to any of the methods in the BAdIs, as far as I know.
January 27, 2012 **************
We were able to capture the lines selected by using code from method mass_change in Include LMEGUICJK, Function Group MEGUI. The lines are in the lt_models table.
So, now my issue is getting data to save in ME22N. When I put data in my custom tabs and select a line, the data gets changed on the screen but does not save. It does work when I make a change in another field, like changing the description for instance. I'm using the set_changed method in Process_Header from ME_PROCESS_PO_CUST but it doesn't work.
I'm getting the idea that I'm the first ABAP developer to try this...
Thanks for any help.
Kind Regards,
Chris
Edited by: Chris Mowl on Jan 11, 2012 10:33 AM
Edited by: Chris Mowl on Jan 11, 2012 4:24 PM
Edited by: Chris Mowl on Jan 27, 2012 10:57 AM
Edited by: Chris Mowl on Jan 27, 2012 2:00 PMHi,
Checkout the below link :
<link to blacklisted site removed by moderator>
Shailaja Ainala.
Edited by: Thomas Zloch on Jan 28, 2012 9:06 PM
Maybe you are looking for
-
Don't know where to key in...
Hi, I'm back with another problem... I have a Server running Suse 7.3 with HIGHPOINT RAID ATA133 HPT374 PCI card. I upgraded to ArchLinux 0.7b2. The problem is that I don't know how to load the driver on startup. In Suse, I had the following 2 lines
-
Do you need to add a router to get wi fi, on an imac desktop?
do you need to add a router to get wi fi, on an imac desktop?
-
Dial a phone number from iTunes
I am searching for a way to dial a number either from within iTunes, or from Outlook directly, that would be really practical.
-
Multiple licenses for Mountain Lion that comes preloaded on MacBook Pro?
I just received my new macbook pro. It came installed with Mountain Lion. Can I use this license to upgrade my other machines (iMac) to Mountain Lion too? I was told that because it came pre-loaded on my macbook, that I was not permitted to use it
-
Does a lender care if I know I am leaving my job in six months?
I am in an unusual situation - I'm receiving a severance payment from my company that enables me to pay a large down on an intended hom purchase. I also have the option to stay on pay roll for six months. I am concerned that a lender will look at my