Professional Documents
Culture Documents
Processing Inbound Custom Idocs With Custom Function Modules in Sap
Processing Inbound Custom Idocs With Custom Function Modules in Sap
Processing Inbound Custom Idocs With Custom Function Modules in Sap
Return Results
Application
Document
COMMIT WORK
UNLOCK IDOCS
The Interface for the function Module is preset by SAP. The various parameters for the interface are
described below.
IMPORTING parameters.
INPUT_METHOD. Specifies the mode in which the posting program will be executed and is
valid only for call transactions.
EXPORTING parameters.
WORKFLOW_RESULT. Indicates whether the posting was successful and whether workflow
should be started.
IN_UPDATE_TASK. Indicates how you intend to perfom the update. Blank indicates the
update task was not used, while an X indicates that it was. This would delay the posting until a
commit was done.
RETURN_VARIABLES. The ALE layer will use this for workflow processing.
1. Read and verify Control Record, if message type is incorrect raise exception
3. Parse the segments and build BDC data if using call transaction, or internal tables if using
a direct input function module.
7. Return to ALE
Workflow Configuration:
Create a new IDoc application object in BOR with triggering and terminating
events(SWO1).
Create a new task based on the application object(PFTC_COP)
Create the event linkage(SWE2)
Create new IDoc packet object in BOR(SWO1).
Process Configuration:
FUNCTION Z_idoc_input_<MESSAGE>.
*"----------------------------------------------------------------------
*"*"LOCAL Interface:
*" IMPORTING
*" VALUE(INPUT_METHOD) LIKE BDWFAP_PAR-INPUTMETHD
*" VALUE(MASS_PROCESSING) LIKE BDWFAP_PAR-MASS_PROC
*" EXPORTING
*" VALUE(WORKFLOW_RESULT) LIKE BDWFAP_PAR-RESULT
*" VALUE(APPLICATION_VARIABLE) LIKE BDWFAP_PAR-APPL_VAR
*" VALUE(IN_UPDATE_TASK) LIKE BDWFAP_PAR-UPDATETASK
*" VALUE(CALL_TRANSACTION_DONE) LIKE BDWFAP_PAR-CALLTRANS
*" TABLES
*" IDOC_CONTRL STRUCTURE EDIDC
*" IDOC_DATA STRUCTURE EDIDD
*" IDOC_STATUS STRUCTURE BDIDOCSTAT
*" RETURN_VARIABLES STRUCTURE BDWFRETVAR
*" SERIALIZATION_INFO STRUCTURE BDI_SER
*" EXCEPTIONS
*" WRONG_FUNCTION_CALLED
*"----------------------------------------------------------------------
INCLUDE MBDCONWF.
*-----------------------------------------------------------------------
* PUT ANY DATABSE TABLE DELCARATIONS HERE
*-----------------------------------------------------------------------
TABLES: TTTTT.
*-----------------------------------------------------------------------
* DATA DELCARATIONS and INTERNAL TABLES
*-----------------------------------------------------------------------
DATA: I_TAB.
*-----------------------------------------------------------------------
* Program Logic
*-----------------------------------------------------------------------
*
*Initialize workflow result
*
WORKFLOW_RESULT = C_WF_RESULT_OK.
LOOP AT IDOC_CONTRL.
CASE IDOC_DATA-SEGNAM.
WHEN ZZZZZZ.
<Build BDC_DATA>
WHEN ZZZZZZ.
<Build BDC_DATA>
ENDCASE.
ENDLOOP.
CASE SY-SUBRC.
WHEN 0.
RETURN_VARIABLES-WF_PARAM = Processed_IDOCs.
RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
APPEND RETURN_VARIABLES.
RETURN_VARIABLES-WF_PARAM = Appl_Objects.
RETURN_VARIABLES-DOC_NUMBER = <Number of document just created>.
APPEND RETURN_VARIABLES.
WHEN OTHERS.
WORKFLOW_RESULT = C_WF_RESULT_ERROR.
RETURN_VARIABLES-WF_PARAM = Error_IDOCs.
RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
APPEND RETURN_VARIABLES.
.
ENDCASE.
ENDLOOP.
ENDFUNCTION.