36
Page | 1 IDOC – I ntermediate DOC ument SYNOPSIS 1. Difference Between EDI and IDOC ---------------------------------------------------- Page - 3 2. IDOC --------------------------------------------------------------------------------------------- Page - 4 3. IDOC STRUCTURE – In Detail ---------------------------------------------------------- Page - 6 CONTROL RECORD -------------------------------------------------------------------- Page - 6 DATA RECORD -------------------------------------------------------------------------- Page - 6 STATUS RECORD ------------------------------------------------------------------------ Page - 9 4. FINAL OUTPUT OF AN IDOC ----------------------------------------------------------- Page - 12 5. IDOC COMPONENTS ---------------------------------------------------------------------- Page - 13 6. CREATE AN IDOC – Basis Concept ---------------------------------------------------- Page - 13 STEP 1 – IDOC STRUCTURE ---------------------------------------------------------- Page - 14 Create SEGEMENTS ----------------------------------------------------------------- Page - 14 Basic IDOC Type --------------------------------------------------------------------- Page - 14 Message Type ------------------------------------------------------------------------- Page - 15 Assign Message type to Basic type ---------------------------------------------- Page - 15 Step 2 – OUTBOUND SETTINGS ---------------------------------------------------- Page - 15 Define Logical System--------------------------------------------------------------- Page - 16 Maintain RFC Destination --------------------------------------------------------- Page - 16 Define Ports --------------------------------------------------------------------------- Page - 16 Maintain Distributed Model ------------------------------------------------------ Page - 16 Generate Partner Profile ----------------------------------------------------------- Page - 16 Distribute Model View ------------------------------------------------------------- Page - 17 Step 3 – INBOUND SETTINGS ------------------------------------------------------- Page - 17 Define Logical System -------------------------------------------------------------- Page - 17 Maintain RFC Destination --------------------------------------------------------- Page - 18 Define Ports --------------------------------------------------------------------------- Page - 18 Maintain Distributed Model ------------------------------------------------------ Page - 18 Generate Partner Profile ----------------------------------------------------------- Page - 18 Distribute Model View ------------------------------------------------------------- Page - 18 Assign Function Module to Logical message -------------------------------- Page - 18 Define Input method for Inbound Function Module ----------------------- Page - 19 Create a Process Code ------------------------------------------------------------- Page - 19

Idoc

Embed Size (px)

DESCRIPTION

Idoc_sd

Citation preview

P a g e | 1

IDOC – I ntermediate DOC ument

SYNOPSIS

1. Difference Between EDI and IDOC ---------------------------------------------------- Page - 3

2. IDOC --------------------------------------------------------------------------------------------- Page - 4

3. IDOC STRUCTURE – In Detail ---------------------------------------------------------- Page - 6• CONTROL RECORD -------------------------------------------------------------------- Page - 6• DATA RECORD -------------------------------------------------------------------------- Page - 6• STATUS RECORD ------------------------------------------------------------------------ Page - 9

4. FINAL OUTPUT OF AN IDOC ----------------------------------------------------------- Page - 12

5. IDOC COMPONENTS ---------------------------------------------------------------------- Page - 13

6. CREATE AN IDOC – Basis Concept ---------------------------------------------------- Page - 13

• STEP 1 – IDOC STRUCTURE ---------------------------------------------------------- Page - 14○ Create SEGEMENTS ----------------------------------------------------------------- Page - 14○ Basic IDOC Type --------------------------------------------------------------------- Page - 14○ Message Type ------------------------------------------------------------------------- Page - 15○ Assign Message type to Basic type ---------------------------------------------- Page - 15

• Step 2 – OUTBOUND SETTINGS ---------------------------------------------------- Page - 15○ Define Logical System--------------------------------------------------------------- Page - 16○ Maintain RFC Destination --------------------------------------------------------- Page - 16○ Define Ports --------------------------------------------------------------------------- Page - 16○ Maintain Distributed Model ------------------------------------------------------ Page - 16○ Generate Partner Profile ----------------------------------------------------------- Page - 16○ Distribute Model View ------------------------------------------------------------- Page - 17

• Step 3 – INBOUND SETTINGS ------------------------------------------------------- Page - 17○ Define Logical System -------------------------------------------------------------- Page - 17○ Maintain RFC Destination --------------------------------------------------------- Page - 18○ Define Ports --------------------------------------------------------------------------- Page - 18○ Maintain Distributed Model ------------------------------------------------------ Page - 18○ Generate Partner Profile ----------------------------------------------------------- Page - 18○ Distribute Model View ------------------------------------------------------------- Page - 18○ Assign Function Module to Logical message -------------------------------- Page - 18○ Define Input method for Inbound Function Module ----------------------- Page - 19○ Create a Process Code ------------------------------------------------------------- Page - 19

P a g e | 2

• SEND AND RECEIVE DATA --------------------------------------------------------- Page - 19

7. EXAMPLE: TO CREATE AN IDOC ---------------------------------------------------- Page – 20• STEP 1 – IDOC STRUCTURE ---------------------------------------------------------- Page - 21• Step 2 – OUTBOUND SETTINGS ---------------------------------------------------- Page - 23• Step 3 – INBOUND SETTINGS ------------------------------------------------------- Page - 26• SEND AND RECEIVE DATA --------------------------------------------------------- Page - 29

8. IDOC to FLAT FILE -------------------------------------------------------------------------- Page – 30

9. USE FULL T-CODE -------------------------------------------------------------------------- Page - 37

P a g e | 3

DIFFERENCE BETWEEN EDI AND IDOC:

EDI is nothing but Electronic data interchange. SAP will support EDI through Intermediate documents (IDOCS).

EDI (Electronic Document interchange) - EDI is the electronic exchange of business documents between the computer systems of business partners, using a standard format over a communication network.

EDI is also called paperless exchange.

Advantages: • Reduced Data entry errors • Reduced processing time • Availability of data in electronic form • Reduced paperwork • Reduced Cost • Reduced inventories and better planning • Standard means of communications • Better business process

EDI has two processes 1. Outbound process 2. Inbound process

Outbound Process: • Application document is created. • IDOC is generated • IDoc is transferred from SAP to Operating system layer • Idoc is converted into EDI standards • Edi document is transmitted to the business partner • The Edi Subsystem report status to SAP

Inbound Process: • EDI transmission received • EDI document is converted into an IDOC • IDOC is transferred to the SAP layer • The application document is created • The application document can be viewed.

IDOC:

P a g e | 4

IDoc (for intermediate document) is a standard data structure for electronic data interchange (EDI) between application programs written for the popular SAP business system or between an SAP application and an external program.

IDoc serve as the vehicle for data transfer in SAP's Application Link Enabling (ALE) system.

IDOC is a container/envelope that can be used to exchange data between any two Systems.

Each IDoc is assigned a unique number for tracking and future reference. IDoc Consist of several segments and segments contain several fields.

IDoc contains the following three types of records as shown in FIG. 1 & FIG. 2

• CONTROL RECORD

• DATA RECORD

• STATUS RECORD

FIG. 1 : IDOC Structure

P a g e | 5

FIG 2 : Three types of records in IDOC . (WE02 – Date – F8 – Double Click on IDOC Number)

An IDoc encapsulates data so that it can be exchanged between different systems without conversion from one format to another.

IDoc types define different categories of data, such as purchase orders or invoices, which may then be broken down into more specific categories called message types. Greater specificity means that an IDoc type is capable of storing only the data required for a particular transaction, which increases efficiency and decreases resource demands.

The IDoc is transmitted to the receiver, which may be an R/3, R/2, or some external system.

IDOC STRUCTURE – In Detail

1. CONTROL RECORD

P a g e | 6

It contains the key information like destination, IDoc type, message type, port and sender information as shown in FIG. 3

Technical Name Description Value

EDIDC Control RecordDIRECT Direction 2 : InboundDOCREL Release 620STATUS Status 53 :Application document postedIDOCTYP Basic Type 53 :Purchasing/SalesCIMTYP Enhancement 53:00:00MESTYP Message Type ORDRSPMESCOD Message VariantMESFCT Message FunctionCREDAT Created On 20030717CRETIM Created At 134133SNDPOR Sender Port SAPDM8SNDPRT Sender Partn. Type LSSNDPRN Sender Partner Number SUS_00_805RCVPOR Receiver Port SAPID3RCVPRT Receiver Partner Type LSRVCPRN Receiver Partner Number T90CLNT090STD EDI StandardSTDVRS EDI VersionSTDMES EDI Message Type

FIG. 3: Control Record details in a Flat File.

2. DATA RECORD:

This contains two parts Administrative Section and Data Section as shown in FIG. 4

Administrative Section consists of Idoc number, Segment Name, Segment number, Version, Segment Hierarchy etc.

Data Section contains the data of respective segment . EDIDD Data RecordsSEGNUM Segment Number 1SEGNAM Segment Name E1EDK01ACTION Action code for the whole EDI 004 : Changes in header and items

P a g e | 7

CURCY Currency USDSEGNUM Segment Number 2SEGNAM Segment Name E1EDK03

IDDATQualifier for IDOC date segment 12

DATUM IDOC: Date 20030717UZEIT IDOC: Time 134132SEGNUM Segment Number 3SEGNAM Segment Name E1EDKA1PARVW Partner function (e.g. sold-to LF : VendorPARTN Partner number 5595NAME1 Name 1 IDES SUS VendorORT01 City ATLANTAPSTLZ Postal code 30345LAND1 Country Key USSEGNUM Segment Number 4SEGNAM Segment Name E1EDKA1PARVW Partner function (e.g. sold-to AG : Sold-to partyPARTN Partner number 3000NAME1 Name 1 IDES US INCSTRAS Street and house number 1 1230 Lincoln AvenueORT01 City New YorkPSTLZ Postal code 10019LAND1 Country Key US

FIG. 4: Data Record details in a Flat File.

In FIG.4, b old item are the data and rest are the Idoc number, Segment Name, Segment number, Version, Segment Hierarchy

Now, FIG.5 will clear the Segment Hierarchy

P a g e | 8

FIG.5: Segment’s Hierarchy ( WE30 - Obj. Name: ORDERS02 )

P a g e | 9

FIG.5: Segment’s Hierarchy (WE02 – Date – F8 – Double Click on IDOC Number – Open Data Record)

3. STATUS RECORD:

Whenever a process is taken place, system will generate status records. We can identify the process with the number of status record as shown in FIG. 6.

01 - 49 for Outbound Process50 - 75 for Inbound Process

When IDoc is processed the messages are:

01 - IDoc is created 30 - IDoc is ready for dispatch

P a g e | 10

03 - IDoc is processed

EDIDS Status RecordsEDIDS Status Record Number 1STATUS Status Value 50 : IDoc addedLOGDAT Logged On 20030717LOGTIM Logged At 134133CREDAT Database Changed On 20030717CRETIM Database Changed At 134133UNAME Last Processed By IDES_RFCREPID Status set by programROUTID Status set by programEDIDS Status Record Number 2

STATUS Status Value64 : IDoc ready to be transferred to application

STAMQU/STAMID/STAMNO Status Code SAPB1005STATXT Message & &, &, &.STAPA2 Parameter2 No filtersSTAPA3 Parameter3 No conversionSTAPA4 Parameter4 No version changeLOGDAT Logged On 20030717LOGTIM Logged At 134133CREDAT Database Changed On 20030717CRETIM Database Changed At 134133UNAME Last Processed By IDES_RFCREPID Status set by program SAPLEDIRROUTID Status set by program IDOC_STATUS_64OR65_SETEDIDS Status Record Number 3STATUS Status Value 62 : IDoc passed to applicationSTAMQU/STAMID/STAMNO Status Code SAPB1042STATXT Message Direct call startedLOGDAT Logged On 20030717LOGTIM Logged At 134133CREDAT Database Changed On 20030717CRETIM Database Changed At 134135UNAME Last Processed By IDES_RFCREPID Status set by program SAPLBD20ROUTID Status set by programEDIDS Status Record Number 4STATUS Status Value 53 : Application document postedSTAMQU/STAMID/STAM Status Code SAPME769

P a g e | 11

NO

STATXT MessagePurchasing document & successfully processed

STAPA1 Parameter1 4500015401LOGDAT Logged On 20030717LOGTIM Logged At 134133CREDAT Database Changed On 20030717CRETIM Database Changed At 134135UNAME Last Processed By IDES_RFCREPID Status set by program SAPLEINMROUTID Status set by program MAINTAIN_DATA_ORDRSP

FIG. 6: Status Record Details in a Flat File.

P a g e | 12

FINAL OUTPUT OF AN IDOC:

FIG. 7 is the actual spool output of an IDOC. This is a Purchase Order for particular company which contains, vendor’s Details, PO Number, their date, Contact detail, Payment terms & Full details of an Item.

FIG. 7 : Final spool output of an Idoc. (ME23N – Shift + F5 – PO Number – Shift + F8)

P a g e | 13

IDOC COMPONENTS

There are basically two types of IDOCs

Basic Idoc Basic IDOC type defines the structure and format of the business document that is to be exchanged between two systems.

Extension Idoc Extending the functionality by adding more segments to existing Basic IDOCs.

CREATE AN IDOC – Basis Concept

There are 3 basic steps by which you can create your own IDOC as shown in FIG. 8. You need to follow all these steps properly on your systems.

Idoc Structure

OutBound Settings

InBound Settings IDOC

STEP 1 STEP2 STEP3 FINAL OUTPUT

Outbound Settings:

Define Logical SystemMaintain RFC DestinationDefine PortsMaintain Distributed modelGenerate Partner ProfileDistribute Model view

Outbound IDOC Generation Program

Inbound IDOC Posting Function Module

Inbound Settings:

Define Logical SystemClient – Logical SystemMaintain RFC DestinationDefine PortsGenerate Partner ProfileAssign Function Module – Logical

MessageDefine Input Method for inbound

function ModuleCreate Process Code

Send & Receive Data

Create –

Segments Basic Type Message Type Assign Message

type to Basic Type

P a g e | 14

FIG. 8: Steps to create an IDOC. NOTE: Each step will be divided in to sub steps.

STEP 1

Create –

Segments Basic Type Message Type Assign Message type to

Basic Type

Idoc Structure

1.1. Create SEGEMENTS• Go to transaction code WE31• Enter the name for your segment type and click on the Create icon• Type the short text• Enter the Field names and data elements• Save it and go back• Go to Edit -> Set Release

Follow steps to create more number of segments

1.2. Basic IDOC Type• Go to transaction code WE30.• Enter the Object Name, select Basic type and click Create icon.• Select the create new option and enter a description for your basic IDOC type and press

enter.• The system prompts us to enter a segment type and its attributes.• Choose the appropriate values and press Enter.• Save it and go back.

P a g e | 15

• Go to Edit -> Set release.

1.3. Message Type• Go to transaction code WE81• Change the details from Display mode to Change mode• After selection, the system will give this message “The table is cross-client (see Help for

further info)”. Press Enter• Click New Entries to create new Message Type• Fill details• Save it and go back

1.4. Assign Message type to Basic type• Go to transaction code WE82• Change the details from Display mode to Change mode• After selection, the system will give this message “The table is cross-client (see Help for

further info)”. Press Enter• Click New Entries to create new Message Type• Fill details• Save it and go back

STEP 2

OutBound Settings

• Outbound Settings:

Define Logical System Maintain RFC Destination Define Ports Maintain Distributed model Generate Partner Profile Distribute Model view

• Outbound IDOC Generation Program

P a g e | 16

2.1 Define Logical System• T-Code: SALE• Go to Define Logical System • Define a new logical system to identify the local system and save it • Now, go to Assign Client to Logical System• Add a new entry • Specify the client, previously created logical system and other attributes • Save the entry • Define a new logical system to identify the partner system and save it• Specify the new client, to newly created Logical System & save it

2.2 Maintain RFC Destination• T-Code : SM59• Create 1 RFC destination for R/3 type connection • Specify the target host on Technical settings tab • Provide the Logon credentials on the Logon/Security tab • Save the settings • To verify the settings, Click on Test connection or Remote logon• Create 2 RFC Connection for second Logical System & specify their details.

2.3 Define Ports• T-Code: WE21• We need to define a tRFC port for the partner system • Click on Transactional RFC node • Create a new port • Provide a description • Specify the name of the target RFC destination • Save the object

2.4 Maintain Distributed Model• T-Code BD64• Click on Change • Create a new model view • Provide a Short text and Technical name to the model view • Add message type • Specify sender and receiver systems • Also, specify the message type that we created previously • Save the Distribution model

2.5 Generate Partner Profile• BD82 • Specify the model view, target system and execute • The result log will be displayed on the next screen

P a g e | 17

• To verify the partner profile go to WE20 • Check the partner profile for the target system

2.6 Distribute Model View• T-Code: BD64• Select the Model View • Go to menu path Edit -> Model View -> Distribute • Result log will be displayed on the next screen

STEP 3

InBound Settings

• Inbound IDOC Posting Function Module

• Inbound Settings: Define Logical System Client – Logical System Maintain RFC Destination

Define Ports Generate Partner Profile Assign Function Module – Logical Message Define Input Method for inbound function

Module Create Process Code• Send & Receive Data

3.1 Define Logical System• T-Code: SALE• Go to Define Logical System • Define a new logical system to identify the local system and save it • Now, go to Assign Client to Logical System• Add a new entry • Specify the client, previously created logical system and other attributes • Save the entry • Define a new logical system to identify the partner system and save it

P a g e | 18

• Specify the new client, to newly created Logical System & save it

3.2 Maintain RFC Destination• T-Code : SM59• Create 1 RFC destination for R/3 type connection • Specify the target host on Technical settings tab • Provide the Logon credentials on the Logon/Security tab • Save the settings • To verify the settings, Click on Test connection or Remote logon• Create 2 RFC Connection for second Logical System & specify their details.

3.3 Define Ports• T-Code: WE21• We need to define a tRFC port for the partner system • Click on Transactional RFC node • Create a new port • Provide a description • Specify the name of the target RFC destination • Save the object

3 .4 Maintain Distributed Model • T-Code BD64• Click on Change • Create a new model view • Provide a Short text and Technical name to the model view • Add message type • Specify sender and receiver systems • Also, specify the message type that we created previously • Save the Distribution model

3 .5 Generate Partner Profile • BD82 • Specify the model view, target system and execute • The result log will be displayed on the next screen • To verify the partner profile go to WE20 • Check the partner profile for the target system

3 .6 Distribute Model View • T-Code: BD64• Select the Model View • Go to menu path Edit -> Model View -> Distribute • Result log will be displayed on the next screen

3.7 Assign Function Module to Logical message

P a g e | 19

• Transaction WE57 • Create a new entry • Specify name of the Function Module • Also, specify Type as F, Basic IDoc type, Message type and Direction as 2 (Inbound) • Save the entry

3.8 Define Input method for Inbound Function Module • Transaction BD51 • Create a new entry • Provide Function Module name • Specify the Input method as 2 • Save the entry

3.9 Create a Process Code • Transaction WE42 • Create a new Process Code • Select Processing with ALE Service • Choose Processing type as Processing by function module • Save the entry • On the next screen, select your function module from the list • Save the changes • Now you will be taken to the next screen • Double-click on Logical message • In the Assignment to logical message, specify the message type • Save the changes

SEND AND RECEIVE DATA

On the sender system, execute the IDoc Generation Program. Check the status of IDoc using transaction WE02.

Check the status of the IDoc in the receiver system using transaction WE02. You can also check the contents of DDic tables to make sure that the records have been created in the receiver system.

P a g e | 20

EXAMPLE: TO CREATE AN IDOC

The Scenario is

Data from custom tables (created in customer namespace) is to be formatted into an IDoc and sent from one SAP R/3 system to another using ALE service.

We need to have two instances of SAP R/3 systems or we can simulate this on two clients of the same SAP R/3 system.

Create three tables as shown below.

P a g e | 21

FIG. 9

Create –

Segments Basic Type Message Type Assign Message type to

Basic Type

Idoc Structure

All the objects created should be present on both source as well as target system(s).

1.1. Create SEGEMENTS ( ZRZSEG1 , ZRZSEG2 & ZRZSEG3 ) • Go to transaction code WE31• Enter the name for your segment type ZRZSEG1 to hold all fields of table

ZCUSTOMERS and click on the Create icon

P a g e | 22

• Type the short text• Enter the Field names and data elements (refer FIG. 9)• Save it and go back• Go to Edit -> Set Release

Follow all these steps to create more number of segments

• Seg. ZRZSEG2 – to hold all fields of table ZSOHEADERS • Seg. ZRZSEG3 – to hold all fields of table ZSOITEMS

1.2. Basic IDOC Type ( ZRZORDER)• Go to transaction code WE30.• Enter the Object Name ZRZORDER and click Create icon.• Select the create new option and enter a description for your basic IDOC type and press

enter.• The system prompts us to enter a segment type and its attributes.• Choose the appropriate values and press Enter.• Save it and go back.• Go to Edit -> Set release.

1.3. Message Type ( ZRZSO_MT)• Go to transaction code WE81• Change the details from Display mode to Change mode• After selection, the system will give this message “The table is cross-client (see Help for

further info)”. Press Enter• Click New Entries to create new Message Type ZRZSO_MT• Fill details

P a g e | 23

• Save it and go back

1.4. Assign Message type to Basic type• Go to transaction code WE82• Change the details from Display mode to Change mode• After selection, the system will give this message “The table is cross-client (see Help for

further info)”. Press Enter• Click New Entries • Fill details Message Type ZRZSO_MT, Basic Type ZRZORDER & current Release• Save it and go back

Thus we have defined the IDoc structure which will hold the data to be transferred.

OutBound Settings

• Outbound Settings:

Define Logical System Maintain RFC Destination Define Ports Maintain Distributed model Generate Partner Profile Distribute Model view

• Outbound IDOC Generation Program

2.1 Define Logical System ( Sender: Any NAME , Receiver: Any Name )

FIG: 10• T-Code: SALE• Go to Define Logical

System • Define a new logical

system to identify the local system(Sender) refer FIG. 10 and save it

P a g e | 24

• Now, go to Assign Client to Logical System• Add a new entry • Specify the client, previously created logical system and other attributes • Save the entry • Define a new logical system to identify the partner system (Partner) and save it• Specify the new client, to newly created Logical System & save it

2.2 Maintain RFC Destination ( Should be same as Logical System ) • T-Code : SM59• Create 1 RFC destination (Logical System : Sender) for R/3 type connection • Specify the target host on Technical settings tab • Provide the Logon credentials on the Logon/Security tab • Save the settings • To verify the settings, Click on Test connection or Remote logon• Create 2 RFC Connection for second Logical System: Receiver & specify their details.

2.3 Define Ports (Let system choose the name)

We need to define a tRFC port for the partner system

• T-Code: WE21• Click on Transactional RFC node • Create a new port • Provide a description • Specify the name of the target RFC destination • Save the object

2.4 Maintain Distributed Model• T-Code BD64• Click on Change • Create a new model view • Provide a Short text and Technical name to the model view • Add message type ZRZSO_MT• Specify sender (Logical System 1) and receiver systems (Logical System 2)• Also, specify the message type ZRZSO_MT that we created previously • Save the Distribution model

2.5 Generate Partner Profile• BD82 • Specify the model view, target system (Logical System 2) and execute • The result log will be displayed on the next screen • To verify the partner profile go to WE20 • Check the partner profile for the target system

2.6 Distribute Model View• T-Code: BD64

P a g e | 25

• Select the Model View • Go to menu path Edit -> Model View -> Distribute • Result log will be displayed on the next screen

OUTBOUND IDOC GENERATION PROGRAM

Create an executable program ZRZ_ORDER_IDOC in SE38. Below, I have described the program logic:

• Fetch the data from the DDic tables ZCUSTOMERS, ZSOHEADERS and ZSOITEMS as per the selection criteria

• Fill the control record structure of type EDIDC

○ Specify message type, Basic IDoc type, tRFC Port, Partner number and Partner type of the receiver

• Fill the data records

○ Define structures like the IDoc segments

○ Fill the structures with fetched data

○ Pass the segment name and the above structure to the appropriate fields of EDIDD type structure

○ Append the EDIDD structure to the EDIDD type internal table

• Now, call the function module MASTER_IDOC_DISTRIBUTE and pass the IDoc control record structure and data record table

• Commit work if return code is zero

• Function module returns a table of type EDIDC to provide the details about generated IDoc

• Display appropriate log

You can download sample code for the above program here.

Thus we have completed sender side configuration required for ALE.

P a g e | 26

InBound Settings

• Inbound IDOC Posting Function Module

• Inbound Settings: Define Logical System Client – Logical System Maintain RFC Destination

Define Ports Generate Partner Profile Assign Function Module – Logical Message Define Input Method for inbound function

Module Create Process Code• Send & Receive Data

INBOUND IDOC POSTING FUNCTION MODULE

In the receiving system, create a function module Z_IDOC_INPUT_ZRZSO_MT using SE37. Below, I have described the logic for the same.

Add Include MBDCONWF. This include contains predefined ALE constants.Loop at EDIDC table

• Check if the message type is ZRZORDER. Otherwise raise WRONG_FUNCTION_CALLED exception

• Loop at EDIDD table

○ Append data from the segments to appropriate internal tables

○ For example: append data from ZRZSEG1 segment to the internal table of type ZCUSTOMERS

• Update the DDic tables from internal tables

• Depending on the result of the update, fill the IDoc status record (type BDIDOCSTAT) and append it to the corresponding table.

○ Status 53 => Success

○ Status 51 => Error

You can download the sample ABAP code for the above function module here.

P a g e | 27

3 .1 Define Logical System ( Sender: Any NAME , Receiver: Any Name )

FIG: 10

• T-Code: SALE• Go to Define Logical System • Define a new logical system to identify the local system(Sender) refer FIG. 10 and save it • Now, go to Assign Client to Logical System• Add a new entry • Specify the client, previously created logical system and other attributes • Save the entry • Define a new logical system to identify the partner system (Partner) and save it• Specify the new client, to newly created Logical System & save it

3 .2 Maintain RFC Destination ( Should be same as Logical System ) • T-Code : SM59• Create 1 RFC destination (Logical System : Sender) for R/3 type connection • Specify the target host on Technical settings tab • Provide the Logon credentials on the Logon/Security tab • Save the settings • To verify the settings, Click on Test connection or Remote logon• Create 2 RFC Connection for second Logical System: Receiver & specify their details.

3 .3 Define Ports (Let system choose the name)

We need to define a tRFC port for the partner system

• T-Code: WE21• Click on Transactional RFC node • Create a new port • Provide a description • Specify the name of the target RFC destination • Save the object

3 .4 Maintain Distributed Model • T-Code BD64• Click on Change

P a g e | 28

• Create a new model view • Provide a Short text and Technical name to the model view • Add message type ZRZSO_MT• Specify sender (Logical System 1) and receiver systems (Logical System 2)• Also, specify the message type ZRZSO_MT that we created previously • Save the Distribution model

3 .5 Generate Partner Profile • BD82 • Specify the model view, target system (Logical System 2) and execute • The result log will be displayed on the next screen • To verify the partner profile go to WE20 • Check the partner profile for the target system

3 .6 Distribute Model View • T-Code: BD64• Select the Model View • Go to menu path Edit -> Model View -> Distribute • Result log will be displayed on the next screen

3 .5 Assign Function Module to Logical message • Transaction WE57 • Create a new entry • Specify name of the Function Module as Z_IDOC_INPUT_ZRZSO_MT • Also, specify Type as F, Basic IDoc type as ZRZORDER, Message type as ZRZSO_MT and

Direction as 2 (Inbound)• Save the entry

3.6 Define Input method for Inbound Function Module • Transaction BD51 • Create a new entry • Provide Function Module name as Z_IDOC_INPUT_ZRZSO_MT• Specify the Input method as 2 • Save the entry

3.7 Create a Process Code • Transaction WE42 • Create a new Process Code ZPCRZ• Select Processing with ALE Service • Choose Processing type as Processing by function module • Save the entry • On the next screen, select your function module from the list • Save the changes • Now you will be taken to the next screen • Double-click on Logical message

P a g e | 29

• In the Assignment to logical message, specify the message type ZRZSO_MT• Save the changes

SEND AND RECEIVE DATA

On the sender system, execute the IDoc Generation Program. Check the status of IDoc using transaction WE02.

Check the status of the IDoc in the receiver system using transaction WE02. You can also check the contents of DDic tables to make sure that the records have been created in the receiver system.

P a g e | 30

IDOC TO FLAT FILE

Follow these steps to convert an IDOC into flat/Text/Rich Text/Spread sheet file format.

• WE02/WE05, Enter Date - 2003 – 2009 & then Execute (F8)

P a g e | 31

• Choose any Outbound IDOC (MATMAS 00072)

• Open on any IDOC Number (Idoc Number – 605709)

• You’ll see the structure of an IDOC which includes Control, Data & Status Records

P a g e | 32

• Open data record, you’ll see the SEGMENTS

• Choose anyone SEGMENT(E1MARAM Segment 000001), In Menu Bar – Idoc – Print Idoc

P a g e | 33

• You’ll get the Idoc Display Screen

• Click on this option (Control + Shift + F9) to convert this Idoc to .txt, .xls, .html, or .doc file format

• Choose appropriate option

P a g e | 34

• Choose Directory, File Name & then Generate it.• Go ahead and check your file.

USE FULL TCODE

P a g e | 35

Main MenusWEDI EDI Related ActivitiesBALE ALE Related ActivitiesSWLD Workflow Related ActivitiesSALE ALE ConfigurationNACE Message Control Configuration

IDOC DefinitionSE11 Data DictionaryWE30 IDoc type editorWE31 Segment editorBD53 Reduction of IDoc typesWE60 Documentation for IDoc typesWE61 Documentation for IDoc record types

IDOC MonitoringWE02 IDoc displayWE05 IDoc ListsWE06 Active IDoc monitoringWE07 IDoc statistics

Configuration (ALE and EDI)BD54 Maintain logical systemsBD64 Maintain distribution modelBD71 Distribute Customer ModelBD82 Generate partner profilesFILE Logical File PathsPFTC Task DefinitionPPOC Maintain Organization StructureSM59 Maintain RFC DestinationsSWE2 Event LinkageSWU3 Basic Workflow SettingsWE20 Partner profilesWE21 Port definitionRun Time WorkflowSO01 SAP InboxSWEL Event LogSWI1 Workflow LogSWI2 Work Item AnalysisSWI5 Workload Analysis

Message ControlNACE Condition Record MaintenanceVOK2 SD Message Control ComponentsVOK3 Purchasing message Control ComponentsVOFM View Message Requirements

P a g e | 36

V/86 Condition Table Field CatalogWE15 IDoc test: Outbound from MC

TestingWE19 Test toolWE12 IDoc test: Inb. Procg of Outb. FileWE16 IDoc test: Inbound FileWE17 IDoc test: Inbound status report

Reprocessing IDOCSBD87 Process inbound IDocBD88 Process outbound IDoc