‎2008 Jun 10 8:35 AM
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
‎2008 Jun 10 8:38 AM
hi,
all messages r stored in table T100.
if u want details of batch check tables APQD,APQL,APQI.
REWARD POINTS IF HLPFUL.
‎2008 Jun 10 8:40 AM
Use sy-MSGV1 or sy-MSGV2 to get the number ...
Message along with the number is stored in these fields ..
‎2008 Jun 10 8:42 AM
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.
‎2008 Jun 10 9:06 AM
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.
‎2008 Jun 11 8:21 AM
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
‎2008 Jun 11 8:33 AM
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
‎2008 Jun 12 8:05 AM
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.
‎2008 Jun 10 9:31 AM
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