Use of MASTER_IDOC_DISTRIBUTE

Hi all!!
I have created my own IDoc and send it to the target system using the MASTER_IDOC_DISTRIBUTE function. Everything seems to work correctly, I can see in my system the OK status, but I can not see anything in the receiver system.
If I use the test tool, I can see that my IDoc has reached the receiver system.
I do not now what am I doing incorrectly... has someone any idea?? Why does not reach the receiver system using the function and reach when using the test tool? If anything would not be correctly configured, nor of them should work, no? Perhaps I am calling the function with incorrect values? I do not know. The outbound log is identical in both of them.
Thank you very much!
Araitz.

Hi Arairz,
A COMMIT WORK must be dispatched in the calling program, otherwise the     
IDocs may not be dispatched.                                               
Perform an explicit commit work after the function module call.                                                                   
Regards,
Aditya

Similar Messages

  • Question on using FM  'MASTER_IDOC_DISTRIBUTE'

    Hi guys,
    I am always recieving an excemption = 2 (error_writing_idoc_status) when using 'MASTER_IDOC_DISTRIBUTE', what would be the problem with my code? thanks in advance!
    Regards,
    Mike

    HI,
    Ur report should be this format.
    *& Report  z_idoc_demo                                                 *
    *&  1. Create a Segment in WE31                                        *
    *&  2. Create an Idoc type in WE30.                                    *
    *&  3. Create a Message Class in WE81.                                 *
    *&  4. Assign Message Type to Idoc Type in WE82.                       *
    *&  5. Create a Port in WE21.                                          *
    *&  6. Create a Partner profile in WE20.                               *
    REPORT  z_idoc_demo.
    TYPES : BEGIN OF tw_mara,
            matnr TYPE matnr,
            mtart TYPE mtart,
            meins TYPE meins,
            ntgew TYPE ntgew,
            END OF tw_mara,
            tt_mara TYPE STANDARD TABLE OF tw_mara.
    DATA: gf_so_matnr TYPE matnr.
    SELECT-OPTIONS: so_matnr FOR gf_so_matnr.
    DATA: lt_edidc TYPE edidc OCCURS 0 WITH HEADER LINE,
          lw_edidc TYPE edidc,
          lt_edidd LIKE edidd OCCURS 0 WITH HEADER LINE,
          lw_zmat TYPE zsivseg.
    DATA: lw_mara TYPE tw_mara,
          lt_mara TYPE tt_mara.
    START-OF-SELECTION.
      SELECT matnr mtart meins ntgew FROM mara INTO TABLE lt_mara
                                     WHERE matnr IN so_matnr.
      IF NOT lt_mara[] IS INITIAL.
        lw_edidc-direct = 1.
        lw_edidc-rcvprn = 'SAPLER'.
        lw_edidc-rcvprt = 'LS'.
        lw_edidc-rcvpor = 'SIVPORT'.
        lw_edidc-mestyp = 'ZSIVMATERIAL'.
        lw_edidc-idoctp = 'ZSIVIDOC'.
        LOOP AT lt_mara INTO lw_mara.
          MOVE : lw_mara-matnr TO lw_zmat-matnr,
                 lw_mara-mtart TO lw_zmat-mtart,
                 lw_mara-meins TO lw_zmat-meins,
                 lw_mara-ntgew TO lw_zmat-ntgew.
          MOVE : 'ZSIVSEG' TO lt_edidd-segnam,
                 lw_zmat TO lt_edidd-sdata.
          APPEND lt_edidd.
          CLEAR : lt_edidd, lw_zmat.
        ENDLOOP.
      ENDIF.
      CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
        EXPORTING
          master_idoc_control            = lw_edidc
        TABLES
          communication_idoc_control     = lt_edidc
          master_idoc_data               = lt_edidd
        EXCEPTIONS
          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.
        READ TABLE lt_edidc INDEX 1.
        IF sy-subrc EQ 0.
          WRITE:/10 lt_edidc-docnum.
        ENDIF.
      ENDIF.
    Regards,
    S.Nehru.

  • Creation Idcos using Master_Idoc_distribute

    Hi Folks
    I am using FM 'Master_Idoc_distribute' to generate Idocs for Idoc type Delvryo3
    it has segments e1edl20 in level 2, which is topmost level and other segments in level 3
    i used hlevel segnam psgnam fields to assign levels, but whole data is stored in  same level
    how to assign this levels in programs so that , data wil be stored in appropriate levels
    Cheers
    Anil

    the following is the developed code for the Same idoc type
    Create IDoc Structure.
    For Segment E1EDL20
    - Set delivery number
      ls_e1edl20-vbeln = lv_arg_1.
    - Fill control structure segment E1EDL20
      ls_edidd-segnam = 'E1EDL20'.
      ls_edidd-sdata  = ls_e1edl20.
      APPEND ls_edidd TO lt_edidd.
    For Segment E1EDL24
      LOOP AT lt_info_pos INTO ls_info_pos.
      - Set Delivery Item Number and Material
        ls_e1edl24-posnr = ls_info_pos-param_value.
        READ TABLE lt_info_mat
          WITH KEY param_index = ls_info_pos-param_index
          INTO ls_info_mat.
        IF sy-subrc is initial.
          ls_e1edl24-matnr = ls_info_mat-param_value.
        ELSE.
          ls_e1edl24-matnr = ''.
        ENDIF.
      - Fill control structure segment E1EDL24
        ls_edidd-segnam = 'E1EDL24'.
        ls_edidd-sdata  = ls_e1edl24.
        APPEND ls_edidd TO lt_edidd.
      For E1EDL53
      - Reason Code if exsits
        IF lv_reason_code IS NOT INITIAL.
          ls_e1edl53-grund = lv_reason_code.
          READ TABLE lt_info_quan
            WITH KEY param_index = ls_info_pos-param_index
            INTO ls_info_quan .
          IF sy-subrc = 0.
            ls_e1edl53-lfimg_diff = ls_info_quan-param_value.
          ELSE.
            ls_e1edl53-lfimg_diff = '0'.
          ENDIF.
        - Fill control structure segment E1EDL53
          ls_edidd-segnam = 'E1EDL53'.
          ls_edidd-sdata   = ls_e1edl53.
          APPEND ls_edidd TO lt_edidd.
        ENDIF.
      ENDLOOP.
    Set IDoc Type'DELVRY03' and Message Type 'STPPOD'
    - Fill control structure EDIDD
      ls_edidc-idoctp = 'DELVRY03'.
      ls_edidc-mestyp = 'STPPOD'.
    Application interface to the ALE layer on outbound processing side
      CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
        EXPORTING
          master_idoc_control                  = ls_edidc
        OBJ_TYPE                             = ''
        CHNUM                                = ''
        TABLES
          communication_idoc_control           = lt_edidc
          master_idoc_data                     = lt_edidd
       EXCEPTIONS
         error_in_idoc_control                = 11
         error_writing_idoc_status            = 12
         error_in_idoc_data                   = 13
         sending_logical_system_unknown       = 14
         OTHERS                               = 15.
      e_return_code = 0.
      IF sy-subrc <> 0.
        e_return_code = sy-subrc.
      ENDIF.
    dont forgot to reward if its helpful
    regards,
    Surya

  • IDOC in yellow state after MASTER_IDOC_DISTRIBUTE

    Hello,
    I am sending idocs using MASTER_IDOC_Distribute to the target. In the partner profile, I have checked process idocs immediately.
    After the function call, there is commit work command.
    I like to process idocs immediately.
    Most of the time the idocs are in yellow state, and require BD87 to process idocs. I checked several tips in SDN and unable to resolve it.
    Thank you for the help
    Regards
    William

    Hi William,
    The below links might be helpful for your problem:
    [Call of master_idoc_distribute|http://help.sap.com/saphelp_nw04/helpdata/en/78/21783151ce11d189570000e829fbbd/frameset.htm]
    [Re: Use of MASTER_IDOC_DISTRIBUTE|Re: Use of MASTER_IDOC_DISTRIBUTE]
    Regards
    Bhanu
    Intelligroup.
    Edited by: Bhanu Tiruveedula on May 13, 2008 8:10 PM

  • HI GURU'S WISH FUNCTION MODULE USED IN IDOC'S OUT BOUND

    HI GURU'S WISH FUNCTION MODULE USED IN IDOC'S OUT BOUND PLZ HELP ME................

    Hi!
    Check out transaction WE41 for out, WE42 for inbound IDocs FM-s.
    Unfortunately mostly the outbound IDocs are not entered here, they are sent from user-exits, at the save event...You can send IDocs using FM "master_idoc_distribute".
    And check out transaction WEDI for IDoc configurations...
    Regards
    Tamá

  • Fm use for writing idoc programing

    hi expects,
      can any body help me by providing the fm of idoc .by using it i can write the code for inbound and outbound.
           thank you

    Hi Rohit,
    Please check this sample code to create an inbound IDoc using FM IDOC_INBOUND_WRITE_TO_DB.
      PERFORM FILL_EDIDC.
      PERFORM FILL_EDIDD.
      CALL FUNCTION 'IDOC_INBOUND_WRITE_TO_DB'
        EXPORTING
          PI_STATUS_MESSAGE       = I_EDIDS
        IMPORTING
          PE_IDOC_NUMBER          = DOCNUM
          PE_STATE_OF_PROCESSING  = STPROC
          PE_INBOUND_PROCESS_DATA = I_TEDE2
        TABLES
          T_DATA_RECORDS          = I_EDIDD
        CHANGING
          PC_CONTROL_RECORD       = I_EDIDC
        EXCEPTIONS
          IDOC_NOT_SAVED          = 1
          OTHERS                  = 2.
    Also check this sample code to create outbound IDoc using FM MASTER_IDOC_DISTRIBUTE.
    REPORT Z_IDOC_SAMPLE
    MESSAGE-ID ZLKPL_MSGCLASS
    LINE-COUNT 65(5)
    LINE-SIZE 132.
    *& Report Z_IDOC_SAMPLE *
    * REPORT:Z_IDOC_SAMPLE
    * This report creates an IDOC and fills it with application data
    * The control, data, status records are filled and distributed
    * over the ALE Interface
    * Parameters
    *---Parameter for Object Key
    PARAMETERS: P_ENUM LIKE ZAK_EMPLIST-ENUMBER.
    *---Parameter for Message type
    PARAMETERS: P_MESTYP LIKE EDMSG-MSGTYP OBLIGATORY.
    *---Parameter for Destination System
    PARAMETERS: P_LOGSYS LIKE TBDLST-LOGSYS.
    * Constants
    *---Segment Names
    DATA: C_EMP_HEADER_SEGMENT LIKE EDIDD-SEGNAM VALUE 'Z1EMPHD',
    C_EMP_DETAILS_SEGMENT LIKE EDIDD-SEGNAM VALUE 'Z1EMPDT'.
    *---IDoc Type
    DATA: C_REPORT_IDOC_TYPE LIKE EDIDC-IDOCTP VALUE 'ZREP01'.
    * Data Declarations
    *---Idoc Control Record
    DATA: CONTROL_RECORD_OUT LIKE EDIDC.
    *---Employee Header Data
    DATA: FS_EMPHDR_DATA LIKE Z1EMPHD.
    *---Employee Details Data
    DATA: FS_EMPDET_DATA LIKE Z1EMPDT.
    * Database Tables
    TABLES: ZAK_EMPLIST.
    * Internal Tables
    *---Internal table for application data
    DATA: IT_EMP LIKE ZAK_EMPLIST OCCURS 0 WITH HEADER LINE.
    *---Internal table for Data Records
    DATA: IT_EDIDD LIKE EDIDD OCCURS 0 WITH HEADER LINE.
    *---Internal table for Communication Idocs generated
    DATA: IT_COMM_IDOCS LIKE EDIDC OCCURS 0 WITH HEADER LINE.
    * Select Applcation Data
    SELECT * FROM ZAK_EMPLIST
    WHERE ENUMBER = P_ENUM.
    IF SY-SUBRC NE 0 .
    MESSAGE E001(ZLKPL_MSGCLASS).
    EXIT.
    ENDIF.
    * Build Control records
    CONTROL_RECORD_OUT-MESTYP = P_MESTYP.
    CONTROL_RECORD_OUT-IDOCTP = C_REPORT_IDOC_TYPE.
    CONTROL_RECORD_OUT-RCVPRT = 'LS'.
    CONTROL_RECORD_OUT-RCVPRN = P_LOGSYS.
    * Build Data records
    *--- Employee Header data
    FS_EMPHDR_DATA-ENUMBER = ZAK_EMPLIST-ENUMBER.
    *--- Fill the administrative information for the record
    IT_EDIDD-SEGNAM = C_EMP_HEADER_SEGMENT.
    IT_EDIDD-SDATA = FS_EMPHDR_DATA.
    *--- Append the data
    APPEND IT_EDIDD.
    *--- Employee Details
    FS_EMPDET_DATA-ENAME = ZAK_EMPLIST-ENAME.
    FS_EMPDET_DATA-EPHONE = ZAK_EMPLIST-EPHONE.
    FS_EMPDET_DATA-EDEPT = ZAK_EMPLIST-EDEPT.
    *--- Fill the administrative information for the record
    IT_EDIDD-SEGNAM = C_EMP_DETAILS_SEGMENT.
    IT_EDIDD-SDATA = FS_EMPDET_DATA.
    *--- Append the data
    APPEND IT_EDIDD.
    ENDSELECT.
    * Pass Control to the ALE Interface -- IDoc Exporting
    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
    EXPORTING
    MASTER_IDOC_CONTROL = CONTROL_RECORD_OUT
    TABLES
    COMMUNICATION_IDOC_CONTROL = IT_COMM_IDOCS
    MASTER_IDOC_DATA = IT_EDIDD
    EXCEPTIONS
    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 NE 0.
    MESSAGE E001(ZLKPL_MSGCLASS).
    ELSE.
    LOOP AT IT_COMM_IDOCS.
    WRITE: / 'IDOC GENERATED', IT_COMM_IDOCS-DOCNUM.
    ENDLOOP.
    COMMIT WORK.
    ENDIF.
    Regards,
    Ferry Lianto

  • Creation of Custom IDoc with Message control for sales Order

    Hi all,
    I am trying to create custom Outbound IDoc with message control.
    I wrote the code in a function module and i want to register that function module. (as in inbound registration of function module as in BD51).I am not knowing if that registration is necessary for outbound Idoc, if so in which transacition?
    Please list me the steps to create a custom IDoc for Message control.
    Thanks in advance,
    Regards,
    John.

    Hi,
    You need to use FM : MASTER_IDOC_DISTRIBUTE to create outbound idoc.fill the data in the tables EDIDC,EDIDD and generate the IDOC.
    check this link:
    Re: Master_IDoc_Distribute
    and use transaction : WEDI for IDOC configurations.
    here you will have all the transactions(step by step) to set the outbound IDOC configurations.
    Regards
    Appana

  • EDI: partner profile for shipping point or plant

    I want to issue idocs for delivery notes based on shipping point or plant, not shipto party as is usual.
    How can I go about this?
    It looks like I need to create a new partner type. Or can I use logical systems?
    If logical system is used, then how do I make the connection document->LS?
    The external system uses the RCVPRN to determine which warehouse to handle the delivery for.
    I am changing the RCVPRN in a user exit now, but this still requires creating/ changing all partner profiles for shipto parties.
    Any ideas? previous experiences?
    Thanks,
    phillip

    Hi Phillip,
    it looks like I need to create a new partner type. Or can I use logical systems?
    > Yes, you can use LS
    If logical system is used, then how do I make the connection document->LS?
    > You can use FM: MASTER_IDOC_DISTRIBUTE to send the outbound IDOC...
    Regards,
    Hendy

  • FM to get IDOC number of the created IDOC

    I am creating the idoc using FM -- >MASTER_IDOC_DISTRIBUTE
    If Idoc is created successfully I get sy-subrc = 0.
    If sy-subrc is 0 .... I need to fetch the Idoc number...
    I need a FM that will return the appropriate idoc number...
    thanks
    Warm regards,
    Karen

    Hello,
    try this FM "IDOC_INBOUND_SINGLE", this returns the IDoc number.
    Regards,
    Sachinkumar Mehta

  • ALE/IDOC[custom table transfer]

    Hi All,
    I have a doubt regarding the type of programs used to post the idocs using ALE in the outbound process.
    Please also tell me which program I will use to post a custom table of mine to another server using ALE/IDOC.
    Please also tell me the procedure to do the same mentioned above.
    Please help. Its a urgent requirement...........................
    Thanks in advance......................................................

    Hi Guru,
    if you cannot use a standard idoc then you´ll need to create a custom one starting from the segment (WE31) where you can create an Idoc segment starting from your own Z table structure using the wizard.
    Then you´ll need to also create the idoc type (WE30) and link the segment to the IDoc.
    Then you´ll need to create a message type and link the message type to the Idoc type (WE81, WE82).
    Then you´´ll use RFC "MASTER_IDOC_DISTRIBUTE" to populate the IDOC and send the data.
    This is a sample code just to give you an idea:
    DATA:          
      Z_SEGNAME(7) TYPE C VALUE 'SEGMENT',
      Z_MESTYPE(9) TYPE C VALUE 'MESSAGE',
      Z_IDOC_TYPE(8) TYPE C VALUE 'IDOC'.
    DATA:
      IDOC_CONTROL LIKE EDIDC,
      T_COMM_CONTROL LIKE EDIDC OCCURS 0 WITH HEADER LINE,
      IDOC_DATA LIKE EDIDD OCCURS 0 WITH HEADER LINE.
    *Reads data from Z table
    SELECT *
    FROM ZTABLE
    INTO TABLE L_ZTABLE.
    *Set the control data info required for the distribution
    IDOC_CONTROL-MESTYP = Z_MESTYPE.
    IDOC_CONTROL-DOCTYP = Z_IDOC_TYPE.
    *Populate the IDoc
    LOOP AT L_ZTABLE.
      CLEAR IDOC_DATA.
      IDOC_DATA-SEGNAM = Z_SEGNAME.
      IDOC_DATA-SDATA = ZTABLE.
      APPEND IDOC_DATA.
    ENDLOOP.
    *Deliver the IDOC as defined in distribution model/partner profile
    CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE' IN UPDATE TASK
      EXPORTING
        MASTER_IDOC_CONTROL          = IDOC_CONTROL
      TABLES
        COMMUNICATION_IDOC_CONTROL     = T_COMM_CONTROL
        MASTER_IDOC_DATA               = IDOC_DATA
      EXCEPTIONS
        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 = 0.
      COMMIT WORK.
    ENDIF.

  • Transfer IDOC Immed.

    Hi
    I’ve created a Z message type to transfer transactional data from SAP EEC6 to external system (MES) using iDOCs.
    Distribution model was created and profiles were updated in WE20 (outbound parameters).
    Radio button “Transfer IDOC Immed.” was also set.
    When we create idocs, they are not transferred immediately. In BD87 they are assigned to status 30.
    However, they are successfully transferred when using program RSEOUT00.
    Why is setting “Transfer IDOC Immed.” ignored?
    Thanks
    W

    Hi Eng Swee
    Thanks for your prompt response.
    Yes we are using a custom program to generate idoc (we used FM MASTER_IDOC_DISTRIBUTE).
    We’ve changed it now to ALE_IDOCS_CREATE together with EDI_DOCUMENT_DEQUEUE_LATER.
    All is working except for the logical system that we must hardcode in the program.
    With FM MASTER_IDOC_DISTRIBUTE this was not required.
    Is there a way to get past this?
    Regards
    W

  • Outbound IDOC - Sender and reciever

    Hello SDNites,
    I have created a report pgm which is equipped to send an outbound IDOC i.e used FM 'MASTER_IDOC_DISTRIBUTE'. Can someone please tell me how do I decide my sender and reciever when populating the control record in this FM.
    I know sender will be my system and reciver will be third party system but can you please tell me what values need to be opulated there or

    Thanks for the information,
    Can you please give the info in following form,
    1. Partner profile configuration with the values in your system.
    2. Code snippet where control records are poulated for Outbound IDOC with the values you specified in step 1.
    This will help me in understanding the same.
    Regards,
    Abhi

  • Create Idoc in a User Exit

    Hello everyone,
    we have a requirement where we want to create and send an idoc out through a user exit.has anyone done anything like this before?i think it is possible.if anybody has any headup on how to do it please let me know.ok yea i know the function module which is to be used.its idoc_output_inotif.there is a tcode INOT which sends the idoc out but OSS says we cant use it 4.6c onwards and thats the reason this need of creating an idoc in user exit arises.
    i have tried executing the FM independantly and punching in a few values and i saw that it created an idoc in the system.so my guess is, if i can call this FM in one of the user exits for the transaction IW51/52, and pass all the needed values i should get an idoc.
    if anyone has manually created an idoc in a user exit please suggest me some options.
    thanks a lot.

    Hi Sanket ,
    Distribution Model is required when you use message control to send IDOCS . Since you are triggering your IDOC in a uaer exit , a distribution model is not required . Simple create a partner profile in WE20 and assign your message type in outbound parameter. You need not fill the message control parameters in WE20.
    ( If you use message control , the process code links the respective FM like  idoc_output_inotif in your case ).
    But in your case you will have to trigger your IDOC in user exit . You have two options here -
    First Try -  idoc_output_inotif in the user exit to fill the segments , then use  FM MASTER_IDOC_DISTRIBUTE to trigger the send process.
    If this  does not work then use
    L_IDOC_HEADER_CREATE -Once
    L_IDOC_SEGMENT_CREATE ( Once for each segment ).
    ( This will create IDOC on data base )
    L_IDOC_SEND - Once to trigger the IDOC created above.
    Hope this helps .
    Cheers

  • Copy IDOC Type to another SAP System

    Hi Team,
    We want to copy a basic IDOC type WGSREQ02 from our ECC system to the BI system. The intent is to use this IDOC as an outbound from the BI system and then recieve it in the ECC system. Since we want to use it only as an outbound, we don't really need any application logic in BI. We just need the IDOC structure and the outbound capabilities so that we can use the application logic provided by default in ECC.
    Please let me know if there is a way to copy the IDOC Definition from ECC to BI system.
    Thanks
    Sanjay

    Hello Sanjay
    I would use the following approach:
    (1) Generate XML structure (XSD schema) from the IDoc type (on the ERP or via SAP-XI)
    (2) On the BI system fill the empty XML with the data and make the transformation
        back to IDoc structure (EDIDC and EDIDD)
    But how to send these IDoc data via ALE? You need to define the IDoc type (which does not exist on your BI system) as outbound parameter of the partner profile (e.g. ERP as logical system).
    Perhaps you can send the IDoc data using fm MASTER_IDOC_DISTRIBUTE.
    Regards
      Uwe

  • How to create a IDOC program

    Hi All
    i have a requirement where i have to design a screen program to provide the user with a input screen. The user will input data on this screen, after the user enters the data and clicks on execute or some button on the module screen the system must generate a IDOC in the system. This IDOC will be picked up from another program within the same system.The reason we are doing this is the other program cannot be changed and it can accept only an IDOC from the external system which we are going to eliminate.
    My Questions:
    1. What are the steps in this requirement
    2. Do we require the partner profile and port and logical system definition as i am going to create a IDOC in the same system.( i am not sending the IDOC out of the system)
    3. Can i use the MASTER_IDOC_DISTRIBUTE FM to create a IDOC in the database?
    4. Can i use IDOC_CREATE_ON_DATABASE FM to do the same job?
    please guide me with deatils on how to go about this. Thanks
    ~Suresh

    Hi Suresh,
    First try to create a Module pool program.
    Assign the tcode to the IDOC.
    or else get the data into IDOC segment and try to transfer it.
    Creation of IDoc
    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.
    Create IDOC Type
    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
    u can also check all these links related to idocs
    http://www.allsaplinks.com/idoc_sample.html
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sappoint.com/abap.html
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDALEIO/BCMIDALEIO.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCMIDALEPRO/BCMIDALEPRO.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/CABFAALEQS/CABFAALEQS.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVEDISC/CAEDISCAP_STC.pdf
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVEDI/CAEDI.pdf
    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://expertanswercenter.techtarget.com/eac/knowledgebaseCategory/0,295197,sid63_tax296858_idx0_off50,00.html
    http://sap.ittoolbox.com/documents/popular-q-and-a/extending-a-basic-idoc-type-2358
    http://help.sap.com/saphelp_47x200/helpdata/en/dc/6b7eee43d711d1893e0000e8323c4f/frameset.htm
    /thread/199996 [original link is broken]
    Regards,
    Priyanka.

Maybe you are looking for