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: 

batch-input

Former Member
0 Kudos

hi

i create a program that do batach-input.

i create an insternal table that hold the error that happend in the batch,but when i run the program in background i dont see the log.

how can i fix it that i can see the log in background

thanks

have a nice day

1 ACCEPTED SOLUTION

Former Member
0 Kudos

If you are using Batch input then the log will be visible in SM35 and if you are using CALL TRANSACTION you need to write extra logic in your application to capture the messages during the CALL TRANSACTION.

You need to use the addition MESSAGES INTO (msg_tab) in the CALL TRANSACTION statement and then use the entries in msg_tab to build the messages using MESSAGE_TEXT_BUILD.

-Kiran

*Please reward useful answers

7 REPLIES 7

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

You are using CALL TRANSACTION and have the extension MESSAGES INTO ITAB? IF so, you can use write out the message from ITAB to a list. Then when ran in the background you can see the messages in the spool.

Regards,

Rich Heilman

Former Member
0 Kudos

Just write the data of the internal table using WRITE statements. Then when the program is executed in background, you should be able to see the log in the spool.

Regards,

Ravi

Former Member
0 Kudos

hi yossi,

goto transaction <b>SM35</b> and select your session and click the button <b>Logs</b>

Former Member
0 Kudos

If you are using Batch input then the log will be visible in SM35 and if you are using CALL TRANSACTION you need to write extra logic in your application to capture the messages during the CALL TRANSACTION.

You need to use the addition MESSAGES INTO (msg_tab) in the CALL TRANSACTION statement and then use the entries in msg_tab to build the messages using MESSAGE_TEXT_BUILD.

-Kiran

*Please reward useful answers

0 Kudos

hi

can u send me example

thanks

0 Kudos

hi yossi,

if u r using CALL TRANSACTION.

EXAMPLE:

call transaction 'FK02' using it_bdcdata mode 'A'

update 'S'

messages into it_messages.

write:/ sy-subrc.

perform format_messages.

clear it_bdcdata.

refresh it_bdcdata.

form format_messages .

data: l_msg(100).

loop at it_messages.

call function 'FORMAT_MESSAGE'

exporting

id = it_messages-msgid

lang = sy-langu

no = it_messages-msgnr

v1 = it_messages-msgv1

v2 = it_messages-msgv2

v3 = it_messages-msgv3

v4 = it_messages-msgv4

importing

msg = l_msg

exceptions

not_found = 1

others = 2

.

write:/ l_msg.

endloop.

0 Kudos

Here is an example.



data: message(50) type c.
data: messtab like bdcmsgcoll occurs 0 with header line.


....
* Call the transaction get message into messtab
  call transaction 'CS02' using bdcdata mode 'N'
                               update 'S'
                  <b>             messages into messtab.</b>

* IF the transaction was not succesful then read the 
* messtab for the first Error message.
  if sy-subrc <> 0.
    read table messtab with key msgtyp = 'E'.
    if sy-subrc = 0.
* Once you get an error message, prepare the message,
* Meaning, convert it to something meaningful.
  call function 'MESSAGE_PREPARE'
       exporting
            language = sy-langu
            msg_id   = messtab-msgid
            msg_no   = messtab-msgnr
            msg_var1 = messtab-msgv1(50)
            msg_var2 = messtab-msgv2(50)
            msg_var3 = messtab-msgv3(50)
            msg_var4 = messtab-msgv4(50)
       importing
            msg_text = message.

* Write to list display
write:/ imat-matnr, imat-werks, imat-idnrk, message.

      endif.
  endif.


  clear: bdcdata, messtab.
  refresh: bdcdata, messtab.


If you want to write all of the messages for a particular transaction, then all you need to do is LOOP at the MESSTAB instead of READ.

Regards,

Rich heilman