<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Outbound in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/outbound/m-p/3487399#M838484</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I presume you want to know about outbound idocs.Refer to the details below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Creating and processing IDocs is primarily a mechanical task, which is certainly true for most interface programming. We will show a short example that packs SAP R/3 SAPscript standard text elements into IDocs and stores them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Outbound IDocs from R/3 are usually created by a function module. This function&lt;/P&gt;&lt;P&gt;module is dynamically called by the IDoc engine. A sophisticated customising&lt;/P&gt;&lt;P&gt;defines the conditions and parameters to find the correct function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The interface parameters of the processing function need to be compatible with a&lt;/P&gt;&lt;P&gt;well-defined standard, because the function module will be called from within&lt;/P&gt;&lt;P&gt;another program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IDoc inbound functions are function modules with a standard interface, which will&lt;/P&gt;&lt;P&gt;interpret the received IDoc data and prepare it for processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The received IDoc data is processed record by record and interpreted according to&lt;/P&gt;&lt;P&gt;the segment information provided with each record. The prepared data can then be&lt;/P&gt;&lt;P&gt;processed by an application, a function module, or a self-written program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example programs in the following chapters will show you how texts from the&lt;/P&gt;&lt;P&gt;text pool can be converted into an IDoc and processed by an inbound routine to be&lt;/P&gt;&lt;P&gt;stored into another system.&lt;/P&gt;&lt;P&gt;The following will give you the basics to understand the example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP R/3 allows the creation of text elements, e.g. with transaction SO10. Each&lt;/P&gt;&lt;P&gt;standard text element has a control record which is stored in table STXH. The text&lt;/P&gt;&lt;P&gt;lines themselves are stored in a special cluster table. To retrieve the text from the&lt;/P&gt;&lt;P&gt;cluster, you will use the standard function module function READ_TEXT . We&lt;/P&gt;&lt;P&gt;will read such a text and pack it into an IDoc. That is what the following simple&lt;/P&gt;&lt;P&gt;function module does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there is no convenient routine to process data, the easiest way to hand over the&lt;/P&gt;&lt;P&gt;data to an application is to record a transaction with transaction SHDB and create a&lt;/P&gt;&lt;P&gt;simple processing function module from that recording.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Outbound routines are called by the triggering application, e.g. the RSNAST00&lt;/P&gt;&lt;P&gt;program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inbound processing is triggered by the central IDoc inbound handler, which is&lt;/P&gt;&lt;P&gt;usually the function module IDOC_INPUT . This function is usually activated by&lt;/P&gt;&lt;P&gt;the gatekeeper who receives the IDoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Outbound is triggered by the application.&lt;/P&gt;&lt;P&gt;Inbound is triggered by an external event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The most difficult work when creating outbound IDocs is the retrieval of the application data which needs sending. Once the data is retrieved, it needs to be converted to IDoc format, only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each R/3 standard text element has a header record which is stored in table STXH.&lt;/P&gt;&lt;P&gt;The text lines themselves are stored in a special cluster table. To retrieve the text&lt;/P&gt;&lt;P&gt;from the cluster, you will use the standard function module function&lt;/P&gt;&lt;P&gt;READ_TEXT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program below will retrieve a text document from the text pool, convert the text&lt;/P&gt;&lt;P&gt;lines into IDoc format, and create the necessary control information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first step is reading the data from the application database by calling the&lt;/P&gt;&lt;P&gt;function module READ_TEXT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Our next duty is to pack the data into the IDoc record. This means moving the&lt;/P&gt;&lt;P&gt;application data to the data part of the IDoc record structure EDIDD and filling the&lt;/P&gt;&lt;P&gt;corresponding segment information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, we have to provide a correctly filled control record for this IDoc. If the IDoc routine is used in a standard automated environment, it is usually sufficient to fill the field EDIDC-IDOCTP with the IDoc type, EDIDC-MESTYP with the context&lt;/P&gt;&lt;P&gt;message type and the receiver name. The remaining fields are automatically filled&lt;/P&gt;&lt;P&gt;by the standard processing routines if applicable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inbound processing is basically the reverse process of an outbound.. The received IDoc has to be unpacked, interpreted and transferred to an application for further processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The received IDoc data is processed record by record and data is sorted out according to the segment type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the IDoc is unpacked data is passed to the application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally the processing routine needs to pass a status record to the IDoc processor.&lt;/P&gt;&lt;P&gt;This status indicates successful or unsuccessful processing and will be added as a&lt;/P&gt;&lt;P&gt;log entry to the table EDIDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The status value '51' indicates a general error during application processing and the&lt;/P&gt;&lt;P&gt;status '53' indicates everything is OK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example Code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is an individual coding part where you need to retrieve the information from the database and prepare it in the form the recipient of the IDoc will expect the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read data to send :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first step is reading the data from the database, the one you want to send.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION Y_AXX_COOKBOOK_TEXT_IDOC_OUTB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Lokale Schnittstelle:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*" IMPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*" VALUE(I_TDOBJECT) LIKE THEAD-TDOBJECT DEFAULT 'TEXT'&lt;/P&gt;&lt;P&gt;*" VALUE(I_TDID) LIKE THEAD-TDID DEFAULT 'ST'&lt;/P&gt;&lt;P&gt;*" VALUE(I_TDNAME) LIKE THEAD-TDNAME&lt;/P&gt;&lt;P&gt;*" VALUE(I_TDSPRAS) LIKE THEAD-TDSPRAS DEFAULT SY-LANGU&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*" EXPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*" VALUE(E_THEAD) LIKE THEAD STRUCTURE THEAD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*" TABLES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*" IDOC_DATA STRUCTURE EDIDD OPTIONAL&lt;/P&gt;&lt;P&gt;*" IDOC_CONTRL STRUCTURE EDIDC OPTIONAL&lt;/P&gt;&lt;P&gt;*" TLINES STRUCTURE TLINE OPTIONAL&lt;/P&gt;&lt;P&gt;*" EXCEPTIONS&lt;/P&gt;&lt;P&gt;*" FUNCTION_NOT_EXIST&lt;/P&gt;&lt;P&gt;*" VERSION_NOT_FOUND&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;CALL FUNCTION 'READ_TEXT'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ID = ID&lt;/P&gt;&lt;P&gt;LANGUAGE = LANGUAGE&lt;/P&gt;&lt;P&gt;NAME = NAME&lt;/P&gt;&lt;P&gt;OBJECT = OBJECT&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;LINES = LINES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;now stuff the data into the Idoc record format&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;PERFORM PACK_LINE TABLES IDOC_DATA USING 'THEAD' E_THEAD.&lt;/P&gt;&lt;P&gt;LOOP AT LINES.&lt;/P&gt;&lt;P&gt;PERFORM PACK_LINE TABLES IDOC_DATA USING 'THEAD' LINES.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Converting Data into IDoc Segment Format :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The physical format of the IDocs records is always the same. Therefore, the application data must be converted into a 1000 character string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fill the data segments which make up the IDoc :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An IDoc is a file with a rigid formal structure. This allows the correspondents to&lt;/P&gt;&lt;P&gt;correctly interpret the IDoc information. Were it for data exchange between SAPsystems only, the IDoc segments could be simply structured like the correspondent&lt;/P&gt;&lt;P&gt;DDIC structure of the tables whose data is sent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, IDocs are usually transported to a variety of legacy systems which do not&lt;/P&gt;&lt;P&gt;run SAP. Both correspondents therefore would agree on an IDoc structure which is&lt;/P&gt;&lt;P&gt;known to the sending and the receiving processes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transfer the whole IDoc to an internal table, having the structure of EDIDD :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All data needs to be compiled in an internal table with the structure of the standard&lt;/P&gt;&lt;P&gt;SAP table EDIDD. The records for EDIDD are principally made up of a header&lt;/P&gt;&lt;P&gt;string describing the segment and a variable length character field (called SDATA)&lt;/P&gt;&lt;P&gt;which will contain the actual segment data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM PACK_LINE TABLES IDOC_DATA USING 'THEAD' E_THEAD.&lt;/P&gt;&lt;P&gt;TABLES: THEAD.&lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING E:THEAD to Z1THEAD.&lt;/P&gt;&lt;P&gt;MOVE &amp;#130;Z1THEAD&amp;#146; TO IDOC_DATA-SEGNAM.&lt;/P&gt;&lt;P&gt;MOVE Z1THEAD TO IDOC_DATA-SDATA.&lt;/P&gt;&lt;P&gt;APPEND IDOC_DATA.&lt;/P&gt;&lt;P&gt;ENDFORM.&amp;#147;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fill control record :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, the control record has to be filled with meaningful data, especially telling&lt;/P&gt;&lt;P&gt;the IDoc type and message type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF IDOC_CONTRL-SNDPRN IS INITIAL.&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM T000 WHERE MANDT EQ SY-MANDT.&lt;/P&gt;&lt;P&gt;MOVE T000-LOGSYS TO IDOC_CONTRL-SNDPRN.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IDOC_CONTRL-SNDPRT = 'LS'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Trans we20 -&amp;gt; Outbound Controls muss entsprechend gesetzt werden.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;2 = Transfer IDoc immediately&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;4 = Collect IDocs&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;IDOC_CONTRL-OUTMOD = '2'. "1=imediately, subsystem&lt;/P&gt;&lt;P&gt;CLEAR IDOC_CONTRL.&lt;/P&gt;&lt;P&gt;IDOC_CONTRL-IDOCTP = 'YAXX_TEXT'.&lt;/P&gt;&lt;P&gt;APPEND IDOC_CONTRL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sandeep.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 12 Mar 2008 11:06:38 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-03-12T11:06:38Z</dc:date>
    <item>
      <title>Outbound</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/outbound/m-p/3487398#M838483</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Experts,&lt;/P&gt;&lt;P&gt;                 I dont have any idea abt Outbound.&lt;/P&gt;&lt;P&gt;                 Could anybody guide me reg.g Outbound.&lt;/P&gt;&lt;P&gt;                 and cud u giv the small example prog .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Ashok&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 10:56:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/outbound/m-p/3487398#M838483</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T10:56:57Z</dc:date>
    </item>
    <item>
      <title>Re: Outbound</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/outbound/m-p/3487399#M838484</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I presume you want to know about outbound idocs.Refer to the details below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Creating and processing IDocs is primarily a mechanical task, which is certainly true for most interface programming. We will show a short example that packs SAP R/3 SAPscript standard text elements into IDocs and stores them.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Outbound IDocs from R/3 are usually created by a function module. This function&lt;/P&gt;&lt;P&gt;module is dynamically called by the IDoc engine. A sophisticated customising&lt;/P&gt;&lt;P&gt;defines the conditions and parameters to find the correct function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The interface parameters of the processing function need to be compatible with a&lt;/P&gt;&lt;P&gt;well-defined standard, because the function module will be called from within&lt;/P&gt;&lt;P&gt;another program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IDoc inbound functions are function modules with a standard interface, which will&lt;/P&gt;&lt;P&gt;interpret the received IDoc data and prepare it for processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The received IDoc data is processed record by record and interpreted according to&lt;/P&gt;&lt;P&gt;the segment information provided with each record. The prepared data can then be&lt;/P&gt;&lt;P&gt;processed by an application, a function module, or a self-written program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The example programs in the following chapters will show you how texts from the&lt;/P&gt;&lt;P&gt;text pool can be converted into an IDoc and processed by an inbound routine to be&lt;/P&gt;&lt;P&gt;stored into another system.&lt;/P&gt;&lt;P&gt;The following will give you the basics to understand the example:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SAP R/3 allows the creation of text elements, e.g. with transaction SO10. Each&lt;/P&gt;&lt;P&gt;standard text element has a control record which is stored in table STXH. The text&lt;/P&gt;&lt;P&gt;lines themselves are stored in a special cluster table. To retrieve the text from the&lt;/P&gt;&lt;P&gt;cluster, you will use the standard function module function READ_TEXT . We&lt;/P&gt;&lt;P&gt;will read such a text and pack it into an IDoc. That is what the following simple&lt;/P&gt;&lt;P&gt;function module does.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If there is no convenient routine to process data, the easiest way to hand over the&lt;/P&gt;&lt;P&gt;data to an application is to record a transaction with transaction SHDB and create a&lt;/P&gt;&lt;P&gt;simple processing function module from that recording.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Outbound routines are called by the triggering application, e.g. the RSNAST00&lt;/P&gt;&lt;P&gt;program.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inbound processing is triggered by the central IDoc inbound handler, which is&lt;/P&gt;&lt;P&gt;usually the function module IDOC_INPUT . This function is usually activated by&lt;/P&gt;&lt;P&gt;the gatekeeper who receives the IDoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Outbound is triggered by the application.&lt;/P&gt;&lt;P&gt;Inbound is triggered by an external event.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The most difficult work when creating outbound IDocs is the retrieval of the application data which needs sending. Once the data is retrieved, it needs to be converted to IDoc format, only.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Each R/3 standard text element has a header record which is stored in table STXH.&lt;/P&gt;&lt;P&gt;The text lines themselves are stored in a special cluster table. To retrieve the text&lt;/P&gt;&lt;P&gt;from the cluster, you will use the standard function module function&lt;/P&gt;&lt;P&gt;READ_TEXT. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The program below will retrieve a text document from the text pool, convert the text&lt;/P&gt;&lt;P&gt;lines into IDoc format, and create the necessary control information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first step is reading the data from the application database by calling the&lt;/P&gt;&lt;P&gt;function module READ_TEXT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Our next duty is to pack the data into the IDoc record. This means moving the&lt;/P&gt;&lt;P&gt;application data to the data part of the IDoc record structure EDIDD and filling the&lt;/P&gt;&lt;P&gt;corresponding segment information.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, we have to provide a correctly filled control record for this IDoc. If the IDoc routine is used in a standard automated environment, it is usually sufficient to fill the field EDIDC-IDOCTP with the IDoc type, EDIDC-MESTYP with the context&lt;/P&gt;&lt;P&gt;message type and the receiver name. The remaining fields are automatically filled&lt;/P&gt;&lt;P&gt;by the standard processing routines if applicable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Inbound processing is basically the reverse process of an outbound.. The received IDoc has to be unpacked, interpreted and transferred to an application for further processing.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The received IDoc data is processed record by record and data is sorted out according to the segment type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When the IDoc is unpacked data is passed to the application.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally the processing routine needs to pass a status record to the IDoc processor.&lt;/P&gt;&lt;P&gt;This status indicates successful or unsuccessful processing and will be added as a&lt;/P&gt;&lt;P&gt;log entry to the table EDIDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The status value '51' indicates a general error during application processing and the&lt;/P&gt;&lt;P&gt;status '53' indicates everything is OK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Example Code:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is an individual coding part where you need to retrieve the information from the database and prepare it in the form the recipient of the IDoc will expect the data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Read data to send :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first step is reading the data from the database, the one you want to send.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FUNCTION Y_AXX_COOKBOOK_TEXT_IDOC_OUTB.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Lokale Schnittstelle:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*" IMPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*" VALUE(I_TDOBJECT) LIKE THEAD-TDOBJECT DEFAULT 'TEXT'&lt;/P&gt;&lt;P&gt;*" VALUE(I_TDID) LIKE THEAD-TDID DEFAULT 'ST'&lt;/P&gt;&lt;P&gt;*" VALUE(I_TDNAME) LIKE THEAD-TDNAME&lt;/P&gt;&lt;P&gt;*" VALUE(I_TDSPRAS) LIKE THEAD-TDSPRAS DEFAULT SY-LANGU&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*" EXPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*" VALUE(E_THEAD) LIKE THEAD STRUCTURE THEAD&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*" TABLES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*" IDOC_DATA STRUCTURE EDIDD OPTIONAL&lt;/P&gt;&lt;P&gt;*" IDOC_CONTRL STRUCTURE EDIDC OPTIONAL&lt;/P&gt;&lt;P&gt;*" TLINES STRUCTURE TLINE OPTIONAL&lt;/P&gt;&lt;P&gt;*" EXCEPTIONS&lt;/P&gt;&lt;P&gt;*" FUNCTION_NOT_EXIST&lt;/P&gt;&lt;P&gt;*" VERSION_NOT_FOUND&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;CALL FUNCTION 'READ_TEXT'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;EXPORTING&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ID = ID&lt;/P&gt;&lt;P&gt;LANGUAGE = LANGUAGE&lt;/P&gt;&lt;P&gt;NAME = NAME&lt;/P&gt;&lt;P&gt;OBJECT = OBJECT&lt;/P&gt;&lt;P&gt;TABLES&lt;/P&gt;&lt;P&gt;LINES = LINES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;now stuff the data into the Idoc record format&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;PERFORM PACK_LINE TABLES IDOC_DATA USING 'THEAD' E_THEAD.&lt;/P&gt;&lt;P&gt;LOOP AT LINES.&lt;/P&gt;&lt;P&gt;PERFORM PACK_LINE TABLES IDOC_DATA USING 'THEAD' LINES.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;ENDFUNCTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Converting Data into IDoc Segment Format :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The physical format of the IDocs records is always the same. Therefore, the application data must be converted into a 1000 character string.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fill the data segments which make up the IDoc :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;An IDoc is a file with a rigid formal structure. This allows the correspondents to&lt;/P&gt;&lt;P&gt;correctly interpret the IDoc information. Were it for data exchange between SAPsystems only, the IDoc segments could be simply structured like the correspondent&lt;/P&gt;&lt;P&gt;DDIC structure of the tables whose data is sent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, IDocs are usually transported to a variety of legacy systems which do not&lt;/P&gt;&lt;P&gt;run SAP. Both correspondents therefore would agree on an IDoc structure which is&lt;/P&gt;&lt;P&gt;known to the sending and the receiving processes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Transfer the whole IDoc to an internal table, having the structure of EDIDD :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;All data needs to be compiled in an internal table with the structure of the standard&lt;/P&gt;&lt;P&gt;SAP table EDIDD. The records for EDIDD are principally made up of a header&lt;/P&gt;&lt;P&gt;string describing the segment and a variable length character field (called SDATA)&lt;/P&gt;&lt;P&gt;which will contain the actual segment data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM PACK_LINE TABLES IDOC_DATA USING 'THEAD' E_THEAD.&lt;/P&gt;&lt;P&gt;TABLES: THEAD.&lt;/P&gt;&lt;P&gt;MOVE-CORRESPONDING E:THEAD to Z1THEAD.&lt;/P&gt;&lt;P&gt;MOVE &amp;#130;Z1THEAD&amp;#146; TO IDOC_DATA-SEGNAM.&lt;/P&gt;&lt;P&gt;MOVE Z1THEAD TO IDOC_DATA-SDATA.&lt;/P&gt;&lt;P&gt;APPEND IDOC_DATA.&lt;/P&gt;&lt;P&gt;ENDFORM.&amp;#147;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Fill control record :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Finally, the control record has to be filled with meaningful data, especially telling&lt;/P&gt;&lt;P&gt;the IDoc type and message type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IF IDOC_CONTRL-SNDPRN IS INITIAL.&lt;/P&gt;&lt;P&gt;SELECT SINGLE * FROM T000 WHERE MANDT EQ SY-MANDT.&lt;/P&gt;&lt;P&gt;MOVE T000-LOGSYS TO IDOC_CONTRL-SNDPRN.&lt;/P&gt;&lt;P&gt;ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;IDOC_CONTRL-SNDPRT = 'LS'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Trans we20 -&amp;gt; Outbound Controls muss entsprechend gesetzt werden.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;2 = Transfer IDoc immediately&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;4 = Collect IDocs&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;IDOC_CONTRL-OUTMOD = '2'. "1=imediately, subsystem&lt;/P&gt;&lt;P&gt;CLEAR IDOC_CONTRL.&lt;/P&gt;&lt;P&gt;IDOC_CONTRL-IDOCTP = 'YAXX_TEXT'.&lt;/P&gt;&lt;P&gt;APPEND IDOC_CONTRL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Sandeep.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 11:06:38 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/outbound/m-p/3487399#M838484</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T11:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Outbound</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/outbound/m-p/3487400#M838485</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     Below is a sample outbound IDOC generation program.&lt;/P&gt;&lt;P&gt;to extract two fields from a Z table - 'zvista_pm_t' . This table has to be created in ur R/3 system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;REPORT  zgbsend_idoc                            .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CONSTANTS: c_mestyp TYPE edidc-mestyp VALUE 'ZVISTAPM',&lt;/P&gt;&lt;P&gt;  c_doctyp TYPE edidc-idoctp VALUE 'ZVISTAPM01',&lt;/P&gt;&lt;P&gt;  c_segnam TYPE edidd-segnam VALUE 'Z1VISTAPM'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  DATA: i_zvista_pm TYPE ZVISTA_PM_T OCCURS 6000,&lt;/P&gt;&lt;P&gt;        i_edidc TYPE edidc OCCURS 0,&lt;/P&gt;&lt;P&gt;        i_edidd TYPE edidd OCCURS 0,&lt;/P&gt;&lt;P&gt;        wa_zvista_pm TYPE zvista_pm_t,&lt;/P&gt;&lt;P&gt;        wa_edidc TYPE edidc,&lt;/P&gt;&lt;P&gt;        wa_edidd TYPE edidd,&lt;/P&gt;&lt;P&gt;        wa_z1vistapm TYPE z1vistapm,&lt;/P&gt;&lt;P&gt;        v_occmax TYPE idocsyn-occmax,&lt;/P&gt;&lt;P&gt;        v_nbseg TYPE i.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR wa_zvista_pm.CLEAR wa_edidc.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Save the message type and the basic IDoc type* in the control segment&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  MOVE c_mestyp TO wa_edidc-mestyp.MOVE c_doctyp TO wa_edidc-idoctp.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Retrieve the maximum number of segments in the basic IDoc type&lt;/P&gt;&lt;P&gt;  SELECT MIN( occmax ) FROM idocsyn INTO v_occmax WHERE idoctyp EQ c_doctyp AND segtyp EQ c_segnam.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Save the whole ZVISTA_PM_T table content&lt;/STRONG&gt; in the I_ZVISTA_PM internal table.&lt;/P&gt;&lt;P&gt;  SELECT * from zvista_pm_t into corresponding fields of table i_zvista_pm.&lt;/P&gt;&lt;P&gt;*Create a data segment for each line of I_ZVISTA_PM&lt;/P&gt;&lt;P&gt;    LOOP AT i_zvista_pm INTO wa_zvista_pm.&lt;/P&gt;&lt;P&gt;      MOVE-CORRESPONDING wa_zvista_pm TO wa_z1vistapm.&lt;/P&gt;&lt;P&gt;      CLEAR wa_edidd.&lt;/P&gt;&lt;P&gt;      MOVE c_segnam TO wa_edidd-segnam.&lt;/P&gt;&lt;P&gt;      MOVE wa_z1vistapm TO wa_edidd-sdata.&lt;/P&gt;&lt;P&gt;      APPEND wa_edidd TO i_edidd.&lt;/P&gt;&lt;P&gt;      CLEAR wa_zvista_pm.&lt;/P&gt;&lt;P&gt;      CLEAR wa_z1vistapm.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;*Count the number of data segments&lt;/P&gt;&lt;P&gt;    DESCRIBE TABLE i_edidd LINES v_nbseg.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   IF the NUMBER of DATA segments EXCEEDS the MAXIMUM* allowed NUMBER, then edit a message in the spool,* then display an error message (quit the program)&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    if v_nbseg gt v_occmax.&lt;/P&gt;&lt;P&gt;      WRITE:/ text-003, v_occmax.&lt;/P&gt;&lt;P&gt;      MESSAGE 'Data Segments exceeds its maximun number' type 'E'.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;   CALL the idoc creation function&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;    call function 'MASTER_IDOC_DISTRIBUTE'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        master_idoc_control            = wa_edidc&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        communication_idoc_control     = i_edidc&lt;/P&gt;&lt;P&gt;        master_idoc_data               = i_edidd&lt;/P&gt;&lt;P&gt;      EXCEPTIONS&lt;/P&gt;&lt;P&gt;        error_in_idoc_control          = 1&lt;/P&gt;&lt;P&gt;        error_writing_idoc_status      = 2&lt;/P&gt;&lt;P&gt;        error_in_idoc_data             = 3&lt;/P&gt;&lt;P&gt;        sending_logical_system_unknown = 4&lt;/P&gt;&lt;P&gt;        OTHERS                         = 5.&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;If there was an error, display a message (quit the&lt;/STRONG&gt; program)&lt;/P&gt;&lt;P&gt;    IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt; MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO&lt;/P&gt;&lt;P&gt;         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;*&lt;STRONG&gt;End of Program&lt;/STRONG&gt;*&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;below check the link.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;[IDOC creation Inbound and Outbound|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/step%2bby%2bstep%2bprocedure%2bfor%2bcreation%2bof%2bidoc]&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Mar 2008 11:07:53 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/outbound/m-p/3487400#M838485</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-03-12T11:07:53Z</dc:date>
    </item>
  </channel>
</rss>

