48
IDOC Step-by-Step. INBOUND process Continue from outbound process... In Client 812 Steps: Function Module Creation: Create a Function Module to update the table from the IDOC segments Go to SE37 Specif a name and clic! on create" Specif the Import parameters in Import tab Specif the E#port parameters in E#port tab Specif the $able parameters in $ables tab Specif the E#ceptions in E#ception tab Clic! on Source code $ab" ====================================================  FUNCTION ZIDOC_ZDEMO_MATEIAL. *"---------------------------------------------------------------------- *"*"Local Interface: Detail for i!ortin#$ e%ortin#$ ta&le$ e%cetion *" IM'O(TIN) *" (EFE(ENCEIN'UT_MET+OD, LIE D/FA'_'A(-IN'UTMET+D *" (EFE(ENCEMA00_'(OCE00IN), LIE D/FA'_'A(-MA00_'(OC *" E1'O(TIN) *" (EFE(ENCE/O(FLO/_(E0ULT, LIE D/F_'A(AM-(E0ULT *" (EFE(ENCEA''LICATION_2A(I ALE, LIE D/F_'A(AM-A''L_2A( *" (EFE(ENCEIN_U'DATE_TA0, LIE D/FA'_'A(-U'DATETA0

IDOC Steps in Out Process

Embed Size (px)

DESCRIPTION

idoc outbound

Citation preview

IDOC Step-by-Step

IDOC Step-by-Step. INBOUND process

Continue from outbound process...In Client 812 Steps: Function Module Creation:Create a Function Module to update the table from the IDOC segmentsGo to SE37Specify 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 constantsINCLUDE 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 bufferLOOP 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 WE57Click on Display / Change button. Click on New Entries

Define Input Method for Inbound Function Module:Go to TCODE BD51Click on Display / Change buttonClick on New Entries

Creating Process Code:Go to TCODE WE42Click 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.

IDOC Step-by-Step. OUTBOUND process

TO Process IDOCS the following TCODES will be used.

On both sides:

Logical System Names SALE

Setup RFC destinations SM59

Port Destinations WE21

In Source system:Segment Creation WE31

Basic IDOC Type Creation WE30

Message Type Creation WE81

Assign Message Type To Basic IDOC Type WE82

Distribution Model BD64

Writing Report Program SE38

Partner Profile WE20

Message control NACE

Check IDOCs WE02, WE05

In Destination System:Creating FM SE37

Assign FM to Logical Message WE57

Define I/P method for Inbound FM BD51

Create Process Code WE42

Generate Partner Profile BD64.

--------------------------------------------------------------------------------

Note:Different clients but same server.Creating the Logical System Names and Assigning to Clients:created on client 800.

created on client 812.

Creating the RFC Connection Names:create RFC in SM59 for both clients 800 and 812.

Creating RFC ports:Go to TCODE WE21.create in 800 and RFC destination which was created in 812...EC3812

create in 812 and RFC destination which was created in 800...EC3

Creating table structure: Go to TCODE SE11.

Specify table name as zdemo_material.( in client 800 EC3)

Creating IDOC Segments:Go to TCODE WE31.Specify a name and Click on Create Button.

Creating Basic IDOC Type:Go to TCODE WE30Specify a name to your IDOC and click on create button.after creating NOTE: Go to menu EDIT->Click Set Release

Creating Message Type:Go to TCODE WE81.Click on Display / Change button.

Assign Message Type to Basic IDOC Type:Go to TCODE WE82Click on Display / Change Button

Creating Model View and Distributing and Generating Partner profile:Go to TCODE BD64Click on Display/ Change button Click on Edit menu -> Model View -> CreateSpecify description of model view and technical name in dialog box and press continue. Select your model view and click on Edit menu -> Add Message type In dialog box specify the sender, receiver, message type and click on continue.

Click on Environment Menu -> Generate Partner profile It will show the following screen, click on execute.

Note: Dont create in client 812, because we are using the same server. It will be automatically created in the client 812. check bd64 in client 812.Click on Back button 2 times, it will take back to Distribution Model screen.Click on Edit Menu -> Model View -> Distribute.

MODEL VIEW Created.

check partner profileGo to TCODE WE20In displayed screen select the partner system in left side tree under Partner Type LS.

Write a Report Program in SE38 To create IDOC control records and transfer it to destination partner system.====================================================REPORT ZDEMO_IDOCSEND.

TABLES: zdemo_material.

DATA : S_CTRL_REC LIKE EDIDC, "Idoc Control RecordS_ZSEGMENT LIKE ZSEGMENT. "CUSTOMER Header Data

DATA : T_zdemo_material LIKE zdemo_material OCCURS 0 WITH HEADER LINE.

DATA : T_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE. "Data RecordsDATA : T_COMM_IDOC LIKE EDIDC OCCURS 0 WITH HEADER LINE. "Generated Communication IDOc

CONSTANTS :C_ZSHSTUSEG LIKE EDIDD-SEGNAM VALUE 'ZSEGMENT'.CONSTANTS: C_IDOCTP LIKE EDIDC-IDOCTP VALUE 'ZSTUDENTIDOC'.*** Selection ScreenSELECT-OPTIONS : S_BUKRS FOR zdemo_material-BUKRS OBLIGATORY.PARAMETERS : C_MESTYP LIKE EDIDC-MESTYP DEFAULT 'ZCLIENTMSG', "Message TypeC_RCVPRT LIKE EDIDC-RCVPRT DEFAULT 'LS', "Partner type of receiverC_LOGSYS LIKE EDIDC-RCVPRN DEFAULT 'EC3812'.* C_RCVPOR LIKE EDIDC-RCVPOR DEFAULT 'A000000018',* C_SNDPRN LIKE EDIDC-SNDPRN DEFAULT 'EC3',* C_SNDPRT LIKE EDIDC-SNDPRT DEFAULT 'LS'. "Destination SystemDATA ZSEGMENT.

***START-OF-SELECTIONSTART-OF-SELECTION.PERFORM GENERATE_DATA_RECORDS.PERFORM GENERATE_CONTROL_RECORD.PERFORM SEND_IDOC.*&---------------------------------------------------------------------**& Form GENERATE_DATA_RECORDS*&---------------------------------------------------------------------** text*----------------------------------------------------------------------** --> p1 text* p1 text*