<?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 posting program is not triggering in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-posting-program-is-not-triggering/m-p/1043398#M87156</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi john,&lt;/P&gt;&lt;P&gt;   thanks for ur reply.but what i am trying to say is when i process the idoc in WE19 my fnmodule will split the idoc based upon 480 pickable line items .so a single idoc is read and it is converted into multiple idoc's. the idoc which is executed through WE19 will be changed to status 70.&lt;/P&gt;&lt;P&gt;  for example an idoc with 960 line items should be split as an single idoc with 480 and one more idoc with 480 line items.so when i split the idoc my fn module splits the idoc but i again get an idoc with 62 status also generated with all the line items. and also i get the spliitted line items in wrong sequence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is the code: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT docnum FROM edidc INTO TABLE it_idoc&lt;/P&gt;&lt;P&gt;                         WHERE status = '64'&lt;/P&gt;&lt;P&gt;                         AND mestyp = 'ORDERS'&lt;/P&gt;&lt;P&gt;                         AND  idoctp = 'ORDERS05'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   LOOP AT it_idoc INTO wa_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Selecting the IDOCDATA of selected IDocs.&lt;/P&gt;&lt;P&gt;    SELECT docnum&lt;/P&gt;&lt;P&gt;           segnum&lt;/P&gt;&lt;P&gt;           segnam&lt;/P&gt;&lt;P&gt;           psgnum&lt;/P&gt;&lt;P&gt;           sdata&lt;/P&gt;&lt;P&gt;           FROM edid4&lt;/P&gt;&lt;P&gt;           INTO CORRESPONDING FIELDS OF TABLE it_edidd&lt;/P&gt;&lt;P&gt;           WHERE docnum = wa_idoc-docnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    it_edidd_new1[] = it_edidd[].&lt;/P&gt;&lt;P&gt;    it_edidd_new2[] = it_edidd[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT it_edidd INTO edidd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      CASE edidd-segnam.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*material is got from segement 'e1edp19-idtnr'.&lt;/P&gt;&lt;P&gt;        WHEN 'E1EDP19'.&lt;/P&gt;&lt;P&gt;          MOVE edidd-sdata TO e1edp19.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          IF e1edp19-qualf = '001'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*customer material is provided to get the vendor material no.&lt;/P&gt;&lt;P&gt;            SELECT matnr FROM knmt UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;                         INTO v_material_number&lt;/P&gt;&lt;P&gt;                         WHERE kdmat = e1edp19-idtnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             ELSEIF e1edp19-qualf = '002'.&lt;/P&gt;&lt;P&gt;            v_material_number = e1edp19-idtnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          ELSEIF e1edp19-qualf = '003'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            SELECT matnr FROM mean INTO TABLE it_mtab&lt;/P&gt;&lt;P&gt;                                   WHERE ean11 = e1edp19-idtnr.&lt;/P&gt;&lt;P&gt;            IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;              EXIT.&lt;/P&gt;&lt;P&gt;            ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              SORT it_mtab ASCENDING BY matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              READ TABLE it_mtab into wa_material INDEX 1.&lt;/P&gt;&lt;P&gt;              v_material_number = wa_material-matnr.&lt;/P&gt;&lt;P&gt;            ENDIF.&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;material item count starts.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          PERFORM get_material_count USING v_material_number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      IF l_item_count LE 480.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;         IF l_item_count EQ 2.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          IF l_item_count EQ 5.&lt;/P&gt;&lt;P&gt;            LOOP AT it_edidd_new1 INTO wa_edidd&lt;/P&gt;&lt;P&gt;                                  WHERE ( psgnum = edidd-psgnum&lt;/P&gt;&lt;P&gt;                                  OR segnum = edidd-psgnum ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              DELETE TABLE it_edidd_new1 FROM wa_edidd.&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; READ TABLE it_edidd_new1 WITH KEY segnam = 'E1EDP01'&lt;/P&gt;&lt;P&gt;                           TRANSPORTING NO FIELDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          &lt;/P&gt;&lt;P&gt;            LOOP AT it_edidd_new2  INTO wa_edidd&lt;/P&gt;&lt;P&gt;                                   WHERE segnum GT edidd-psgnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              IF wa_edidd-segnam = 'E1EDP01'.&lt;/P&gt;&lt;P&gt;                DELETE TABLE it_edidd_new2 FROM wa_edidd.&lt;/P&gt;&lt;P&gt;                DELETE it_edidd_new2 WHERE psgnum = wa_edidd-segnum.&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;&lt;/P&gt;&lt;P&gt;*creating segmnets and assigning values to them.&lt;/P&gt;&lt;P&gt;            PERFORM assign_segment_numbers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*generating a new idoc.&lt;/P&gt;&lt;P&gt;            PERFORM generate_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            CLEAR l_item_count.&lt;/P&gt;&lt;P&gt;            it_edidd_new2 = it_edidd_new1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          ELSE.&lt;/P&gt;&lt;P&gt;            LOOP AT it_edidd_new1 INTO wa_edidd&lt;/P&gt;&lt;P&gt;                                  WHERE ( psgnum = edidd-psgnum&lt;/P&gt;&lt;P&gt;                                  OR segnum = edidd-psgnum ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              DELETE TABLE it_edidd_new1 FROM wa_edidd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            ENDLOOP.&lt;/P&gt;&lt;P&gt;          ENDIF.&lt;/P&gt;&lt;P&gt;      ENDCASE.&lt;/P&gt;&lt;P&gt;      AT LAST.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       IF v_item_count GE 2.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        IF v_item_count GE 5.&lt;/P&gt;&lt;P&gt;          READ TABLE it_edidd_new2&lt;/P&gt;&lt;P&gt;                     WITH KEY segnam = 'E1EDP01'&lt;/P&gt;&lt;P&gt;                     TRANSPORTING NO FIELDS.&lt;/P&gt;&lt;P&gt;          IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;            PERFORM assign_segment_numbers.&lt;/P&gt;&lt;P&gt;            PERFORM generate_idoc.&lt;/P&gt;&lt;P&gt;          ENDIF.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      ENDAT.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; IF  v_item_count GT 480.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  IF v_item_count GT 2.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   IF v_item_count GT 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Changing the status of the original IDoc as 70&lt;/P&gt;&lt;P&gt;      wa_status-status = '70'.&lt;/P&gt;&lt;P&gt;      APPEND wa_status TO it_status.&lt;/P&gt;&lt;P&gt;      CLEAR wa_status.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Update the status of idoc in Database.&lt;/P&gt;&lt;P&gt;      CALL FUNCTION 'IDOC_STATUS_WRITE_TO_DATABASE'&lt;/P&gt;&lt;P&gt;           EXPORTING&lt;/P&gt;&lt;P&gt;                idoc_number               = wa_idoc-docnum&lt;/P&gt;&lt;P&gt;           TABLES&lt;/P&gt;&lt;P&gt;                idoc_status               = it_status&lt;/P&gt;&lt;P&gt;           EXCEPTIONS&lt;/P&gt;&lt;P&gt;                idoc_foreign_lock         = 1&lt;/P&gt;&lt;P&gt;                idoc_not_found            = 2&lt;/P&gt;&lt;P&gt;                idoc_status_records_empty = 3&lt;/P&gt;&lt;P&gt;                idoc_status_invalid       = 4&lt;/P&gt;&lt;P&gt;                db_error                  = 5&lt;/P&gt;&lt;P&gt;                OTHERS                    = 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;change the control record of the original idoc in table EDIDC&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      UPDATE edidc SET mestyp = 'ORDERS' WHERE docnum = wa_idoc-docnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM get_material_count USING     p_v_material_number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*selecting the Item category group from mvke for incoming material.&lt;/P&gt;&lt;P&gt;  SELECT mtpos FROM mvke INTO TABLE  it_sales_mat&lt;/P&gt;&lt;P&gt;                         WHERE matnr =  p_v_material_number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*selecting the Default item category for entries of sales data table.&lt;/P&gt;&lt;P&gt;  SELECT pstyv FROM t184 INTO TABLE  it_sales_item_cat&lt;/P&gt;&lt;P&gt;                         FOR ALL ENTRIES IN  it_sales_mat&lt;/P&gt;&lt;P&gt;                         WHERE mtpos =  it_sales_mat-mtpos&lt;/P&gt;&lt;P&gt;                         AND auart = 'ZVM1'&lt;/P&gt;&lt;P&gt;                         AND uepst = ' '.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  *checking whether material is Relevant for picking or putaway.&lt;/P&gt;&lt;P&gt;  SELECT komrl FROM tvlp INTO v_komrl&lt;/P&gt;&lt;P&gt;                         FOR ALL ENTRIES IN it_sales_item_cat&lt;/P&gt;&lt;P&gt;                         WHERE pstyv =  it_sales_item_cat-pstyv&lt;/P&gt;&lt;P&gt;                         AND komrl = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;*item counter will be incremented.&lt;/P&gt;&lt;P&gt;    l_item_count = l_item_count + 1.&lt;/P&gt;&lt;P&gt;    v_item_count = v_item_count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " get_material_count&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM assigning_segment_numbers.&lt;/P&gt;&lt;P&gt;here i have build the segment numbers for an idoc.&lt;/P&gt;&lt;P&gt;  assign_segment_numbers&lt;/P&gt;&lt;P&gt;enform&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM generate_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR edidc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Building Control records for IDocs to be generated.&lt;/P&gt;&lt;P&gt;  SELECT SINGLE * FROM edidc WHERE docnum = wa_idoc-docnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; edidc-direct = '2'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  edidc-mestyp = 'ORDERS'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR edidc-docnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    wa_status-status = '64'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'IDOC_CREATE_ON_DATABASE'&lt;/P&gt;&lt;P&gt;         EXPORTING&lt;/P&gt;&lt;P&gt;              idoc_status             = wa_status&lt;/P&gt;&lt;P&gt;              error_occured           = ''&lt;/P&gt;&lt;P&gt;         TABLES&lt;/P&gt;&lt;P&gt;              idoc_data               = it_edidd_new2&lt;/P&gt;&lt;P&gt;         CHANGING&lt;/P&gt;&lt;P&gt;              idoc_control            = edidc&lt;/P&gt;&lt;P&gt;         EXCEPTIONS&lt;/P&gt;&lt;P&gt;              idoc_input_inconsistent = 1&lt;/P&gt;&lt;P&gt;              OTHERS                  = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;helpfull answers will surely be rewarded with points....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;muraliji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 09 Nov 2005 01:40:19 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-11-09T01:40:19Z</dc:date>
    <item>
      <title>inbound posting program is not triggering</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-posting-program-is-not-triggering/m-p/1043396#M87154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi all,&lt;/P&gt;&lt;P&gt;    i have created the custom posting program(function module) for a requirement and assigned it with procees code. i have done all the necessary configurations but still it is not triggered what could be the reason.&lt;/P&gt;&lt;P&gt; config.tcodes like ( WE81,WE82,WE57,BD51,WE42)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; helpfull answers will be rewarded as soon as possible. &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;    regards,&lt;/P&gt;&lt;P&gt;   muraliji.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2005 18:22:47 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-posting-program-is-not-triggering/m-p/1043396#M87154</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-08T18:22:47Z</dc:date>
    </item>
    <item>
      <title>Re: inbound posting program is not triggering</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-posting-program-is-not-triggering/m-p/1043397#M87155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Muraliji;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Below are the steps that I follow when I create a new function module for inbound processing.  You have probably followed them already, but I wanted to elaborate in case someone saw this thread in the future and wanted to know the steps in order.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Do you have an IDoc to process?  If so, my suggestion is to make sure all these steps have been followed (you did not mention setting up the partner profile) and then try to process the IDoc in transaction WE19 (IDoc test tool).  When you process the inbound IDoc, you function module should appear in the dialog box that pops up.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  Here are the steps as I follow them:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 1: Create the function module.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 2: Execute transaction BD51 to define the ALE attributes of the function module.  This will make it possible to assign the function module to the process code when the process code is created in step 4.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 3: Execute transaction WE57 to assign the function module to the IDoc type and message type.  If this step is not done, or done incorrectly, you will get an error message on the IDoc indicating that the Idoc type is not associated with a message type.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 4: Execute transaction WE42 to define the process code.   This is the step that assigns the function module to the process code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Step 5: Create/Modify the partner profile and include the new process code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;John&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 08 Nov 2005 18:45:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-posting-program-is-not-triggering/m-p/1043397#M87155</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-08T18:45:16Z</dc:date>
    </item>
    <item>
      <title>Re: inbound posting program is not triggering</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-posting-program-is-not-triggering/m-p/1043398#M87156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi john,&lt;/P&gt;&lt;P&gt;   thanks for ur reply.but what i am trying to say is when i process the idoc in WE19 my fnmodule will split the idoc based upon 480 pickable line items .so a single idoc is read and it is converted into multiple idoc's. the idoc which is executed through WE19 will be changed to status 70.&lt;/P&gt;&lt;P&gt;  for example an idoc with 960 line items should be split as an single idoc with 480 and one more idoc with 480 line items.so when i split the idoc my fn module splits the idoc but i again get an idoc with 62 status also generated with all the line items. and also i get the spliitted line items in wrong sequence.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;here is the code: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT docnum FROM edidc INTO TABLE it_idoc&lt;/P&gt;&lt;P&gt;                         WHERE status = '64'&lt;/P&gt;&lt;P&gt;                         AND mestyp = 'ORDERS'&lt;/P&gt;&lt;P&gt;                         AND  idoctp = 'ORDERS05'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   LOOP AT it_idoc INTO wa_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Selecting the IDOCDATA of selected IDocs.&lt;/P&gt;&lt;P&gt;    SELECT docnum&lt;/P&gt;&lt;P&gt;           segnum&lt;/P&gt;&lt;P&gt;           segnam&lt;/P&gt;&lt;P&gt;           psgnum&lt;/P&gt;&lt;P&gt;           sdata&lt;/P&gt;&lt;P&gt;           FROM edid4&lt;/P&gt;&lt;P&gt;           INTO CORRESPONDING FIELDS OF TABLE it_edidd&lt;/P&gt;&lt;P&gt;           WHERE docnum = wa_idoc-docnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    &lt;/P&gt;&lt;P&gt;    it_edidd_new1[] = it_edidd[].&lt;/P&gt;&lt;P&gt;    it_edidd_new2[] = it_edidd[].&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    LOOP AT it_edidd INTO edidd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;      CASE edidd-segnam.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*material is got from segement 'e1edp19-idtnr'.&lt;/P&gt;&lt;P&gt;        WHEN 'E1EDP19'.&lt;/P&gt;&lt;P&gt;          MOVE edidd-sdata TO e1edp19.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          IF e1edp19-qualf = '001'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*customer material is provided to get the vendor material no.&lt;/P&gt;&lt;P&gt;            SELECT matnr FROM knmt UP TO 1 ROWS&lt;/P&gt;&lt;P&gt;                         INTO v_material_number&lt;/P&gt;&lt;P&gt;                         WHERE kdmat = e1edp19-idtnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;             ELSEIF e1edp19-qualf = '002'.&lt;/P&gt;&lt;P&gt;            v_material_number = e1edp19-idtnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          ELSEIF e1edp19-qualf = '003'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            SELECT matnr FROM mean INTO TABLE it_mtab&lt;/P&gt;&lt;P&gt;                                   WHERE ean11 = e1edp19-idtnr.&lt;/P&gt;&lt;P&gt;            IF sy-subrc &amp;lt;&amp;gt; 0.&lt;/P&gt;&lt;P&gt;              EXIT.&lt;/P&gt;&lt;P&gt;            ELSE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              SORT it_mtab ASCENDING BY matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              READ TABLE it_mtab into wa_material INDEX 1.&lt;/P&gt;&lt;P&gt;              v_material_number = wa_material-matnr.&lt;/P&gt;&lt;P&gt;            ENDIF.&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;material item count starts.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          PERFORM get_material_count USING v_material_number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;      IF l_item_count LE 480.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;         IF l_item_count EQ 2.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;          IF l_item_count EQ 5.&lt;/P&gt;&lt;P&gt;            LOOP AT it_edidd_new1 INTO wa_edidd&lt;/P&gt;&lt;P&gt;                                  WHERE ( psgnum = edidd-psgnum&lt;/P&gt;&lt;P&gt;                                  OR segnum = edidd-psgnum ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              DELETE TABLE it_edidd_new1 FROM wa_edidd.&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; READ TABLE it_edidd_new1 WITH KEY segnam = 'E1EDP01'&lt;/P&gt;&lt;P&gt;                           TRANSPORTING NO FIELDS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          &lt;/P&gt;&lt;P&gt;            LOOP AT it_edidd_new2  INTO wa_edidd&lt;/P&gt;&lt;P&gt;                                   WHERE segnum GT edidd-psgnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              IF wa_edidd-segnam = 'E1EDP01'.&lt;/P&gt;&lt;P&gt;                DELETE TABLE it_edidd_new2 FROM wa_edidd.&lt;/P&gt;&lt;P&gt;                DELETE it_edidd_new2 WHERE psgnum = wa_edidd-segnum.&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;&lt;/P&gt;&lt;P&gt;*creating segmnets and assigning values to them.&lt;/P&gt;&lt;P&gt;            PERFORM assign_segment_numbers.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*generating a new idoc.&lt;/P&gt;&lt;P&gt;            PERFORM generate_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            CLEAR l_item_count.&lt;/P&gt;&lt;P&gt;            it_edidd_new2 = it_edidd_new1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          ELSE.&lt;/P&gt;&lt;P&gt;            LOOP AT it_edidd_new1 INTO wa_edidd&lt;/P&gt;&lt;P&gt;                                  WHERE ( psgnum = edidd-psgnum&lt;/P&gt;&lt;P&gt;                                  OR segnum = edidd-psgnum ).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;              DELETE TABLE it_edidd_new1 FROM wa_edidd.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;            ENDLOOP.&lt;/P&gt;&lt;P&gt;          ENDIF.&lt;/P&gt;&lt;P&gt;      ENDCASE.&lt;/P&gt;&lt;P&gt;      AT LAST.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       IF v_item_count GE 2.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        IF v_item_count GE 5.&lt;/P&gt;&lt;P&gt;          READ TABLE it_edidd_new2&lt;/P&gt;&lt;P&gt;                     WITH KEY segnam = 'E1EDP01'&lt;/P&gt;&lt;P&gt;                     TRANSPORTING NO FIELDS.&lt;/P&gt;&lt;P&gt;          IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;            PERFORM assign_segment_numbers.&lt;/P&gt;&lt;P&gt;            PERFORM generate_idoc.&lt;/P&gt;&lt;P&gt;          ENDIF.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;P&gt;      ENDAT.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; IF  v_item_count GT 480.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;  IF v_item_count GT 2.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;   IF v_item_count GT 5.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Changing the status of the original IDoc as 70&lt;/P&gt;&lt;P&gt;      wa_status-status = '70'.&lt;/P&gt;&lt;P&gt;      APPEND wa_status TO it_status.&lt;/P&gt;&lt;P&gt;      CLEAR wa_status.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Update the status of idoc in Database.&lt;/P&gt;&lt;P&gt;      CALL FUNCTION 'IDOC_STATUS_WRITE_TO_DATABASE'&lt;/P&gt;&lt;P&gt;           EXPORTING&lt;/P&gt;&lt;P&gt;                idoc_number               = wa_idoc-docnum&lt;/P&gt;&lt;P&gt;           TABLES&lt;/P&gt;&lt;P&gt;                idoc_status               = it_status&lt;/P&gt;&lt;P&gt;           EXCEPTIONS&lt;/P&gt;&lt;P&gt;                idoc_foreign_lock         = 1&lt;/P&gt;&lt;P&gt;                idoc_not_found            = 2&lt;/P&gt;&lt;P&gt;                idoc_status_records_empty = 3&lt;/P&gt;&lt;P&gt;                idoc_status_invalid       = 4&lt;/P&gt;&lt;P&gt;                db_error                  = 5&lt;/P&gt;&lt;P&gt;                OTHERS                    = 6.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ELSE.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;change the control record of the original idoc in table EDIDC&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      UPDATE edidc SET mestyp = 'ORDERS' WHERE docnum = wa_idoc-docnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM get_material_count USING     p_v_material_number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*selecting the Item category group from mvke for incoming material.&lt;/P&gt;&lt;P&gt;  SELECT mtpos FROM mvke INTO TABLE  it_sales_mat&lt;/P&gt;&lt;P&gt;                         WHERE matnr =  p_v_material_number.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;    EXIT.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*selecting the Default item category for entries of sales data table.&lt;/P&gt;&lt;P&gt;  SELECT pstyv FROM t184 INTO TABLE  it_sales_item_cat&lt;/P&gt;&lt;P&gt;                         FOR ALL ENTRIES IN  it_sales_mat&lt;/P&gt;&lt;P&gt;                         WHERE mtpos =  it_sales_mat-mtpos&lt;/P&gt;&lt;P&gt;                         AND auart = 'ZVM1'&lt;/P&gt;&lt;P&gt;                         AND uepst = ' '.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  *checking whether material is Relevant for picking or putaway.&lt;/P&gt;&lt;P&gt;  SELECT komrl FROM tvlp INTO v_komrl&lt;/P&gt;&lt;P&gt;                         FOR ALL ENTRIES IN it_sales_item_cat&lt;/P&gt;&lt;P&gt;                         WHERE pstyv =  it_sales_item_cat-pstyv&lt;/P&gt;&lt;P&gt;                         AND komrl = 'X'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDSELECT.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;*item counter will be incremented.&lt;/P&gt;&lt;P&gt;    l_item_count = l_item_count + 1.&lt;/P&gt;&lt;P&gt;    v_item_count = v_item_count + 1.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    " get_material_count&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM assigning_segment_numbers.&lt;/P&gt;&lt;P&gt;here i have build the segment numbers for an idoc.&lt;/P&gt;&lt;P&gt;  assign_segment_numbers&lt;/P&gt;&lt;P&gt;enform&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM generate_idoc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR edidc.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;*Building Control records for IDocs to be generated.&lt;/P&gt;&lt;P&gt;  SELECT SINGLE * FROM edidc WHERE docnum = wa_idoc-docnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt; edidc-direct = '2'.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  edidc-mestyp = 'ORDERS'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  CLEAR edidc-docnum.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  IF sy-subrc EQ 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    wa_status-status = '64'.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'IDOC_CREATE_ON_DATABASE'&lt;/P&gt;&lt;P&gt;         EXPORTING&lt;/P&gt;&lt;P&gt;              idoc_status             = wa_status&lt;/P&gt;&lt;P&gt;              error_occured           = ''&lt;/P&gt;&lt;P&gt;         TABLES&lt;/P&gt;&lt;P&gt;              idoc_data               = it_edidd_new2&lt;/P&gt;&lt;P&gt;         CHANGING&lt;/P&gt;&lt;P&gt;              idoc_control            = edidc&lt;/P&gt;&lt;P&gt;         EXCEPTIONS&lt;/P&gt;&lt;P&gt;              idoc_input_inconsistent = 1&lt;/P&gt;&lt;P&gt;              OTHERS                  = 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM.                    &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;helpfull answers will surely be rewarded with points....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards,&lt;/P&gt;&lt;P&gt;muraliji&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 09 Nov 2005 01:40:19 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/inbound-posting-program-is-not-triggering/m-p/1043398#M87156</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-11-09T01:40:19Z</dc:date>
    </item>
  </channel>
</rss>

