Application Development and Automation 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: 
Read only

Get message from batch input

Former Member
0 Likes
3,559

Hi all,

I use batch input (which I recorded) for transaction MSC1N.

I want to get the new batch number created by the transaction.

How can I get the number which appears in the bottom as green S message.

Thank you in advance.

Hagit

8 REPLIES 8
Read only

GauthamV
Active Contributor
0 Likes
1,926

hi,

all messages r stored in table T100.

if u want details of batch check tables APQD,APQL,APQI.

REWARD POINTS IF HLPFUL.

Read only

Former Member
0 Likes
1,926

Use sy-MSGV1 or sy-MSGV2 to get the number ...

Message along with the number is stored in these fields ..

Read only

Former Member
0 Likes
1,926

Hi,

After call transaction you will be filling messages in an internal table decalred for BDCMSGCOLL structure.

CALL TRANSACTION MSC1N using BDC_DATA

MESSAGES INTO <MESSTAB>.

Here MESSTAB is internal table of type BDCMSGCOLL.

LOOP at this MESSTAB MSGTYP = 'S'.

This record with MSGTYP = 'S' will have MGSV1 variable filled with new batch number created.

Hope this helps!!

Ramesh.

Read only

Former Member
0 Likes
1,926

Hi Hagit,

Ramesh's solution is good. Sometimes it is also possible to use a parameter ID that is filled by the transaction. It's a bit less coding but you have to figure out if your specific transaction fills one. Better yet would be to use a BAPI instead of the CALL TRANSACTION, that way you will just get the new batch number back as a paramter, bapi_batch_create seemms to fit the bill.

Greetings,

Gert.

Read only

0 Likes
1,926

Hi,

Thank you all for the replies.

I use the structure BDCMSGCOLL for batch input massages.

The number of the new batch is not given.

Also checked SY-MSGV1/2, they are also empty.

For reply of Gert Beukema - I tried using this BAPI, but I do not have the option to copy classifications from existing batch. Did you use this BAPI yourself? maybe you can give me some clues for solving this?

Thanks,

Hagit

Read only

0 Likes
1,926

I am bit confused if u r running the BDC in session method u have to give the session name urself (from selection screen)

and if u r usinf the call transaction method there is no session in question ...

what u exactly want to know

Read only

0 Likes
1,926

Hi Hagit,

ahh classification data. That's always a bit of a problem. There is a special API for these. What you do, you first create the batch and then later add the classification. I can't remember the name of the classification FM's right now.

And no, I have not used the BAPI for the batch creation.

Greetings,

Gert.

Read only

Former Member
0 Likes
1,926

Hi Hagit,

You can store all the messages in Internal table used in BDC

DATA: BEGIN OF IT_BDCMSGCOLL OCCURS 0.

INCLUDE STRUCTURE BDCMSGCOLL.

DATA: END OF IT_BDCMSGCOLL.

DATA W_MSG(150).

call transaction 'F-22' using it_bdcdata MOde 'A' Update 'A' MESSAGES INTO IT_BDCMSGCOLL.

IF SY-SUBRC = 0 or SY-SUBRC = 1001.

LOOP AT IT_BDCMSGCOLL .

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = IT_BDCMSGCOLL-MSGID

LANG = SY-LANGU

NO = IT_BDCMSGCOLL-MSGNR

V1 = IT_BDCMSGCOLL-MSGV1

V2 = IT_BDCMSGCOLL-MSGV2

V3 = IT_BDCMSGCOLL-MSGV3

V4 = IT_BDCMSGCOLL-MSGV4

IMPORTING

MSG = W_MSG

EXCEPTIONS

NOT_FOUND = 1

OTHERS = 2.

WRITE:/ W_MSG.

clear: W_MSG.

ENDLOOP.

ENDIF.

Sachin