Statement SUBMIT is not allowed in this form. It is a common ABAP error. Find the workaround solutions and alternative to avoid and correct ABAP program.
Find following an overview about how to use ABAP Submit Statement, the different exceptions triggered by this statement and some solutions for the famous ‘Statement “SUBMIT” is not allowed in this form‘.
Table of Contents
Statement “SUBMIT” ABAP sample
SUBMIT Statement allows to call an ABAP Report within an other.
Submit Statement Synthax
SUBMIT {rep|(name)} [selscreen_options]
????????????????????[list_options]
????????????????????[job_options]
????????????????????[AND RETURN].
Use F1 in any ABAP Report with SUBMIT to get more detail.
Use?Submit Statement in ABAP report
" ABAP Submit: Create IDoc for Processing Order " Call the standard ABAP Report RCCLORD " The Idoc Type to generate is LOIPRO SUBMIT rcclord WITH s_aufnr IN aufnr_rg WITH s_matnr IN matnr_rg WITH s_werks IN werks_rg WITH opt_sys EQ lv_logsys WITH mestyp EQ 'LOIPRO' AND RETURN.
Statement SUBMIT Statement
List of exceptions for SUBMIT ABAP
in order to check which exception generated by the SUBMIT use and avoid a dump in ABAP Report, Try.. Catch should be implemented to catch the Runtime Execption
The list of exception the ABAP SUBMIT can generate are
- Cause: The specified program was not found.
Runtime Error: LOAD_PROGRAM_NOT_FOUND - Cause: You tried to pass an invalid value to a selection using the addition SIGN.
Runtime Error: SUBMIT_WRONG_SIGN - Cause: The specified program is not a report.
Runtime Error: SUBMIT_WRONG_TYPE - Cause: You tried to pass more than one value to a report parameter.
Runtime Error: SUBMIT_IMPORT_ONLY_PARAMETER - Cause: You tried to use WITH sel IN itab to pass a table that does not have the appropriate structure to a selection.
Runtime Error: SUBMIT_IN_ITAB_ILL_STRUCTURE - Cause: You tried to pass a parameter that cannot be converted to the target field to the selection screen.
Runtime Error: SUBMIT_PARAM_NOT_CONVERTIBLE - Cause: The called program contains a syntax error.
Runtime Error: SYNTAX_ERROR
Statement “SUBMIT” is not allowed in this form
Solution 1 : TRY … CATCH
Use Try… Catch in order to avoid the Dumb.
DATA: oref TYPE REF TO cx_root, text TYPE string. TRY. " Call SUBMIT Statement SUBMIT rcclord WITH s_aufnr IN aufnr_rg WITH s_matnr IN matnr_rg WITH mestyp EQ 'LOIPRO' AND RETURN. " Catch Exception CATCH load_program_not_found submit_wrong_sign submit_wrong_type submit_import_only_parameter submit_in_itab_ill_structure submit_param_not_convertible syntax_error INTO oref . " Get Text from Exception text = oref->get_text( ). WRITE text. ENDTRY.
Solution 2 : STARTING NEW TASK
Create a Function Module to Wrap the ABAP?Statement SUBMIT. Call the function module with option STARTING NEW TASK.
You can create a function module which will wrap you call and call this wrapper with option STARTING NEW TASK
For example, Call the function with these options?IN BACKGROUND TASK AS SEPARATE UNIT DESTINATION ‘NONE’
Here a sample ABAP function call :
CALL FUNCTION 'ZMY_FUNCTION' IN BACKGROUND TASK AS SEPARATE UNIT DESTINATION 'NONE' EXPORTING EXPORT = LS_EXPORT IMPORTING IMPORT = LS_IMPORT TABLES TABLE = LT_TABLE.
Solution 3: Check if REPORT EXIST
A common error using SUBMIT can the report using doesn’t exist.
Here a simple way to check if it exists before the call.
check if the Report has an entry in SAP Table?TRDIR :?System Table TRDIR.
More information about?ABAP Workbench Tables
DATA: ls_trdir TYPE trdir. SELECT SINGLE * FROM TRDIR INTO ls_trdir WHERE name = lv_report. IF sy-subrc = 0 . SUBMIT (lv_report) WITH param IN s_param AND RETURN . ENDIF.
Read more about the use of ABAP SUBMIT Statement.