03-02-2015 3:08 PM
Hi Guys,
I have a requirement wherein i need to check the value of purchasing group(field EKGRP) on pressing save ie creation of a purchase order. If the EKGRP value is not a specific value say 110 i have to default it to 110 on saving
That is upon saving(in Me21N) the code should check these
1 - Value of EKGRP
2 - Change the value to 110 if it's anything else.
I have gone through EXIT_SAPMM06E_013 and BAPI ME_PROCESS_PO_CUST. The problem with the EXIT_SAPMM06E_013 is that it's tables have no value of EKGRP during runtime.
The BAPI ME_PROCESS_PO_CUST method PROCESS_HEADER does not get called while saving the PO,hence it does not solve my purpose.
Could anyone help me out?
03-05-2015 2:34 PM
Hi everyone,
I have solved the requirement by means of an implicit enhancement in the include LMEGUICI5. Inside this include there is a method transport_from_dynp.All i have to do is change the value of purchasing group based on my condition inside the structure mepo1222.
This enhancement gets triggered whenever user presses enter or save.
Thanks everyone for your valuable help and inputs.Iam marking Raymond's answer as helpful
03-02-2015 3:50 PM
Hi Hari,
If you are not able to find the internal table/structure in BADI/Exit, I hope you can try the value using field symbol concept.
"Data Declaration
field-symbol <f_ekgrp> like ekgrp.
"Get the Ekgrp value using Program and Variable name
assign ('(program_name)varible_name') to <f_ekgrp>.
"Change the value
if <f_ekgrp> is assigned.
<f_ekgrp> = 'new value'.
endif.
Regards
Rajkumar Narasimman
03-02-2015 4:07 PM
The BAPI ME_PROCESS_PO_CUST method PROCESS_HEADER does not get called while saving the PO,hence it does not solve my purpose.
So better use a method CHECK, this one is called both when saving or when user execute a check, and allows change of data. (Method POST should not allow change of data, only execution of other updates. Just call im_header->get_data and set_data.)
NB: But why do you want to wait until save to change the value, if you don't need some information only available at save time, you could use PROCESS_HEADER, so user would be aware of the change?
Regards,
Raymond
03-03-2015 7:26 AM
Mr Raymond,
The only changing parameter in the method CHECK is of type abap_bool.Rest all are importing parameters.So this method cannot be used though it gets called while saving.
And regarding using PROCESS_HEADER. This method gets triggered whenever user presses the enter button after say making some change(s). But what if the user doesn't press enter and instead gives all values and presses save directly?. That is why iam waiting until save to change the value.
03-03-2015 7:46 AM
Regards,
Raymond
03-03-2015 8:30 AM
Hi Hari -
When some header data get changed with respect to the old header data in PO then the method PROCESS_HEADER should get called during SAVE as well as while pressing 'enter' from the key board. Let us know, if its not working.
03-03-2015 8:48 AM
Hi Atul,
You mention that "when some header data get changed". So i must assume this gets triggered in ME22N and not while saving in ME21N. So cannot solve my purpose.
03-03-2015 8:51 AM
Hi Raymond,
I have placed a break point in the method PROCESS_HEADER. The problem is that while saving in ME21N,the control does not go to the breakpoint meaning that the BADI method is not triggered while saving.
03-03-2015 8:53 AM
Sorry Raymond,
You seem to be right.The check method gets triggered while saving and it has reference to methods like get data,set data.I believe i can use the set_data method to change the value.Let me check and will update
03-03-2015 9:06 AM
03-03-2015 9:41 AM
03-03-2015 9:42 AM
I set the header data in Check method but it's not getting reflected after saving.Iam lost now
03-03-2015 10:18 AM
Hi Hari -
What I mean here is that it triggers also in ME21N. When ever you enter some data or change the data (even in ME21N say you change vendor / purchase org etc) , it also get triggered.
1. Go to BADI Implementation method (PROCESS_HEADER) and put a break point on ENDMETHOD (if you have not written any code yet)
2. Go to ME21N, choose the PO Type and you will reach the break point
3. Then enter Purchase org and press 'enter', you will reach the break point.
3. Again change the Purchase org from what you entered in step 3 above and press 'enter', you will reach the break point
Please check, let us know.
Regards,
Atul Mohanty
03-03-2015 10:33 AM
Try to add a im_header->set_changed() after the GET_DATA()/MOVE xxx TO mepoheader-ekgrp/SET_DATA() code.
Also, for testing, execute the CHECK function and not the SAVE function, are some messages raised in "Doc. Header Messages (Error), is the change executed.
Regards,
Raymond
03-02-2015 4:34 PM
Hi,
use, as Raymond has mentioned, BADI ME_PROCESS_PO_CUST with
method PROCESS_HEADER.
In this method you have to use:
CALL METHOD IM_HEADER->GET_DATA
and than
CALL METHOD IM_HEADER->SET_DATA
Regards, Dieter
03-03-2015 10:37 AM
Hi,
i'm a litte bit confused, there are a lot of answers which will help.
Can you please show us what do you have tried.
Did you tried PROCESS_HEADER? When yes show the code.
Regards, Dieter
03-05-2015 2:34 PM
Hi everyone,
I have solved the requirement by means of an implicit enhancement in the include LMEGUICI5. Inside this include there is a method transport_from_dynp.All i have to do is change the value of purchasing group based on my condition inside the structure mepo1222.
This enhancement gets triggered whenever user presses enter or save.
Thanks everyone for your valuable help and inputs.Iam marking Raymond's answer as helpful