‎2006 Jul 05 2:41 PM
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
‎2006 Jul 05 2:45 PM
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
‎2006 Jul 05 2:42 PM
‎2006 Jul 05 2:43 PM
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
‎2006 Jul 05 2:44 PM
hi yossi,
goto transaction <b>SM35</b> and select your session and click the button <b>Logs</b>
‎2006 Jul 05 2:45 PM
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
‎2006 Jul 05 2:46 PM
‎2006 Jul 05 2:49 PM
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.
‎2006 Jul 05 2:49 PM
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