Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Exit/BADI to Pass default Tax code in PO item screen

Former Member
0 Kudos

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.

13 REPLIES 13

VijayaKrishnaG
Active Contributor
0 Kudos

Hi Shyam,

You can use BADI ME_PROCESS_PO_CUST and implement that code in POST method.

Regards,

Vijay

0 Kudos

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.

0 Kudos

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

0 Kudos

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.

0 Kudos

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

VenkatRamesh_V
Active Contributor
0 Kudos

Hi,

Try  Screen variant(T-code SHD0) for  the field to be grey out.   

Hope it helpful.

Regards,

Venkat.

0 Kudos

Hi venkat,

              Users can delete the default tax code value and make it blank. So cant gray out.

Regards,

Shyam.

0 Kudos

Prasad, have you tried implementing above BADI?

Regards,

Vijay

VenkatRamesh_V
Active Contributor
0 Kudos

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.

0 Kudos

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.

0 Kudos

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.

0 Kudos

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

0 Kudos

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