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: 

ME21N Update Text in Line Item User Exit

Former Member
0 Kudos

Hi, I have created a new PO text item for use in ME21N that I want to populate from document details held in the material master. After entering a material number what user exit do I need to use to update internal tables for display of the document details before they are saved along with the other PO details. I know the tables where the material document details are held. Thanks.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

BADI ME_PROCESS_PO_CUST.

Note that this BADI has a number of methods with parameters defined as "Importing" which makes it look like you cannot change data, but some of these parameters are "TYPE REF TO" objects which themselves have methods such as GET_DATA and SET_DATA that actually allow you to access and change the fields.

Search for previous posts including "ME_PROCESS_PO_CUST" - there is sample code in some of them.

In transaction SE19, if you display the BADI then select menu option goto>sample code>display, you will be able to drill down on the PROCESS_ITEM method to some SAP supplied sample code.

This includes the definitions and method calls to get the item data:

DATA: ls_mepoitem TYPE mepoitem.

ls_mepoitem = im_item->get_data( ).

You then just change relevant fields in structure ls_mepoitem and call the set_data method to pass the data back

call method im_item->set_data exporting im_data = ls_mepoitem.

Take care with what you change - SAP does not validate that you have passed back correct / consistant data.

Not sure if the text field you want will be available - you may need to look at further methods of the BADI or of the parameter objects. If you drill down on the objects that the method parameters are defined as TYPE REF TO you will see the methods that are available - the GET_DATA and SET_DATA ones I have mentioned above are only a small part of the options. If there are none dealing with texts at the Header / Line, then you may need to put your code in at the latest method available (once the PO number is allocated) and call the SAVE_TEXT function module to do your update - not 100% way of doing it because standard code may save in update event and have rollback handling.

To use the BADI you will need to create an implementation of it - there is a menu option in SE18 to do this, or you can use SE19.

Andrew

4 REPLIES 4

Former Member
0 Kudos

Take a look at BADI ME_PROCESS_PO_CUST.

Search for previous threads on this BADI - some have sample code.

You can also see sample code in SE18 (there is a menu option to go to sample code)

Andrew

0 Kudos

Andrew, thanks for the reply.

When the BAdi is envoked we will know the material and will be able to read in the material document details but what are the internal tables to be updated at this point or are there function modules we can use to pass the data to so it gets formatted correctly?

Former Member
0 Kudos

BADI ME_PROCESS_PO_CUST.

Note that this BADI has a number of methods with parameters defined as "Importing" which makes it look like you cannot change data, but some of these parameters are "TYPE REF TO" objects which themselves have methods such as GET_DATA and SET_DATA that actually allow you to access and change the fields.

Search for previous posts including "ME_PROCESS_PO_CUST" - there is sample code in some of them.

In transaction SE19, if you display the BADI then select menu option goto>sample code>display, you will be able to drill down on the PROCESS_ITEM method to some SAP supplied sample code.

This includes the definitions and method calls to get the item data:

DATA: ls_mepoitem TYPE mepoitem.

ls_mepoitem = im_item->get_data( ).

You then just change relevant fields in structure ls_mepoitem and call the set_data method to pass the data back

call method im_item->set_data exporting im_data = ls_mepoitem.

Take care with what you change - SAP does not validate that you have passed back correct / consistant data.

Not sure if the text field you want will be available - you may need to look at further methods of the BADI or of the parameter objects. If you drill down on the objects that the method parameters are defined as TYPE REF TO you will see the methods that are available - the GET_DATA and SET_DATA ones I have mentioned above are only a small part of the options. If there are none dealing with texts at the Header / Line, then you may need to put your code in at the latest method available (once the PO number is allocated) and call the SAVE_TEXT function module to do your update - not 100% way of doing it because standard code may save in update event and have rollback handling.

To use the BADI you will need to create an implementation of it - there is a menu option in SE18 to do this, or you can use SE19.

Andrew

0 Kudos

My task is this below using BADI...........! plz give solution for this task..

1> I will enter all the details in me21n to create Standard PO no... When i click SAVE button in me21n,

what r the details entered in the screen me21n should be moved to one internal tables... Is there any solution for this .... Plz replay me soon,,,,,,,,,,,!