DYNPRO_SEND_IN_BACKGROUND¶
A screen (dynpro) was sent during background job execution.
Background jobs have no user interface — any attempt to render a screen or display an interactive message terminates the job with this dump.
Symptom¶
ST22 shows:
Runtime Errors DYNPRO_SEND_IN_BACKGROUND
Exception CX_SY_DYNPRO_SEND_IN_BACKGROUND
Short text Dynpro cannot be sent in background.
The dump line is typically a MESSAGE, CALL SCREEN, WRITE, or a CALL FUNCTION that internally opens a popup.
Cause¶
The ABAP runtime blocks any screen output when SY-BATCH = 'X'. Statements that trigger the dump:
MESSAGE ... TYPE 'I','W', or'E'without a dialog-free alternative — these normally open a popup in dialog mode.CALL SCREENorLEAVE TO SCREEN.WRITEto the standard list output (which creates an implicit screen).CALL FUNCTION 'POPUP_TO_CONFIRM'or any FM that renders a UI internally.- Older function modules that call
MESSAGE ... TYPE 'I'inside their error handling paths.
Standard FMs can hide dynpro calls
Many SAP standard FMs use popup messages internally. Even if your own code has no screen statements, a called FM may trigger the dump. Always check the active call stack in ST22.
Reproduce¶
REPORT ztest_bg_message.
START-OF-SELECTION.
" If this report is scheduled as a background job, the MESSAGE
" tries to open an information popup — not possible in background.
MESSAGE 'Processing complete' TYPE 'I'.
Schedule the report via SM36 and execute immediately — SM37 shows a cancelled job and ST22 records the dump.
Fix¶
DATA: lv_log_handle TYPE balloghndl.
CALL FUNCTION 'BAL_LOG_CREATE'
EXPORTING
i_s_log = VALUE bal_s_log( object = 'ZOBJ'
subobject = 'ZSUB' )
IMPORTING
e_log_handle = lv_log_handle.
CALL FUNCTION 'BAL_LOG_MSG_ADD_FREE_TEXT'
EXPORTING
i_log_handle = lv_log_handle
i_msgty = 'I'
i_text = 'Processing complete'.
CALL FUNCTION 'BAL_DB_SAVE'
EXPORTING
i_log_handle = lv_log_handle.
ERROR_MESSAGE exception
The ERROR_MESSAGE = 1 exception in CALL FUNCTION catches MESSAGE ... TYPE 'E' (and in some FMs 'I'/'W') and maps them to SY-SUBRC instead of showing a dialog — the standard way to make FMs background-safe.
Prevention¶
- Always code a background-safe path and branch on
SY-BATCH = abap_truewherever messages are issued. - Replace interactive
MESSAGE TYPE 'I'/'W'/'E'in shared utility code with application log entries (SLG1) or SPOOL output. - Never call screen-based FMs (
POPUP_*,DYNPRO_*) from code that may run in background. - Test every new job in SM37 with a short check run before scheduling it in production.
See also¶
MESSAGE_TYPE_X— related dump from abort messages in background- Transaction SM36 — schedule background jobs
- Transaction SM37 — background job log and cancel reasons
- Transaction SLG1 — application log viewer