IDOC Step-by-Step INBOUND process - Sap 4 All

Latest

Please enter your email and get the updates in your inbox.

Saturday, 28 May 2016

IDOC Step-by-Step INBOUND process




In Client 812 Steps:
Function Module Creation:
Create a Function Module to update the table from the IDOC segments
Go to SE37
Specify a name and click on create.


Specify the Import parameters in Import tab

Specify the Export parameters in Export tab

Specify the Table parameters in Tables tab

Specify the Exceptions in Exception tab

Click on Source code Tab.

====================================================
 FUNCTION ZIDOC_ZDEMO_MATEIAL.
*"---------------------------------------------------------------------- *"*"Local Interface: Details for importing, exporting, tables, exceptions
*"  IMPORTING
*"     REFERENCE(INPUT_METHOD) LIKE  BDWFAP_PAR-INPUTMETHD
*"     REFERENCE(MASS_PROCESSING) LIKE  BDWFAP_PAR-MASS_PROC
*"  EXPORTING
*"     REFERENCE(WORKFLOW_RESULT) LIKE  BDWF_PARAM-RESULT
*"     REFERENCE(APPLICATION_VARIABLE) LIKE  BDWF_PARAM-APPL_VAR
*"     REFERENCE(IN_UPDATE_TASK) LIKE  BDWFAP_PAR-UPDATETASK
*"     REFERENCE(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 File containing ALE constants
INCLUDE MBDCONWF.

TABLES : zdemo_material.

DATA : W_ZSEGMENT LIKE ZSEGMENT.

DATA : T_zdemo_material LIKE zdemo_material OCCURS 0 WITH HEADER LINE.
WORKFLOW_RESULT = C_WF_RESULT_OK.

LOOP AT IDOC_CONTRL.
IF IDOC_CONTRL-MESTYP NE 'ZCLIENTMSG'.
RAISE WRONG_FUNCTION_CALLED.
ENDIF.

*  Before reading a new entry, clear application buffer
LOOP AT IDOC_DATA WHERE DOCNUM EQ IDOC_CONTRL-DOCNUM.
W_ZSEGMENT = IDOC_DATA-SDATA.
MOVE-CORRESPONDING W_ZSEGMENT TO T_zdemo_material.
INSERT INTO zdemo_material VALUES T_zdemo_material.
ENDLOOP.

UPDATE zdemo_material FROM T_zdemo_material.

IF SY-SUBRC EQ 0.
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IDOC_STATUS-STATUS = '53'.
IDOC_STATUS-MSGTY = 'I'.
IDOC_STATUS-MSGID = 'YM'.
IDOC_STATUS-MSGNO = '004'.
IDOC_STATUS-MSGV1 = T_zdemo_material-MANDT.
APPEND IDOC_STATUS.
CLEAR IDOC_STATUS.
ELSE.
IDOC_STATUS-DOCNUM = IDOC_CONTRL-DOCNUM.
IDOC_STATUS-STATUS = '51'.
IDOC_STATUS-MSGTY = 'E'.
IDOC_STATUS-MSGID = 'YM'.
IDOC_STATUS-MSGNO = '005'.
IDOC_STATUS-MSGV1 = T_zdemo_material-MANDT.
APPEND IDOC_STATUS.
CLEAR IDOC_STATUS.

WORKFLOW_RESULT = C_WF_RESULT_ERROR.
RETURN_VARIABLES-WF_PARAM = 'Error_Idocs'.
RETURN_VARIABLES-DOC_NUMBER = IDOC_CONTRL-DOCNUM.
APPEND RETURN_VARIABLES.
CLEAR RETURN_VARIABLES.
ENDIF.
ENDLOOP.
ENDFUNCTION.

====================================================



Assign FM to Logical Message:

Go to TCODE WE57
Click on Display / Change button.
Click on New Entries


Define Input Method for Inbound Function Module:

Go to TCODE BD51
Click on Display / Change button
Click on New Entries


Creating Process Code:

Go to TCODE WE42
Click on Display / Change Button
Click on New Entries

It will take to you previous screen. Double Click on Logical Message in left side tree.

Click on Display / Change button

Click on New Entries button


Generating the Partner Profile:

Go to TCODE BD64.
Select the Model View which you distributed in client 812.
Click on Environment Menu -> Generate Partner Profile .Execute.

check the partner profile details.

Go to TCODE WE20. Select the partner system name.


Transferring the IDOC control records from Client 800 to 812:

In source system, go to TCODE SE38. (In client 800)

Execute the Report program which you created.
Check in Destination System: (Here client 800)
Go to TCODE WE02




Check in Destination System: (Here client 812)

Go to TCODE WE02



Check in ZDEMO_MATERIAL table in SE11.

Done!..


====================================================



Took Reference from the link given below:

4 comments:

  1. Send me the subcontracting process material sir...

    ReplyDelete
  2. hi vishal ,
    after sending idoc from 800 (source ) , how we will receive , i mean how FM gets executed ?

    ReplyDelete
  3. Thanks for sharing this Information,

    Got to learn new things from your Blog on Sap abap.

    http://thecreatingexperts.com/sap-abap-training-in-chennai/

    Both online and classroom training is provided.

    Contact 8122241286

    ReplyDelete