02-05-2015 4:51 AM
Hi folks,
We are looking an exit/badi to pass default tax code (MWSKZ) in ME21N/22N.
Currently i am doing it with exit EXIT_SAPMM06E_016 and passing value to the dynamic table (SAPLMEPO)POT[].
Its working fine in ME21N. But in change mode based on a push button press it should default tax code again.
And at this time, when we press button and dont change any other item fields in PO screen tax code is not updating to database.
I need a proper exit/badi where SAP allows PO Item details to be defaulted and save to database. Thanks in advance.
Regards,
Shyam.
02-05-2015 4:55 AM
Hi Shyam,
You can use BADI ME_PROCESS_PO_CUST and implement that code in POST method.
Regards,
Vijay
02-05-2015 7:29 AM
Hi Vijaykrishna,
Yes, i kept the same code in POST method of the BADI you mentioned. But unfortunately its not updated in the database, if am just clicking my custom push button and not changing any other data in the screen. Code mentioned below.
LOOP AT <pot> ASSIGNING <ls_pot>.
<ls_pot>-mwskz = 'P1'.
MODIFY <pot> FROM <ls_pot> TRANSPORTING mwskz.
ENDLOOP.
Regards,
Shyam.
02-05-2015 7:32 AM
Hi,
have you debugged your code after implementing BADI? Are getting data there and your modify statement working or not??
If you implement it correctly, that should update the table when you click on save button with out any changes.
Regards,
Vijay
02-05-2015 7:41 AM
Yes, my modify statement working perfectly and its updating in the <POT> table.
But some how its not updating in the database, as there is no other change on the screen except the push button press.
Regards,
Shyam.
02-05-2015 7:48 AM
On which table have you written MODIFY statement and which table in database is not getting updated.
If database table is not getting updated, there should be problem with the ABAP statement modifying the table but not with implementation. And if your implementation is not getting triggered in transaction then there is problem in implementation.
It would be better you post the code you implemented in the BAPI.
Regards,
Vijay
02-05-2015 5:05 AM
Hi,
Try Screen variant(T-code SHD0) for the field to be grey out.
Hope it helpful.
Regards,
Venkat.
02-05-2015 6:07 AM
Hi venkat,
Users can delete the default tax code value and make it blank. So cant gray out.
Regards,
Shyam.
02-05-2015 6:38 AM
02-05-2015 8:00 AM
Hi Shyam,
Try this,
METHOD IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM
DATA: ls_mepoitem TYPE mepoitem,
ls_mepoitem = im_item->get_data( ).
ls_mepoitem-MWSKZ = '1'.
im_item->SET_DATA( EXPORTING IM_DATA = ls_mepoitem ).
Hope it helpful.
Regards,
Venkat.
02-05-2015 3:43 PM
Hi Venkat,
Actually your code is working. But there is a small problem, once we go to change mode and give the required details and press enter then only its updating to the database. If we forget the press enter and save, tax code value is not updating to the database. Is it normal SAP behaviour or can we do something to update database even without pressing enter.
Thanks,
Shyam.
02-06-2015 12:57 AM
Hi Shyam,
you should press Enter or Save to update the database.
METHOD IF_EX_ME_PROCESS_PO_CUST~PROCESS_ITEM will be triggered while pressing enter or save
Hope it helpful.
Regards,
Venkat.
02-06-2015 3:55 AM
Hi Shyam,
That is the reason why I suggested to implement the code in POST method. So, that it will trigger at time of SAVE irrespective of Pressing enter or something.
Regards,
Vijay
02-06-2015 7:25 AM
Better use CHECK method (always executed before SAVE) than SAVE method which is often triggered too late to change some data.
IMHO the best solution is PROCESS_ITEM, there use GET_DATA and GET_PREVIOUS_DATA (this one to identify lines modified since last execution) or GET_PERSISTENT_DATA (database data so identify new items) also don't use SET_DATA if you don't actually change the data.
Regards,
Raymond