Skip to Content
author's profile photo Former Member
Former Member

idoc issue

Experts,

I can create a custom idoc in SAP , my question is how can i post these idoc,

for example , for standard idoc type you can trigger and post these idoc with

function module IDOC_WRITE_AND_START_INBOUND OR some tcode, but

if i create a custom IDOC ,how i will be able to post these using above function

module IDOC_WRITE_AND_START_INBOUND

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Jan 10, 2007 at 11:59 PM

    Hi,

    Populate the Control records and the data records and call the FM

    IDOC_INBOUND_ASYNCHRONOUS which will create the IDOC and post..

    Thanks,

    Naren

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Sanju,

      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. 

      Then you can insert this code in your FM.

      Hope it helps,

      Kind Regards,

      Sergio

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 03:22 AM

    Hi sanju,

    These are 2 types 1. Through message control 2.Stand alone.

    1. You have to add this FM to process code .Process will attached to apllication .

    Ex : Purchase order

    Whenever you create PO automatically process code will get trigger and IDOC will created.

    2.You have schedule your program.

    Pls. reward if useful

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 06:02 AM

    Post the IDOC using FM MASTER_IDOC_DISTRIBUTE

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.