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.
Showing results for 
Search instead for 
Did you mean: 

Capture Screen message while ME21N

Former Member
0 Kudos

How can I capture the PO Number while executing Me21N.

In one report I am called ME21N. SAP Displays message PO <PO Number > Created. I want to capture the PO Number and wanted to do further processing.

I tried to get data from SYST MSGV1, MSGV2 MSGV3 MSGV3. But all variables are blank.

I cant use set and get parameters. Because if user exit PO creation without creating the PO then get parameter picks the last created PO number.


EBELN = ???????


Former Member
0 Kudos

ME21N is an enjoy SAP transaction and hence a BDC cannt be written. The case I can see is you could have justy calles the transaction ME21N and then manually posted the document.

Now since it is an enjoy SAP transaction, you cannot capture the messages also. If you really want to capture the messages, then use BAPI for PO creation. Else use ME21 to post document and capture messages.


0 Kudos

Use ME21 instead, or use a BAPI. If you use ME21 in a call transaction, the PO number will come back to you in the message itab.

Use the MESSAGES INTO ITAB extension of the call transaction statement. Use the MSGV1 field in the messages itab. Define the itab type of BDCMSGCOLL.


Rich Heilman

0 Kudos

I have to Call Just ME21N and then user will create the PO mannually. after he saves the PO I want the PO number for further processing.

by using the following code I can Capture the PO number, but the problem is that it will behave like a BDC with differnet screen attribute.

Note i_BDCDATA table is blank.



USING i_bdcdata

MESSAGES INTO i_messtab.


*CLEAR i_messtab.

*SORT i_messtab DESCENDING by msgtyp.

*READ TABLE i_messtab WITH KEY msgtyp = 'S'.

*IF sy-subrc = 0 .

EBELN = i_messtab-msgv2.

I just want to capture the screen value after ME21N.

Former Member
0 Kudos


I think Its better uesd the standard Bapi BAPI_PO_CREATE1 to create PO's. It will written the PO number created in export parameter and aslo capture the screen messages in return table.



0 Kudos

ME21 is a better BDC choice to use.