Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

idocs

Former Member
0 Kudos

can anybody give me an idea ,how we started working on idocs.n how these idocs r created.plz send me an example if u can.

5 REPLIES 5

Former Member
0 Kudos

Hi,

Create new segments -- WE31

Create new IDOCs -- WE30

Create a new message type -- WE81

Link message type with IDOC type -- WE82

Outbound program LOGIC

Select data from application tables

Fill data into IDOC

Pass IDOC to ALE layer

(Call function MASTER_IDOC_DISTRIBUTE)

Commit Work

REPORT zale_example.

  • Parameter for material number for getting related information

PARAMETER : s_matnr TYPE matnr.

  • Internal table for populating the control information for the IDOC

DATA : i_edidc TYPE STANDARD TABLE OF edidc INITIAL SIZE 0

WITH HEADER LINE.

  • Internal table for the communication control record

DATA : i_c_edidc TYPE STANDARD TABLE OF edidc INITIAL SIZE 0

WITH HEADER LINE.

  • Internal table for the populating the data record

DATA : i_edidd TYPE STANDARD TABLE OF edidd INITIAL SIZE 0

WITH HEADER LINE.

  • Structure for the storing material related information

DATA : struct_mara TYPE mara.

  • Structure for the storing the material description

DATA : struct_makt TYPE makt.

  • Structure for the segment to populate the record in the data record

DATA : struct_e1maram TYPE e1maram.

DATA : struct_e1maktm TYPE e1maktm.

  • Constants for the segment names.

DATA : c_e1maram TYPE edilsegtyp.

DATA : c_e1maktm TYPE edilsegtyp.

START-OF-SELECTION.

  • Get the application data from the tables MARA and MAKT

PERFORM get_app_data.

  • Populate the idoc.

PERFORM pop_idoc.

&----


*& Form GET_APP_DATA

&----


  • Get the Application data from the MARA and MAKT

----


FORM get_app_data .

  • Get the Material related information from the mara.

SELECT SINGLE *

FROM mara

INTO struct_mara

WHERE matnr = s_matnr.

  • Check for the sy-subrc value

IF sy-subrc NE 0.

  • Sy-subrc is not equal to zero go out of the program.

EXIT.

ENDIF.

  • Get the material description from the makt by using matnr

SELECT SINGLE *

FROM makt INTO struct_makt

WHERE matnr = s_matnr.

  • Check for the sy-subrc value

IF sy-subrc NE 0.

  • Sy-subrc is not equal to zero go out of the program.

EXIT.

ENDIF.

ENDFORM. " GET_APP_DATA

&----


*& Form MOVE_TO_E1MARAM

&----


  • populate the segment E!MARAM

----


FORM move_mara_to_e1maram .

  • Clear the segment

CLEAR struct_e1maram.

  • Pass the message type related information into the segment.

MOVE: "STRUCT_MARA-MSGFN TO STRUCT_E1MARAM-MSGFN,

struct_mara-matnr TO struct_e1maram-matnr,

struct_mara-ersda TO struct_e1maram-ersda,

struct_mara-ernam TO struct_e1maram-ernam,

struct_mara-meins TO struct_e1maram-meins.

  • Populate the internal table for the data record by passing the

  • Segment name and application data.

PERFORM pop_idoc_edidd USING c_e1maram struct_e1maram.

ENDFORM. " MOVE_TO_E1MARAM

&----


*& Form MOVE_MAKT_TO_E1MAKTM

&----


  • Populate the segment E1MAKTM

----


FORM move_makt_to_e1maktm .

  • Clear the segment

CLEAR struct_e1maktm.

  • Pass the message type related information into the segment.

MOVE : "STRUCT_MAKT-MSGFN TO STRUCT_E1MAKTM-MSGFN,

struct_makt-spras TO struct_e1maktm-spras,

struct_makt-maktx TO struct_e1maktm-maktx.

  • Populate the internal table for the data record by passing the

  • Segment name and application data.

PERFORM pop_idoc_edidd USING c_e1maktm struct_e1maktm.

ENDFORM. " MOVE_MAKT_TO_E1MAKTM

&----


*& Form POP_IDOC_EDIDD

&----


  • Populate the data record by passing the segement data

----


  • -->P_C_E1MAKTM segment name

  • -->P_STRUCT_E1MAKTM Application data

----


FORM pop_idoc_edidd USING p_c_e1maktm

p_struct_e1maktm.

  • Clear the work area for the data record internaltable I_edidd

CLEAR i_edidd.

  • Move the segment name

MOVE: p_c_e1maktm TO i_edidd-segnam,

  • Pass the application data

p_struct_e1maktm TO i_edidd-sdata.

  • Append the internaltable.

APPEND i_edidd.

ENDFORM. " POP_IDOC_EDIDD

&----


*& Form POP_IDOC

&----


  • Populate the Idoc with related information

----


FORM pop_idoc .

  • populate the control record

PERFORM pop_con_data.

  • populate the data record by first populating the header segment

PERFORM move_mara_to_e1maram.

  • Populate the data record by populate the data segment

PERFORM move_makt_to_e1maktm.

  • call the fM master idoc distribute for creating master idoc

PERFORM create_mat_idoc.

ENDFORM. " POP_IDOC

&----


*& Form POP_CON_DATA

&----


  • Populate the control record

----


FORM pop_con_data .

  • Variable for the logical system name

DATA: l_logsys TYPE edi_sndprn.

  • Get the logical system name.

CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'

IMPORTING

own_logical_system = l_logsys

EXCEPTIONS

own_logical_system_not_defined = 1

OTHERS = 2.

  • Check for the sy-subrc value

IF sy-subrc NE 0.

  • Sy-subrc is not equal to zero go out of the program.

EXIT.

ENDIF.

  • Clear the work area of the control record

CLEAR i_edidc.

  • Move the partener type to the control record

MOVE : 'LS' TO i_edidc-sndprt,

  • Populate the sending system name

l_logsys TO i_edidc-sndprn,

  • Populate the type system partener used

'LS' TO i_edidc-rcvprt,

  • Populate the partner number

l_logsys TO i_edidc-rcvprn,

  • Populate message type

'MATMAS' TO i_edidc-mestyp,

  • Populate the idoc type.

'MATMAS03' TO i_edidc-idoctp.

  • Append the control record data.

APPEND i_edidc.

ENDFORM. " POP_CON_DATA

&----


*& Form CREATE_MAT_IDOC

&----


  • Call the FM MASTER_IDOC_DISTRIBUTE

----


FORM create_mat_idoc .

  • Call the FM MASTER_IDOC_DISTRIBUTE for passing the IDOC to ALE layer.

CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'

EXPORTING

master_idoc_control = i_edidc

TABLES

communication_idoc_control = i_c_edidc

master_idoc_data = i_edidd

EXCEPTIONS

error_in_idoc_control = 1

error_writing_idoc_status = 2

error_in_idoc_data = 3

sending_logical_system_unknown = 4

OTHERS = 5.

  • Check for the sy-subrc value

IF sy-subrc NE 0.

  • Sy-subrc is not equal to zero go out of the program.

EXIT.

ENDIF.

ENDFORM. " CREATE_MAT_IDOC

Inbound program development

Name: Z_IDOC_INPUT_<Msgtype>

FUNCTION MODULE

Interface:

ImportInput_Method process in dialog or not?

Mass_Processing used for WF programming

Export

In_Update_Task Was update ‘in update task’ used ?

Call_Transaction_done Was a Call Transaction used ?

Workflow_Result Workflow events for errors ?

Application_Variable Workflow parameter

Tables

Idoc_Contrl one entry for each IDOC control record

Idoc_Data one entry for each IDOC data segment

Docnum IDOC number

Segnam Segment name

Sdata Segment data

Idoc_Status Status of the IDOC

Return_Variables created/changed application objects

Serialization_Info used for serialization check

Exceptions

Wrong_Function_called

Logic:

Check, if IDOC contains the correct message type; if not raise exception WRONG_FUNCTION_MODULE_CALLED

Initialize any global variables/tables.

Convert the character data in table IDOC_DATA to internal format in internal tables:

character -> numbers

ISO codes -> SAP codes

Check data

If O.k., post data

If Not: return error message to ALE

No Commit Work !

Return variables for successfully processed IDOCs:Workflow_Result: ‘0’

Idoc_Status: 1 record with following fields

Docnum IDOC number

Status ‘53’

Return_Variables: table must contain following entries:

Entry Wf_param Doc_number

1 ‘Processed IDoc’ Idoc number

2 ‘Appl_Objects’ Appl.Object number

See the link

http://help.sap.com/saphelp_erp2005/helpdata/en/78/21758d51ce11d189570000e829fbbd/frameset.htm

https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/03e6e790-0201-0010-9d98-ab8...

Refer this link for creating IDOC

http://help.sap.com/saphelp_nw04/helpdata/en/78/2176ec51ce11d189570000e829fbbd/content.htm

<b>Reward points</b>

Regards

Former Member
0 Kudos

hi

<b>To Create Idoc we need to follow these steps:</b>

Create Segment ( WE31)

Create Idoc Type ( WE30 )

Create Message Type ( WE81 )

Assign Idoc Type to Message Type ( WE82 )

<b>

Creating a Segment</b>

Go to transaction code WE31

Enter the name for your segment type and click on the Create icon

Type the short text

Enter the variable names and data elements

Save it and go back

Go to Edit -> Set Release

Follow steps to create more number of segments

<b>Create IDOC Type</b>

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

Select the IDOC Name and click Create icon

The system prompts us to enter a segment type and its attributes

Choose the appropriate values and press Enter

The system transfers the name of the segment type to the IDOC editor.

Follow these steps to add more number of segments to Parent or as Parent-child relation

Save it and go back

Go to Edit -> Set release

<b>Create Message Type</b>

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

<b>Assign Message Type to IDoc Type</b>

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

<b>Check these out..</b>

<b>Check below link. It will give the step by step procedure for IDOC creation</b>.

http://www.supinfo-projects.com/cn/2005/idocs_en/2/

<b>ALE/ IDOC</b>

http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc

http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm

http://www.sapgenie.com/sapedi/index.htm

http://www.sappoint.com/abap/ale.pdf

http://www.sappoint.com/abap/ale2.pdf

http://www.sapgenie.com/sapedi/idoc_abap.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a60bb507d11d18ee90000e8366fc2/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/78/217da751ce11d189570000e829fbbd/frameset.htm

http://www.allsaplinks.com/idoc_sample.html

http://www.sappoint.com/abap.html

http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc

http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm

http://www.sapgenie.com/sapedi/index.htm

http://www.allsaplinks.com/idoc_sample.html

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.docs

<b>go trough these links.</b>

http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc

http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm

http://www.sapgenie.com/sapedi/index.htm

http://www.sappoint.com/abap/ale.pdf

http://www.sappoint.com/abap/ale2.pdf

http://www.sapgenie.com/sapedi/idoc_abap.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a60bb507d11d18ee90000e8366fc2/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/78/217da751ce11d189570000e829fbbd/frameset.htm

http://www.allsaplinks.com/idoc_sample.html

http://www.sappoint.com/abap.html

http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc

http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm

http://www.sapgenie.com/sapedi/index.htm

http://www.allsaplinks.com/idoc_sample.html

http://http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

<b>Reward points for useful ans</b>

Regards

Aarti

Former Member
0 Kudos

hi,

IDOC:

http://sda.berkeley.edu/idoc/examples/sip6/IDOC/sip6help.htm

this one is sufficient

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm

http://www.sapgenie.com/sapedi/idoc_abap.htm

http://www.allsaplinks.com/idoc_sample.html

Outbound:

Step 1. Application document is created when transaction is saved.

2. Message control is invoked.

3. Messages are processed by system.

4. Messages are Edited (if desired).

5. Output (ALE / EDI) is checked

6. Validate against Message control record from Partner Profile

7. Application Document is saved.

8. Entry NAST table is created for every selected output program

along with Medium & Timing.

9. Check for Process Immediately .

If (yes)

Determine Processing Program from TNAPR Table.

ELSE

Execute RSNASTED Program.

10. Read Partner Profile to determine Process Code.

11. Process Code points to the Function Module & Invoked.

12. IDoc is generated.

13. Check for ALE Request.

if (Yes)

Perform Filters, Conversions, Version Changes etc.

Else.

IDoc is stored in DATABASE.

INBOUND:

Step 1. EDI Subsystem creates an IDoc file from EDI Messages

2. Subsystem calls Functional Module EDI_DATA_INCOMING from startRFC program.

3. Data in Control Record is validate against the Partner Profile.

4. IDoc is generated in Database and syntax check is carried out.

5. IDoc file is deleted once file read.

6. Event PROCESSSTATE REACHED is triggered in Idoc Object Workflow.

7. Check for Process Immediately.

If NO

Execute RBDAPP01 Program

Else

Read Process Code from Partner Profile

Process Code Points to Function Module

Application Document Posted.

further help:

check url

http://www.sappoint.com/abap/ale.pdf

http://www.sappoint.com/abap/ale2.pdf

http://www.sapgenie.com/ale/configuration.htm

http://www.sappoint.com/abap/ale.pdf

http://www.sappoint.com/abap/ale2.pdf

http://www.sapdevelopment.co.uk/training

And also u can get lots of inof from the below link.

http://www.sapgenie.com/ale/why_ale.htm

Data Creation in Idoc

IDocs are text encoded documents with a rigid structure that are used to exchange data between R/3 and a foreign system. Instead of calling a program in the destination system directly, the data is first packed into an IDoc and then sent to the receiving system, where it is analyzed and properly processed. Therefore an IDoc data exchange is always an

asynchronous process. The significant difference between simple RFC-calls and IDoc data exchange is the fact, that every action performed on IDocs are protocolled by R/3 and IDocs can be reprocessed if an error occurred in one of the message steps.

While IDocs have to be understood as a data exchange protocol, EDI and ALE are typical use cases for IDocs. R/3 uses IDocs for both EDI and ALE to deliver data to the receiving system. ALE is basically the scheduling mechanism that defines when and between which partners and what kind of data will be exchanged on a regular or event triggered basis. Such a set-up is called an ALE-scenario.

IDoc is a intermediate document to exchange data between two SAP Systems.

*IDocs are structured ASCII files (or a virtual equivalent).

*Electronic Interchange Document

*They are the file format used by SAP R/3 to exchange data with foreign systems.

*Data Is transmitted in ASCII format, i.e. human readable form

*IDocs exchange messages

*IDocs are used like classical interface files

IDOC types are templates for specific message types depending on what is the business document, you want to exchange.

WE30 - you can create a IDOC type.

An IDOC with data, will have to be triggered by the application that is trying to send out the data.

FOr testing you can use WE19.

How to create idoc?

*WE30 - you can create a IDOC type

For more information in details on the same along with the examples can be viewed on:

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm#_Toc8400404

http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a6620507d11d18ee90000e8366fc2/frameset.htm

http://www.sappoint.com/presentation.html

http://www.allsaplinks.com/idoc_search.html

http://www.sapgenie.com/sapedi/idoc_abap.htm

http://www.erpgenie.com/sapedi/idoc_abap.htm

To Create Idoc we need to follow these steps:

Create Segment ( WE31)

Create Idoc Type ( WE30 )

Create Message Type ( WE81 )

Assign Idoc Type to Message Type ( WE82 )

Creating a Segment

Go to transaction code WE31

Enter the name for your segment type and click on the Create icon

Type the short text

Enter the variable names and data elements

Save it and go back

Go to Edit -> Set Release

Follow steps to create more number of segments

Create 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

Select the IDOC Name and click Create icon

The system prompts us to enter a segment type and its attributes

Choose the appropriate values and press Enter

The system transfers the name of the segment type to the IDOC editor.

Follow these steps to add more number of segments to Parent or as Parent-child relation

Save it and go back

Go to Edit -> Set release

Create 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

Assign Message Type to IDoc 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

Check these out..

Check below link. It will give the step by step procedure for IDOC creation.

http://www.supinfo-projects.com/cn/2005/idocs_en/2/

ALE/ IDOC

http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc

http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm

http://www.sapgenie.com/sapedi/index.htm

http://www.sappoint.com/abap/ale.pdf

http://www.sappoint.com/abap/ale2.pdf

http://www.sapgenie.com/sapedi/idoc_abap.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a60bb507d11d18ee90000e8366fc2/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/78/217da751ce11d189570000e829fbbd/frameset.htm

http://www.allsaplinks.com/idoc_sample.html

http://www.sappoint.com/abap.html

http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.doc

http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm

http://www.sapgenie.com/sapedi/index.htm

http://www.allsaplinks.com/idoc_sample.html

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.cs

go trough these links.

http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.dc

http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm

http://www.sapgenie.com/sapedi/index.htm

http://www.sappoint.com/abap/ale.pdf

http://www.sappoint.com/abap/ale2.pdf

http://www.sapgenie.com/sapedi/idoc_abap.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/0b/2a60bb507d11d18ee90000e8366fc2/frameset.htm

http://help.sap.com/saphelp_erp2005/helpdata/en/78/217da751ce11d189570000e829fbbd/frameset.htm

http://www.allsaplinks.com/idoc_sample.html

http://www.sappoint.com/abap.html

http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

http://www.sapgenie.com/sapgenie/docs/ale_scenario_development_procedure.dc

http://edocs.bea.com/elink/adapter/r3/userhtm/ale.htm#1008419

http://www.netweaverguru.com/EDI/HTML/IDocBook.htm

http://www.sapgenie.com/sapedi/index.htm

http://www.allsaplinks.com/idoc_sample.html

http://http://help.sap.com/saphelp_erp2004/helpdata/en/dc/6b835943d711d1893e0000e8323c4f/content.htm

An IDoc is simply a data container that is used to exchange information between any two processes that can understand the syntax and semantics of the data...

Former Member
0 Kudos

go thru IDoc cookbook

http://idocs.de/www3/cookbooks/idoc/cb10_idoc_03_firstlook/

regards,

srinivas

<b>*reward for useful answers*</b>

Former Member
0 Kudos

Dear all,

I m also trying to make a sales order using IDOC. Please guide i m new in abap