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.
Showing results for 
Search instead for 
Did you mean: 

Idoc query

Former Member
0 Kudos

Hi everyone,

Could you please provide me the steps to create an IDOC..Sample code will be helpful too..I am familiar with how to create idoc types but not getin the feel of how to actually create an IDOC...

Also if there is some good tutorial on will help me understand the subject well...I want to know everythin about IDOC and how it works from scratch...

Thanks in Advance....




Former Member
0 Kudos

First set up configuration -

Logical system in SALE

RFC - Sm59

Distribution model view - BD64 ( if it is ALE then use,edi do not use )

Port - WE21 ( if it is ALE ,then choose TRFC Port,EDI then choose FILE Port)

Partner profile - WE20

Create new ztable in se11

Create new segment - WE31

Create new idoc type - WE30

Create new message type - WE81

Create message type to idoc type - WE82

table looks like matnr,maktx ( example ) ztable,mention segment also matnr,maktx

you will get partial output ,so use process code : MATM ( Material Master)

Now create a program :

See the example program :


*& Report ZTEST_ALE







tables : zmara_01,



constants : c_mestyp type edidc-mestyp value 'ZAJI_MSG',

c_idoctp type edidc-idoctp value 'ZAJI_IDOC',

c_imtyp type edidc-cimtyp value 'Z_ACC_GL_POSTING01',

c_seg1 type edidd-segnam value 'E1BPACHE08',

c_seg2 type edidd-segnam value 'E1BPACGL08',

c_seg3 type edidd-segnam value 'E1BPACCR08',

c_seg4 type edidd-segnam value 'Z1BPACCR08',

c_seg5 type edidd-segnam value 'E1BPEXTC'.

  • Work Area for EDIDC

data wa_edidc like edidc.

  • Internal tabel

data i_edidc like edidc occurs 0 with header line.

data i_edidd like edidd occurs 0 with header line.

  • Internal table for ZMARA_01

data i_mara like zmara_01 occurs 0 with header line.

parameters : p_rcvprn type edoc_stat-rcvprn obligatory,"Partner Number of Receiver

p_rcvprt type edoc_stat-rcvprt obligatory."Partner Type of Receiver


  • Fill the Control Reord

wa_edidc-mandt = sy-mandt.

wa_edidc-mestyp = c_mestyp.

wa_edidc-idoctp = c_idoctp.

  • wa_edidc-cimtyp = c_imtyp.

wa_edidc-rcvprn = p_rcvprn.

wa_edidc-rcvprt = p_rcvprt.

wa_edidc-credat = sy-datum.

wa_edidc-cretim = sy-uzeit.

append wa_edidc to i_edidc.

select * from zmara_01 into table i_mara.

  • Fill the data record

loop at i_mara.

i_edidd-segnam = 'ZAJI_MSG'.

i_edidd-sdata = i_mara-matnr.

append i_edidd.


  • Call the ALE Function Module



master_idoc_control = wa_edidc


communication_idoc_control = i_edidc

master_idoc_data = i_edidd


error_in_idoc_control = 1

error_writing_idoc_status = 2

error_in_idoc_data = 3

sending_logical_system_unknown = 4

others = 5.

if sy-subrc eq 0.

loop at i_edidc.

write:/ 'Succesfully created Idoc', i_edidc-DOCNUM.



message i000(FC) with 'No idoc has been created'.


Reward Points if it is helpful



0 Kudos

Check the following links, you will found a lot of information.


Former Member
0 Kudos

Hi Jimmy,

Go through the link below :

This tutorial provides a comprehensive explanation of what an IDOC is.

How to create an IDOC has been explained in detail by Seshu. So I guess that would suffice.

Hope this helps.


Anil Madhavan

Former Member
0 Kudos


Creation of Custom IDOc type and message Type

First Create Partner Profile(WE20 Tcode) and Port Definition in WE19 Tcodes.

take the Basis help to create them.

1.First create segments in WE31 Tcode with the required dataelements

2.Create the Basic Idoc Type in WE30

release the Segments and IDOC type.

3.Create Message type in We81

4.Assign the message type to IDOC type in WE82 T code

5.Create the process code in We41 (for Outbound) WE42 (for Inbound)

6.Create A fun module in SE37 starting with ZIDOC_OUTPUT_.. by copying some Inbound (for Inbound) Outbound Fun module

7.Create Workflow setting if needed ..

8. Assign the fun module to Idoc Type, Message Type and WF object (if it is there0

9.Define setting for fun module in BD51

10.In BD51 Define the settings for Fun module..

10.Assign the Processs Code to Fun mod`ule

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

Check these links.

Please check this PDF documents for ALE and IDoc.

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

Check these links.

Please check this PDF documents for ALE and IDoc.

Reward points if useful