<?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: Inbound Custom IDoc Processing in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-custom-idoc-processing/m-p/1421594#M202341</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;For CUSTOM IDOC inbound processing &lt;/P&gt;&lt;P&gt;Firstly attach your idoc to a process code.&lt;/P&gt;&lt;P&gt;In the process cod you can tell the system that the specified program should be triggered whenever an idoc of that type comes to the system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you want to have a Z-function module for your idoc processing, if I understand correctly.The steps should be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Create a z function module for idoc inbound posting (copy from a function module idoc_input_*).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Set Function Modules as Inbound: - Transaction BD51&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Assign Function Modules to Logical Messages and Idoc types:- Transaction WE57&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Create process codes : Transaction WE42, and link the z-function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. Create partner profile: transaction WE20 and attach the message type and process code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. In the Z- function module, extract data from the idoc segments, do whatever processing you want to do, and then call BAPI_CREATE_SALES_ORDER_FROMDAT2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check out this sample Function Module on the inbound system&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------" /&gt;&lt;P&gt;FUNCTION Z_IDOC_INPUT_EMPREP.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local interface:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(INPUT_METHOD) LIKE  BDWFAP_PAR-INPUTMETHD&lt;/P&gt;&lt;P&gt;*"     VALUE(MASS_PROCESSING) LIKE  BDWFAP_PAR-MASS_PROC&lt;/P&gt;&lt;P&gt;*"  EXPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(WORKFLOW_RESULT) LIKE  BDWFAP_PAR-RESULT&lt;/P&gt;&lt;P&gt;*"     VALUE(APPLICATION_VARIABLE) LIKE  BDWFAP_PAR-APPL_VAR&lt;/P&gt;&lt;P&gt;*"     VALUE(IN_UPDATE_TASK) LIKE  BDWFAP_PAR-UPDATETASK&lt;/P&gt;&lt;P&gt;*"     VALUE(CALL_TRANSACTION_DONE) LIKE  BDWFAP_PAR-CALLTRANS&lt;/P&gt;&lt;P&gt;*"  TABLES&lt;/P&gt;&lt;P&gt;*"      IDOC_CONTRL STRUCTURE  EDIDC&lt;/P&gt;&lt;P&gt;*"      IDOC_DATA STRUCTURE  EDIDD&lt;/P&gt;&lt;P&gt;*"      IDOC_STATUS STRUCTURE  BDIDOCSTAT&lt;/P&gt;&lt;P&gt;*"      RETURN_VARIABLES STRUCTURE  BDWFRETVAR&lt;/P&gt;&lt;P&gt;*"      SERIALIZATION_INFO STRUCTURE  BDI_SER&lt;/P&gt;&lt;P&gt;*"  EXCEPTIONS&lt;/P&gt;&lt;P&gt;*"      WRONG_FUNCTION_CALLED&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Database Tables&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  TABLES: ZAK_EMPLIST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Include programs&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  INCLUDE MBDCONWF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Data Declarations&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- Employee Header -IDOC&lt;/P&gt;&lt;P&gt;  DATA: FS_EMPHDR_DATA LIKE Z1R_SEG1.&lt;/P&gt;&lt;P&gt;*--- Employee Details -IDOC&lt;/P&gt;&lt;P&gt;  DATA: FS_EMPDET_DATA LIKE Z1R_SEG2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- Employee Header - application data&lt;/P&gt;&lt;P&gt;  DATA: FS_APP_EMPHDR LIKE ZAK_EMPLIST.&lt;/P&gt;&lt;P&gt;*--- Employee Details - application data&lt;/P&gt;&lt;P&gt;  DATA: FS_APP_EMPDET LIKE ZAK_EMPLIST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Program Logic&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*---Initialize Work Flow Result&lt;/P&gt;&lt;P&gt;  WORKFLOW_RESULT = C_WF_RESULT_OK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT IDOC_CONTRL.&lt;/P&gt;&lt;P&gt;*--- Check whether the correct message was passed to us&lt;/P&gt;&lt;P&gt;  IF IDOC_CONTRL-MESTYP NE 'ZR_MSG'.&lt;/P&gt;&lt;P&gt;      RAISE WRONG_FUNCTION_CALLED.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- Clear application buffers before reading a new record&lt;/P&gt;&lt;P&gt;  CLEAR   FS_APP_EMPDET.&lt;/P&gt;&lt;P&gt;  CLEAR   FS_APP_EMPHDR.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; REFRESH FS_APP_EMPDET.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; REFRESH FS_APP_EMPDET.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- Process all records and pass them on to application buffers&lt;/P&gt;&lt;P&gt;    LOOP AT IDOC_DATA WHERE DOCNUM EQ IDOC_CONTRL-DOCNUM.&lt;/P&gt;&lt;P&gt;      CASE IDOC_DATA-SEGNAM.&lt;/P&gt;&lt;P&gt;        WHEN 'Z1R_SEG1'.            " Employee Header&lt;/P&gt;&lt;P&gt;          FS_EMPHDR_DATA = IDOC_DATA-SDATA.&lt;/P&gt;&lt;P&gt;          MOVE-CORRESPONDING FS_EMPHDR_DATA TO FS_APP_EMPHDR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        WHEN 'Z1R_SEG2'.            " Employee Details&lt;/P&gt;&lt;P&gt;          FS_EMPDET_DATA = IDOC_DATA-SDATA.&lt;/P&gt;&lt;P&gt;          MOVE-CORRESPONDING FS_EMPDET_DATA TO FS_APP_EMPDET.&lt;/P&gt;&lt;P&gt;      ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- If data is ok&lt;/P&gt;&lt;P&gt;  SELECT * FROM ZAK_EMPLIST WHERE ENUMBER = FS_APP_EMPHDR.&lt;/P&gt;&lt;P&gt;    IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;      INSERT INTO ZAK_EMPLIST VALUES FS_APP_EMPHDR.&lt;/P&gt;&lt;P&gt;      INSERT INTO ZAK_EMPLIST VALUES FS_APP_EMPDET.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      UPDATE ZAK_EMPLIST FROM FS_APP_EMPHDR.&lt;/P&gt;&lt;P&gt;      UPDATE ZAK_EMPLIST FROM FS_APP_EMPDET.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC EQ 0.&lt;/P&gt;&lt;P&gt;*--- Populate Return variables for success&lt;/P&gt;&lt;P&gt;      RETURN_VARIABLES-WF_PARAM    = 'Processed_IDOCs'.&lt;/P&gt;&lt;P&gt;      RETURN_VARIABLES-DOC_NUMBER  = IDOC_CONTRL-DOCNUM.&lt;/P&gt;&lt;P&gt;      RETURN_VARIABLES-WF_PARAM    = 'Appl_Objects'.&lt;/P&gt;&lt;P&gt;      RETURN_VARIABLES-DOC_NUMBER  = FS_APP_EMPHDR-ENUMBER.&lt;/P&gt;&lt;P&gt;      APPEND RETURN_VARIABLES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- Add Status Reocrds indicating success&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-DOCNUM           = IDOC_CONTRL-DOCNUM.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-STATUS           = '53'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGTY            = 'I'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGID            = 'ZE'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGNO            = '006'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGV1            = FS_APP_EMPHDR-ENUMBER.&lt;/P&gt;&lt;P&gt;      APPEND IDOC_STATUS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;      WORKFLOW_RESULT              = C_WF_RESULT_ERROR.&lt;/P&gt;&lt;P&gt;      RETURN_VARIABLES-WF_PARAM    = 'Error IDOCs'.&lt;/P&gt;&lt;P&gt;      RETURN_VARIABLES-DOC_NUMBER  = IDOC_CONTRL-DOCNUM.&lt;/P&gt;&lt;P&gt;      APPEND RETURN_VARIABLES.&lt;/P&gt;&lt;P&gt;*--- Add status record indicating failure in updating&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-DOCNUM           = IDOC_CONTRL-DOCNUM.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-STATUS           = '51'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGTY            = 'E'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGID            = 'ZE'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGNO            = '007'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGV1            = FS_APP_EMPHDR-ENUMBER.&lt;/P&gt;&lt;P&gt;      APPEND IDOC_STATUS.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good Luck and reward me for the same&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ashok&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 22 Jun 2006 14:01:04 GMT</pubDate>
    <dc:creator>ashok_kumar24</dc:creator>
    <dc:date>2006-06-22T14:01:04Z</dc:date>
    <item>
      <title>Inbound Custom IDoc Processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-custom-idoc-processing/m-p/1421593#M202340</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've created an Inbound Custom IDoc, Created the ABAP function module to post it to the application, configured workflow and IDoc processing.  All my setup appears fine as I can create IDocs from our AS400 subsystem and trigger a successful posting via the IDoc test tool.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Having got this working I now want to automate the posting.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At present I create the IDoc's on our Legacy AS400 System and FTP them onto the SAP Application Server which runs on a Windows 2003 platform.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;How do I get SAP to process each of my waiting Idoc's?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any examples appreciated....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 13:57:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-custom-idoc-processing/m-p/1421593#M202340</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2006-06-22T13:57:08Z</dc:date>
    </item>
    <item>
      <title>Re: Inbound Custom IDoc Processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-custom-idoc-processing/m-p/1421594#M202341</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;For CUSTOM IDOC inbound processing &lt;/P&gt;&lt;P&gt;Firstly attach your idoc to a process code.&lt;/P&gt;&lt;P&gt;In the process cod you can tell the system that the specified program should be triggered whenever an idoc of that type comes to the system.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Then you want to have a Z-function module for your idoc processing, if I understand correctly.The steps should be:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1. Create a z function module for idoc inbound posting (copy from a function module idoc_input_*).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2. Set Function Modules as Inbound: - Transaction BD51&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3. Assign Function Modules to Logical Messages and Idoc types:- Transaction WE57&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;4. Create process codes : Transaction WE42, and link the z-function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;5. Create partner profile: transaction WE20 and attach the message type and process code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;6. In the Z- function module, extract data from the idoc segments, do whatever processing you want to do, and then call BAPI_CREATE_SALES_ORDER_FROMDAT2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check out this sample Function Module on the inbound system&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------" /&gt;&lt;P&gt;FUNCTION Z_IDOC_INPUT_EMPREP.&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;STRONG&gt;"&lt;/STRONG&gt;"Local interface:&lt;/P&gt;&lt;P&gt;*"  IMPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(INPUT_METHOD) LIKE  BDWFAP_PAR-INPUTMETHD&lt;/P&gt;&lt;P&gt;*"     VALUE(MASS_PROCESSING) LIKE  BDWFAP_PAR-MASS_PROC&lt;/P&gt;&lt;P&gt;*"  EXPORTING&lt;/P&gt;&lt;P&gt;*"     VALUE(WORKFLOW_RESULT) LIKE  BDWFAP_PAR-RESULT&lt;/P&gt;&lt;P&gt;*"     VALUE(APPLICATION_VARIABLE) LIKE  BDWFAP_PAR-APPL_VAR&lt;/P&gt;&lt;P&gt;*"     VALUE(IN_UPDATE_TASK) LIKE  BDWFAP_PAR-UPDATETASK&lt;/P&gt;&lt;P&gt;*"     VALUE(CALL_TRANSACTION_DONE) LIKE  BDWFAP_PAR-CALLTRANS&lt;/P&gt;&lt;P&gt;*"  TABLES&lt;/P&gt;&lt;P&gt;*"      IDOC_CONTRL STRUCTURE  EDIDC&lt;/P&gt;&lt;P&gt;*"      IDOC_DATA STRUCTURE  EDIDD&lt;/P&gt;&lt;P&gt;*"      IDOC_STATUS STRUCTURE  BDIDOCSTAT&lt;/P&gt;&lt;P&gt;*"      RETURN_VARIABLES STRUCTURE  BDWFRETVAR&lt;/P&gt;&lt;P&gt;*"      SERIALIZATION_INFO STRUCTURE  BDI_SER&lt;/P&gt;&lt;P&gt;*"  EXCEPTIONS&lt;/P&gt;&lt;P&gt;*"      WRONG_FUNCTION_CALLED&lt;/P&gt;&lt;P&gt;*"----&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Database Tables&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  TABLES: ZAK_EMPLIST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Include programs&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  INCLUDE MBDCONWF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Data Declarations&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- Employee Header -IDOC&lt;/P&gt;&lt;P&gt;  DATA: FS_EMPHDR_DATA LIKE Z1R_SEG1.&lt;/P&gt;&lt;P&gt;*--- Employee Details -IDOC&lt;/P&gt;&lt;P&gt;  DATA: FS_EMPDET_DATA LIKE Z1R_SEG2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- Employee Header - application data&lt;/P&gt;&lt;P&gt;  DATA: FS_APP_EMPHDR LIKE ZAK_EMPLIST.&lt;/P&gt;&lt;P&gt;*--- Employee Details - application data&lt;/P&gt;&lt;P&gt;  DATA: FS_APP_EMPDET LIKE ZAK_EMPLIST.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; Program Logic&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;STRONG&gt;----&lt;/STRONG&gt;&lt;/P&gt;&lt;HR originaltext="-----------------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*---Initialize Work Flow Result&lt;/P&gt;&lt;P&gt;  WORKFLOW_RESULT = C_WF_RESULT_OK.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT IDOC_CONTRL.&lt;/P&gt;&lt;P&gt;*--- Check whether the correct message was passed to us&lt;/P&gt;&lt;P&gt;  IF IDOC_CONTRL-MESTYP NE 'ZR_MSG'.&lt;/P&gt;&lt;P&gt;      RAISE WRONG_FUNCTION_CALLED.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- Clear application buffers before reading a new record&lt;/P&gt;&lt;P&gt;  CLEAR   FS_APP_EMPDET.&lt;/P&gt;&lt;P&gt;  CLEAR   FS_APP_EMPHDR.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; REFRESH FS_APP_EMPDET.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; REFRESH FS_APP_EMPDET.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- Process all records and pass them on to application buffers&lt;/P&gt;&lt;P&gt;    LOOP AT IDOC_DATA WHERE DOCNUM EQ IDOC_CONTRL-DOCNUM.&lt;/P&gt;&lt;P&gt;      CASE IDOC_DATA-SEGNAM.&lt;/P&gt;&lt;P&gt;        WHEN 'Z1R_SEG1'.            " Employee Header&lt;/P&gt;&lt;P&gt;          FS_EMPHDR_DATA = IDOC_DATA-SDATA.&lt;/P&gt;&lt;P&gt;          MOVE-CORRESPONDING FS_EMPHDR_DATA TO FS_APP_EMPHDR.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;        WHEN 'Z1R_SEG2'.            " Employee Details&lt;/P&gt;&lt;P&gt;          FS_EMPDET_DATA = IDOC_DATA-SDATA.&lt;/P&gt;&lt;P&gt;          MOVE-CORRESPONDING FS_EMPDET_DATA TO FS_APP_EMPDET.&lt;/P&gt;&lt;P&gt;      ENDCASE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- If data is ok&lt;/P&gt;&lt;P&gt;  SELECT * FROM ZAK_EMPLIST WHERE ENUMBER = FS_APP_EMPHDR.&lt;/P&gt;&lt;P&gt;    IF SY-SUBRC NE 0.&lt;/P&gt;&lt;P&gt;      INSERT INTO ZAK_EMPLIST VALUES FS_APP_EMPHDR.&lt;/P&gt;&lt;P&gt;      INSERT INTO ZAK_EMPLIST VALUES FS_APP_EMPDET.&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;P&gt;      UPDATE ZAK_EMPLIST FROM FS_APP_EMPHDR.&lt;/P&gt;&lt;P&gt;      UPDATE ZAK_EMPLIST FROM FS_APP_EMPDET.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF SY-SUBRC EQ 0.&lt;/P&gt;&lt;P&gt;*--- Populate Return variables for success&lt;/P&gt;&lt;P&gt;      RETURN_VARIABLES-WF_PARAM    = 'Processed_IDOCs'.&lt;/P&gt;&lt;P&gt;      RETURN_VARIABLES-DOC_NUMBER  = IDOC_CONTRL-DOCNUM.&lt;/P&gt;&lt;P&gt;      RETURN_VARIABLES-WF_PARAM    = 'Appl_Objects'.&lt;/P&gt;&lt;P&gt;      RETURN_VARIABLES-DOC_NUMBER  = FS_APP_EMPHDR-ENUMBER.&lt;/P&gt;&lt;P&gt;      APPEND RETURN_VARIABLES.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*--- Add Status Reocrds indicating success&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-DOCNUM           = IDOC_CONTRL-DOCNUM.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-STATUS           = '53'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGTY            = 'I'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGID            = 'ZE'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGNO            = '006'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGV1            = FS_APP_EMPHDR-ENUMBER.&lt;/P&gt;&lt;P&gt;      APPEND IDOC_STATUS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ELSE.&lt;/P&gt;&lt;P&gt;      WORKFLOW_RESULT              = C_WF_RESULT_ERROR.&lt;/P&gt;&lt;P&gt;      RETURN_VARIABLES-WF_PARAM    = 'Error IDOCs'.&lt;/P&gt;&lt;P&gt;      RETURN_VARIABLES-DOC_NUMBER  = IDOC_CONTRL-DOCNUM.&lt;/P&gt;&lt;P&gt;      APPEND RETURN_VARIABLES.&lt;/P&gt;&lt;P&gt;*--- Add status record indicating failure in updating&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-DOCNUM           = IDOC_CONTRL-DOCNUM.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-STATUS           = '51'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGTY            = 'E'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGID            = 'ZE'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGNO            = '007'.&lt;/P&gt;&lt;P&gt;      IDOC_STATUS-MSGV1            = FS_APP_EMPHDR-ENUMBER.&lt;/P&gt;&lt;P&gt;      APPEND IDOC_STATUS.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&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;&lt;/P&gt;&lt;P&gt;-&lt;/P&gt;&lt;HR originaltext="----------------------------------------------------------" /&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good Luck and reward me for the same&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ashok&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 14:01:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-custom-idoc-processing/m-p/1421594#M202341</guid>
      <dc:creator>ashok_kumar24</dc:creator>
      <dc:date>2006-06-22T14:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Inbound Custom IDoc Processing</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-custom-idoc-processing/m-p/1421595#M202342</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Simon,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Welcome to SDN.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I never work with SAP for Window 2003.&lt;/P&gt;&lt;P&gt;But you can try the following.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If your IDoc is a flat file then you can run the standard&lt;/P&gt;&lt;P&gt;program &amp;lt;b&amp;gt;RSEINB00&amp;lt;/b&amp;gt; to upload the IDoc file and generate the IDoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you setup the partner profile to be processed by background job, then you can run standard program &amp;lt;b&amp;gt;RBDAPP01&amp;lt;/b&amp;gt; to post to the application. Otherwise, the IDoc will be automatically posted. You can go to transaction &amp;lt;b&amp;gt;WE02&amp;lt;/b&amp;gt; to check the IDoc status.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the end, you can schedule SAP job to automate the above process. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this will help. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Ferry Lianto&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please reward points if helpful as a way to say thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 22 Jun 2006 14:35:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-custom-idoc-processing/m-p/1421595#M202342</guid>
      <dc:creator>ferry_lianto</dc:creator>
      <dc:date>2006-06-22T14:35:25Z</dc:date>
    </item>
  </channel>
</rss>

