‎2008 Jun 27 10:59 AM
Hello All,
I am using SUBMIT to call a program from within another program.
My requirement is to capture the MESSAGES thrown by the called program in the calling program.
Here is the code snippet:
DATA: list_tab TYPE TABLE OF abaplist.
Data: begin of wa_text,
c type c,
end of wa_text,
t_text like standard TABLE OF wa_text.
Submit zkh_called_prog EXPORTING LIST TO MEMORY and return.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
LISTOBJECT = list_tab
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2
.
CALL FUNCTION 'LIST_TO_TXT'
EXPORTING
LIST_INDEX = -1
TABLES
LISTTXT = t_text
LISTOBJECT = list_tab
* EXCEPTIONS
* EMPTY_LIST = 1
* LIST_INDEX_INVALID = 2
* OTHERS = 3
.
IF sy-subrc = 0.
CALL FUNCTION 'WRITE_LIST'
TABLES
listobject = list_tab.
ENDIF.By this I am able to get the output of WRITE statements in the t_text internal table. But I am not able to get the Error/ Status Messages in this table.
Can anyone suggest a way of capturing the messages in the calling program
Regards,
Khushboo
‎2008 Jun 27 11:08 AM
As u r submitting a z prog. so u can change the prog. in a way, that all the message (type S,E,W) can be stored in an internal table. and then export that table to a memory id.
Now from calling program after submit statement simply import that table from the memory id and do the further processing.
Regards,
Joy.
‎2008 Jun 27 11:05 AM
Hi khushbu.
better u try like this.
submit callingprogram
with s_spart in s_spart
with p_spmon eq p_spmon
and return.
u have to take care taht the parameters must be same....in the calling and called program.
then capture msg.
reward points if found helpful
thnx
prashant
‎2008 Jun 27 11:08 AM
As u r submitting a z prog. so u can change the prog. in a way, that all the message (type S,E,W) can be stored in an internal table. and then export that table to a memory id.
Now from calling program after submit statement simply import that table from the memory id and do the further processing.
Regards,
Joy.
‎2008 Jun 27 11:12 AM
hi here you can get the values from the return parameters in the submit statement