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: 

CALL TRANSACTION IN BACKGROUND

Former Member
0 Kudos
7,209

How to run call transaction method in background and how to download errors if it run in background?

6 REPLIES 6

Former Member
0 Kudos
1,106

Hi ,

Run the transaction in mode 'N' and use Message_text_build function module to capture the error .

Thanks

Former Member
0 Kudos
1,106

how to download errors to desktop from session method?

0 Kudos
1,106

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.

0 Kudos
1,106

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

sreeramkumar_madisetty
Active Contributor
0 Kudos
1,106

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

Former Member
0 Kudos
1,106

Hi,

Refer this link to download errors from session method.

if wants to catch errors from call transaction in background mode refer the below link

Regards,

Vijay

Edited by: vijay kumar pamulapati on Sep 17, 2009 1:17 PM