2009 Sep 17 12:05 PM
How to run call transaction method in background and how to download errors if it run in background?
2009 Sep 17 12:07 PM
Hi ,
Run the transaction in mode 'N' and use Message_text_build function module to capture the error .
Thanks
2009 Sep 17 12:11 PM
2009 Sep 17 12:15 PM
You cannot download anything to the desktop or the presentation server in background mode. You can only download to the application server using OPEN DATASET and TRASNFER statement in the background.
2009 Sep 17 12:32 PM
Hi,
What u can do check for the system message type after call transaction. If it is 'S' collect the pernr in success internal table, if its 'E' collect the pernr in error internal table. Now pass the error internal table in GUI_DOWNLOAD with specifying the path of the presentation server.
Loop at your BDC table.
call transaction c_tcode using t_bdcdata
mode 'N'
update 'A'
messages into t_messtab.
read table t_messtab into x_messtab with key msgtyp = c_e.
if sy-subrc = 0.
collect that in error internal table (t_error).
endif.
endloop.
call method cl_gui_frontend_services=>gui_download
exporting
filename = '....specify the path....'
FILETYPE = 'ASC'
APPEND = 'X'
write_field_separator = 'X'
changing
data_tab = t_error[].
Thanks
Shantanu
2009 Sep 17 12:15 PM
Hi
Try in this way
CALL TRANSACTION MODE OF EXECUTION MAY HAVE THE BELOW OPTIONS.
*A" Processing with display of screens
*"E" Display of screens only if an error occurs
*"N" Processing without display of screens.
*"P" Processing without display of the screens.
DATA : l_mode TYPE char1 VALUE 'N'. " Mode of Execution
CALL TRANSACTION MODE OF UPDATE MAY HAVE THE BELOW OPTIONS.
*A" Asynchronous update.
*"S" Synchronous processing.
*"L" Local update.
DATA:
l_update TYPE char1 VALUE 'A'. " Mode of Update
REFRESH i_messtab.
CALL THE TRANSACTION 'CJ02' TO LOAD THE SETTLEMENT RULES DATA
AND CAPTURES THE ERRORS IN THE MESSATAB.
CALL TRANSACTION fp_tcode USING i_bdcdata
MODE l_mode
UPDATE l_update
MESSAGES INTO i_messtab. "#EC CI_CALLTA
IF sy-subrc NE 0.
g_flag = c_flag.
LOOP AT i_messtab INTO wg_messtab.
CALL FUNCTION 'FORMAT_MESSAGE' "#EC *
EXPORTING
id = wg_messtab-msgid
lang = c_language
no = wg_messtab-msgnr
v1 = wg_messtab-msgv1
v2 = wg_messtab-msgv2
v3 = wg_messtab-msgv3
v4 = wg_messtab-msgv4
IMPORTING
msg = g_msg
EXCEPTIONS "#EC *
not_found = 1
OTHERS = 2.
IF sy-subrc EQ 0.
MOVE 'E' TO wg_errmessage-type.
MOVE g_msg TO wg_errmessage-message.
APPEND wg_errmessage TO i_errmessage.
ENDIF.
ENDLOOP.
ELSE.
IF g_flag1 = 'X' AND g_flag2 = 'X'.
g_succ = g_succ + 1.
ENDIF.
ENDIF.
Regards,
Sreeram
2009 Sep 17 12:16 PM