SAP IDOC_INPUT Function Module for









IDOC_INPUT is a standard idoc input SAP function module available within SAP R/3 or S/4 Hana systems, depending on your version and release level. It is used to perform a specific ABAP function and below is the pattern details, showing its interface including any import and export parameters, exceptions etc. there is also a full "cut and paste" ABAP pattern code example, along with implementation ABAP coding, documentation and contribution comments specific to this or related objects.


See here to view full function module documentation and code listing for idoc input FM, simply by entering the name IDOC_INPUT into the relevant SAP transaction such as SE37 or SE38.

Function Group: BD20
Program Name: SAPLBD20
Main Program: SAPLBD20
Appliation area: S
Release date: N/A
Mode(Normal, Remote etc): Remote-Enabled
Update:



Function IDOC_INPUT pattern details

In-order to call this FM within your sap programs, simply using the below ABAP pattern details to trigger the function call...or see the full ABAP code listing at the end of this article. You can simply cut and paste this code into your ABAP progrom as it is, including variable declarations.
CALL FUNCTION 'IDOC_INPUT'"
EXPORTING
* NO_OF_RETRIES = 0 "No. of retries for inbound IDoc
* PI_PARTNER_OPTION = "
MASS_PROCESSING = "Flag: Mass input
* INPUT_METHOD = C_IN_BACKGROUND "Should be imported in background or foreground
* DIRECT_CALL = C_FALSE "Direct call (not from a method)
* IDOC_START_EVENT_ENABLED = C_TRUE "Flag: IDoc start event can be triggered
* END_EVENT_ENABLED = C_FALSE "Flag: IDoc end event can be triggered
* END_EVENT_ALWAYS = C_FALSE "Flag: IDoc end event should be triggered
* DO_COMMIT = C_TRUE "Flag: Commit Work transmitted in program
* PROCESS_CODE = "Process code for inbound

IMPORTING
EXCEPTION_VALUE = "Value of internal exception
INPUT_SUCCEEDED_FOR_ALL = "Flag: All IDocs successfully processed
PE_IDOC_RESTART = "

TABLES
UNPROCESSED_IDOCS = "Unprocessed IDoc numbers
IDOC_DATA = "IDoc data segments (optional)
IDOC_CONTROL = "IDoc control records

EXCEPTIONS
IDOC_OPEN_LOCK = 1 IDOC_CLOSE_NOT_OPEN = 10 IDOC_CLOSE_DB_ERROR = 11 IDOC_CLOSE_PARAMETER_ERROR = 12 IDOC_CLOSE_NO_STATUS_WRITTEN = 13 IDOCS_DO_NOT_EXIST = 14 IDOCS_HAVE_NO_DATA_RECORDS = 15 UNPROCESSED_IDOCS_EMPTY = 16 IDOC_OPEN_NOT_EXIST = 2 IDOC_OPEN_INVALID = 3 IDOC_OPEN_ALREADY = 4 IDOC_WRITE_NUMBER_INVALID = 5 IDOC_WRITE_STATUS_INVALID = 6 IDOC_WRITE_NO_STATUS = 7 IDOC_WRITE_LOCK = 8 IDOC_WRITE_DB_ERROR = 9
.



IMPORTING Parameters details for IDOC_INPUT

NO_OF_RETRIES - No. of retries for inbound IDoc

Data type: BDWF_PARAM-RETRIES
Optional: Yes
Call by Reference: No ( called with pass by value option)

PI_PARTNER_OPTION -

Data type: EDI_PARTNER_INBOUND_OPTION
Optional: Yes
Call by Reference: No ( called with pass by value option)

MASS_PROCESSING - Flag: Mass input

Data type: BDWF_PARAM-MASS_PROC
Optional: No
Call by Reference: No ( called with pass by value option)

INPUT_METHOD - Should be imported in background or foreground

Data type: BDWFAP_PAR-INPUTMETHD
Default: C_IN_BACKGROUND
Optional: Yes
Call by Reference: No ( called with pass by value option)

DIRECT_CALL - Direct call (not from a method)

Data type: BDWF_PARAM-DIRECTCALL
Default: C_FALSE
Optional: Yes
Call by Reference: No ( called with pass by value option)

IDOC_START_EVENT_ENABLED - Flag: IDoc start event can be triggered

Data type: BDWF_PARAM-MANUALINPT
Default: C_TRUE
Optional: Yes
Call by Reference: No ( called with pass by value option)

END_EVENT_ENABLED - Flag: IDoc end event can be triggered

Data type: BDWF_PARAM-MANUALINPT
Default: C_FALSE
Optional: Yes
Call by Reference: No ( called with pass by value option)

END_EVENT_ALWAYS - Flag: IDoc end event should be triggered

Data type: BDWF_PARAM-MANUALINPT
Default: C_FALSE
Optional: Yes
Call by Reference: No ( called with pass by value option)

DO_COMMIT - Flag: Commit Work transmitted in program

Data type: BDFIELDS-PARALLEL
Default: C_TRUE
Optional: Yes
Call by Reference: No ( called with pass by value option)

PROCESS_CODE - Process code for inbound

Data type: EDP21-EVCODE
Optional: Yes
Call by Reference: No ( called with pass by value option)

EXPORTING Parameters details for IDOC_INPUT

EXCEPTION_VALUE - Value of internal exception

Data type: BDWF_PARAM-EXCEPTION
Optional: No
Call by Reference: No ( called with pass by value option)

INPUT_SUCCEEDED_FOR_ALL - Flag: All IDocs successfully processed

Data type: BDWF_PARAM-INPUT_OK
Optional: No
Call by Reference: No ( called with pass by value option)

PE_IDOC_RESTART -

Data type: EDI_RETRY_T
Optional: No
Call by Reference: No ( called with pass by value option)

TABLES Parameters details for IDOC_INPUT

UNPROCESSED_IDOCS - Unprocessed IDoc numbers

Data type: BDIDOCS
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_DATA - IDoc data segments (optional)

Data type: EDIDD
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_CONTROL - IDoc control records

Data type: EDIDC
Optional: No
Call by Reference: No ( called with pass by value option)

EXCEPTIONS details

IDOC_OPEN_LOCK - IDoc already locked

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_CLOSE_NOT_OPEN - IDoc not yet opened

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_CLOSE_DB_ERROR - Database error when writing data

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_CLOSE_PARAMETER_ERROR - IDoc function module incorrectly parametrisized

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_CLOSE_NO_STATUS_WRITTEN - No status written when closing

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOCS_DO_NOT_EXIST - IDocs do not exist in database

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOCS_HAVE_NO_DATA_RECORDS - IDocs have no data records in database

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

UNPROCESSED_IDOCS_EMPTY - Table Unprocessed_IDocs was transferred empty

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_OPEN_NOT_EXIST - IDoc does not exist

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_OPEN_INVALID - IDoc number invalid when opening

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_OPEN_ALREADY - IDoc open already

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_WRITE_NUMBER_INVALID - Invalid IDoc number when writing status

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_WRITE_STATUS_INVALID - Status value invalid

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_WRITE_NO_STATUS - When writing status: no status transferred

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_WRITE_LOCK -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

IDOC_WRITE_DB_ERROR -

Data type:
Optional: No
Call by Reference: No ( called with pass by value option)

Copy and paste ABAP code example for IDOC_INPUT Function Module

The ABAP code below is a full code listing to execute function module POPUP_TO_CONFIRM including all data declarations. The code uses the original data declarations rather than the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the newer method of declaring data variables on the fly. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8), which i why i have stuck to the origianl for this example.

DATA:
lv_no_of_retries  TYPE BDWF_PARAM-RETRIES, "   0
lv_idoc_open_lock  TYPE BDWF_PARAM, "   
lv_exception_value  TYPE BDWF_PARAM-EXCEPTION, "   
lt_unprocessed_idocs  TYPE STANDARD TABLE OF BDIDOCS, "   
lv_pi_partner_option  TYPE EDI_PARTNER_INBOUND_OPTION, "   
lv_idoc_close_not_open  TYPE EDI_PARTNER_INBOUND_OPTION, "   
lv_idoc_close_db_error  TYPE EDI_PARTNER_INBOUND_OPTION, "   
lv_idoc_close_parameter_error  TYPE EDI_PARTNER_INBOUND_OPTION, "   
lv_idoc_close_no_status_written  TYPE EDI_PARTNER_INBOUND_OPTION, "   
lv_idocs_do_not_exist  TYPE EDI_PARTNER_INBOUND_OPTION, "   
lv_idocs_have_no_data_records  TYPE EDI_PARTNER_INBOUND_OPTION, "   
lv_unprocessed_idocs_empty  TYPE EDI_PARTNER_INBOUND_OPTION, "   
lt_idoc_data  TYPE STANDARD TABLE OF EDIDD, "   
lv_mass_processing  TYPE BDWF_PARAM-MASS_PROC, "   
lv_idoc_open_not_exist  TYPE BDWF_PARAM, "   
lv_input_succeeded_for_all  TYPE BDWF_PARAM-INPUT_OK, "   
lt_idoc_control  TYPE STANDARD TABLE OF EDIDC, "   
lv_input_method  TYPE BDWFAP_PAR-INPUTMETHD, "   C_IN_BACKGROUND
lv_pe_idoc_restart  TYPE EDI_RETRY_T, "   
lv_idoc_open_invalid  TYPE EDI_RETRY_T, "   
lv_direct_call  TYPE BDWF_PARAM-DIRECTCALL, "   C_FALSE
lv_idoc_open_already  TYPE BDWF_PARAM, "   
lv_idoc_start_event_enabled  TYPE BDWF_PARAM-MANUALINPT, "   C_TRUE
lv_idoc_write_number_invalid  TYPE BDWF_PARAM, "   
lv_end_event_enabled  TYPE BDWF_PARAM-MANUALINPT, "   C_FALSE
lv_idoc_write_status_invalid  TYPE BDWF_PARAM, "   
lv_end_event_always  TYPE BDWF_PARAM-MANUALINPT, "   C_FALSE
lv_idoc_write_no_status  TYPE BDWF_PARAM, "   
lv_do_commit  TYPE BDFIELDS-PARALLEL, "   C_TRUE
lv_idoc_write_lock  TYPE BDFIELDS, "   
lv_process_code  TYPE EDP21-EVCODE, "   
lv_idoc_write_db_error  TYPE EDP21. "   

  CALL FUNCTION 'IDOC_INPUT'  "
    EXPORTING
         NO_OF_RETRIES = lv_no_of_retries
         PI_PARTNER_OPTION = lv_pi_partner_option
         MASS_PROCESSING = lv_mass_processing
         INPUT_METHOD = lv_input_method
         DIRECT_CALL = lv_direct_call
         IDOC_START_EVENT_ENABLED = lv_idoc_start_event_enabled
         END_EVENT_ENABLED = lv_end_event_enabled
         END_EVENT_ALWAYS = lv_end_event_always
         DO_COMMIT = lv_do_commit
         PROCESS_CODE = lv_process_code
    IMPORTING
         EXCEPTION_VALUE = lv_exception_value
         INPUT_SUCCEEDED_FOR_ALL = lv_input_succeeded_for_all
         PE_IDOC_RESTART = lv_pe_idoc_restart
    TABLES
         UNPROCESSED_IDOCS = lt_unprocessed_idocs
         IDOC_DATA = lt_idoc_data
         IDOC_CONTROL = lt_idoc_control
    EXCEPTIONS
        IDOC_OPEN_LOCK = 1
        IDOC_CLOSE_NOT_OPEN = 10
        IDOC_CLOSE_DB_ERROR = 11
        IDOC_CLOSE_PARAMETER_ERROR = 12
        IDOC_CLOSE_NO_STATUS_WRITTEN = 13
        IDOCS_DO_NOT_EXIST = 14
        IDOCS_HAVE_NO_DATA_RECORDS = 15
        UNPROCESSED_IDOCS_EMPTY = 16
        IDOC_OPEN_NOT_EXIST = 2
        IDOC_OPEN_INVALID = 3
        IDOC_OPEN_ALREADY = 4
        IDOC_WRITE_NUMBER_INVALID = 5
        IDOC_WRITE_STATUS_INVALID = 6
        IDOC_WRITE_NO_STATUS = 7
        IDOC_WRITE_LOCK = 8
        IDOC_WRITE_DB_ERROR = 9
. " IDOC_INPUT




ABAP code using 7.40 inline data declarations to call FM IDOC_INPUT

The below ABAP code uses the newer in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. Please note some of the newer syntax below, such as the @DATA is not available until 4.70 EHP 8.

"SELECT single RETRIES FROM BDWF_PARAM INTO @DATA(ld_no_of_retries).
 
 
"SELECT single EXCEPTION FROM BDWF_PARAM INTO @DATA(ld_exception_value).
 
 
 
 
 
 
 
 
 
 
 
"SELECT single MASS_PROC FROM BDWF_PARAM INTO @DATA(ld_mass_processing).
 
 
"SELECT single INPUT_OK FROM BDWF_PARAM INTO @DATA(ld_input_succeeded_for_all).
 
 
"SELECT single INPUTMETHD FROM BDWFAP_PAR INTO @DATA(ld_input_method).
DATA(ld_input_method) = C_IN_BACKGROUND.
 
 
 
"SELECT single DIRECTCALL FROM BDWF_PARAM INTO @DATA(ld_direct_call).
DATA(ld_direct_call) = C_FALSE.
 
 
"SELECT single MANUALINPT FROM BDWF_PARAM INTO @DATA(ld_idoc_start_event_enabled).
DATA(ld_idoc_start_event_enabled) = C_TRUE.
 
 
"SELECT single MANUALINPT FROM BDWF_PARAM INTO @DATA(ld_end_event_enabled).
DATA(ld_end_event_enabled) = C_FALSE.
 
 
"SELECT single MANUALINPT FROM BDWF_PARAM INTO @DATA(ld_end_event_always).
DATA(ld_end_event_always) = C_FALSE.
 
 
"SELECT single PARALLEL FROM BDFIELDS INTO @DATA(ld_do_commit).
DATA(ld_do_commit) = C_TRUE.
 
 
"SELECT single EVCODE FROM EDP21 INTO @DATA(ld_process_code).
 
 


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!