<?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: How to avoid loop inside the loop ? in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323500#M510437</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; The Bapi_class_get_characteristics takes all the values for the respective characteristics, but i am passing a file which consists of vendor, class ,characteristics, values&lt;/P&gt;&lt;P&gt;eg&lt;/P&gt;&lt;P&gt;123| Returnable_package| Packages| 02|&lt;/P&gt;&lt;P&gt;321| Returnable_package| Packages| 02|&lt;/P&gt;&lt;P&gt;123| Returnable_package| Packages| 01|&lt;/P&gt;&lt;P&gt;421| Vendor_shipping| Vendor_shipping| 02|&lt;/P&gt;&lt;P&gt;The vendor 123 has two values 02,01 . so this two values need to be appended.&lt;/P&gt;&lt;P&gt;Eventhough of using the READ statment to remove the loop , the purpose  of the loop 2 is collect the similiar characteristics, value from the file that is been uploaded and get assigned and appended to  the  transaction cl20n. i have used the above code but the values is not assigned to the vendor. pls solve the issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 13 Jun 2007 10:36:35 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-06-13T10:36:35Z</dc:date>
    <item>
      <title>How to avoid loop inside the loop ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323495#M510432</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi frnds, &lt;/P&gt;&lt;P&gt;   I am using three function module inside the loop , &lt;/P&gt;&lt;P&gt;am assigning the vendor to class , characteristics ,values.&lt;/P&gt;&lt;P&gt;For the same vendor, there are different values need to be assigned, but when i pass the record one by one in the loop 1, the assignment overwrites with the new value. the vendor gets updated with the latest value. but i require these values need to be appended in the transaction ( cl20n). hence i used loop 2 to capture the similiar class, characteristics , different values to the vendor, and appending it. Due to performance issue , i should take the loop2 out  , need to use a alternative code for it. pls help me out how to avoid loop2 withe alternative code.&lt;/P&gt;&lt;P&gt;loop 1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Function module 1. " bapi_concatenate_key&lt;/P&gt;&lt;P&gt;loop2  " this loop append the values into the transaction&lt;/P&gt;&lt;P&gt;endloop &lt;/P&gt;&lt;P&gt;function module 2.   " bapi_objcl_change&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function module 3. " bapi_commit_transaction&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;endloop&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2007 11:56:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323495#M510432</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-12T11:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid loop inside the loop ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323496#M510433</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;One way is that you get the tables in one shoot with for all entries instead of loop and FM call....then in a loop merge the values to your internal tables.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Peter&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2007 12:10:08 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323496#M510433</guid>
      <dc:creator>Peter_Inotai</dc:creator>
      <dc:date>2007-06-12T12:10:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid loop inside the loop ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323497#M510434</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;u can use 'FOR ALL ENTERIES'&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;regards&lt;/P&gt;&lt;P&gt;ravish&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;b&amp;gt;dont forget to rewared points if helpful&amp;lt;/b&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2007 12:16:57 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323497#M510434</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-12T12:16:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid loop inside the loop ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323498#M510435</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; declare internal tables....&lt;/P&gt;&lt;P&gt;write select statements using FOR ALL ENTRIES&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;after that loop at first internal table.&lt;/P&gt;&lt;P&gt;use read statements...&lt;/P&gt;&lt;P&gt;append data to final internal table.&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;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2007 12:25:29 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323498#M510435</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-12T12:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid loop inside the loop ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323499#M510436</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 think if you are creating the assignments newly then you can use&lt;/P&gt;&lt;P&gt;BAPI_OBJCL_CREATE  instead of BAPI_OBJCL_CHANGE.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Check out the following code which is for assigning Materials to classes and characteristics.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; WRITE:/ 'CLASS TYPE : 001' COLOR 2.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  LOOP AT it_001 INTO x_001.&lt;/P&gt;&lt;P&gt;    CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        input  = x_001-matnr&lt;/P&gt;&lt;P&gt;      IMPORTING&lt;/P&gt;&lt;P&gt;        output = x_001-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    v_objkey = x_001-matnr.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    v_cnt = 0.&lt;/P&gt;&lt;P&gt;    REFRESH: it_bapi_char,it_bapi_char_values ,it_bapiret_create,&lt;/P&gt;&lt;P&gt;             it_alwval_num,it_alwval_char,it_alwval_curr .&lt;/P&gt;&lt;P&gt;    CLEAR: x_bapiret1,x_bapi_char,x_bapi_char_values ,&lt;/P&gt;&lt;P&gt;             x_alwval_num,x_alwval_char,x_alwval_curr.&lt;/P&gt;&lt;P&gt;    LOOP AT it_class INTO x_class WHERE recid = x_001-recid AND class = x_001-class.&lt;/P&gt;&lt;P&gt;      v_cnt = v_cnt + 1.&lt;/P&gt;&lt;P&gt;      IF v_cnt = 1.&lt;/P&gt;&lt;P&gt;        CALL FUNCTION 'BAPI_CLASS_GET_CHARACTERISTICS'&lt;/P&gt;&lt;P&gt;          EXPORTING&lt;/P&gt;&lt;P&gt;            classnum        = x_class-class&lt;/P&gt;&lt;P&gt;            classtype       = '001'&lt;/P&gt;&lt;P&gt;          IMPORTING&lt;/P&gt;&lt;P&gt;            return          = x_bapiret1&lt;/P&gt;&lt;P&gt;          TABLES&lt;/P&gt;&lt;P&gt;            characteristics = it_bapi_char&lt;/P&gt;&lt;P&gt;            char_values     = it_bapi_char_values.&lt;/P&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;      SORT :it_bapi_char,it_bapi_char_values.&lt;/P&gt;&lt;P&gt;      READ TABLE it_bapi_char INTO  x_bapi_char WITH KEY name_char = x_class-atnam BINARY SEARCH.&lt;/P&gt;&lt;P&gt;      IF sy-subrc = 0.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       READ TABLE it_bapi_char_values INTO x_bapi_char_values&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       WITH KEY name_char = x_class-atnam char_value = x_class-atwrt.&lt;/P&gt;&lt;/LI&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       IF sy-subrc = 0.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;        IF x_bapi_char-data_type = 'CHAR'.&lt;/P&gt;&lt;P&gt;          TRANSLATE  x_class-atwrt TO UPPER CASE.&lt;/P&gt;&lt;P&gt;          x_alwval_char-charact = x_class-atnam.&lt;/P&gt;&lt;P&gt;          x_alwval_char-value_char = x_class-atwrt.&lt;/P&gt;&lt;P&gt;          APPEND x_alwval_char TO it_alwval_char.&lt;/P&gt;&lt;P&gt;        ELSEIF   x_bapi_char-data_type = 'CURR'.&lt;/P&gt;&lt;P&gt;          x_alwval_curr-charact = x_class-atnam.&lt;/P&gt;&lt;P&gt;          x_alwval_curr-value_from = x_class-atwrt.&lt;/P&gt;&lt;P&gt;          x_alwval_curr-currency_from = 'USD'.&lt;/P&gt;&lt;P&gt;          APPEND x_alwval_curr TO it_alwval_curr.&lt;/P&gt;&lt;P&gt;        ELSEIF x_bapi_char-data_type = 'NUM'  OR  x_bapi_char-data_type = 'DATE'&lt;/P&gt;&lt;P&gt;        OR  x_bapi_char-data_type = 'TIME'.&lt;/P&gt;&lt;P&gt;          x_alwval_num-charact = x_class-atnam.&lt;/P&gt;&lt;P&gt;          x_alwval_num-value_from = x_class-atwrt.&lt;/P&gt;&lt;P&gt;          APPEND x_alwval_num TO it_alwval_num.&lt;/P&gt;&lt;P&gt;        ENDIF.&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;       ENDIF.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;      ENDIF.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;     CALL FUNCTION 'BAPI_OBJCL_CREATE'&lt;/P&gt;&lt;P&gt;      EXPORTING&lt;/P&gt;&lt;P&gt;        objectkeynew    = v_objkey&lt;/P&gt;&lt;P&gt;        objecttablenew  = 'MARA'&lt;/P&gt;&lt;P&gt;        classnumnew     = x_class-class&lt;/P&gt;&lt;P&gt;        classtypenew    = '001'&lt;/P&gt;&lt;P&gt;      TABLES&lt;/P&gt;&lt;P&gt;        allocvaluesnum  = it_alwval_num&lt;/P&gt;&lt;P&gt;        allocvalueschar = it_alwval_char&lt;/P&gt;&lt;P&gt;        allocvaluescurr = it_alwval_curr&lt;/P&gt;&lt;P&gt;        return          = it_bapiret_create.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    READ TABLE it_bapiret_create INTO x_bapiret WITH KEY type = 'E'  .&lt;/P&gt;&lt;P&gt;    IF sy-subrc NE 0.&lt;/P&gt;&lt;P&gt;      CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'&lt;/P&gt;&lt;P&gt;        EXPORTING&lt;/P&gt;&lt;P&gt;          wait = 'X'.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;    WRITE:/ 'Material  : ', v_objkey  COLOR 4.&lt;/P&gt;&lt;P&gt;    LOOP AT it_bapiret_create INTO x_bapiret WHERE type = 'E' OR type = 'S' .&lt;/P&gt;&lt;P&gt;      WRITE: /1 x_bapiret-type, 6  x_bapiret-message.&lt;/P&gt;&lt;P&gt;    ENDLOOP.&lt;/P&gt;&lt;P&gt;    SKIP 2.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jun 2007 12:37:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323499#M510436</guid>
      <dc:creator>former_member491305</dc:creator>
      <dc:date>2007-06-12T12:37:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid loop inside the loop ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323500#M510437</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt; The Bapi_class_get_characteristics takes all the values for the respective characteristics, but i am passing a file which consists of vendor, class ,characteristics, values&lt;/P&gt;&lt;P&gt;eg&lt;/P&gt;&lt;P&gt;123| Returnable_package| Packages| 02|&lt;/P&gt;&lt;P&gt;321| Returnable_package| Packages| 02|&lt;/P&gt;&lt;P&gt;123| Returnable_package| Packages| 01|&lt;/P&gt;&lt;P&gt;421| Vendor_shipping| Vendor_shipping| 02|&lt;/P&gt;&lt;P&gt;The vendor 123 has two values 02,01 . so this two values need to be appended.&lt;/P&gt;&lt;P&gt;Eventhough of using the READ statment to remove the loop , the purpose  of the loop 2 is collect the similiar characteristics, value from the file that is been uploaded and get assigned and appended to  the  transaction cl20n. i have used the above code but the values is not assigned to the vendor. pls solve the issue.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 10:36:35 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323500#M510437</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-13T10:36:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid loop inside the loop ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323501#M510438</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;here is the logic for using loop inside loop if it is a must! This  considerably improves performance compared to normal nested loops.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT wt_table1 BY key.&lt;/P&gt;&lt;P&gt;SORT wt_table2 BY key.&lt;/P&gt;&lt;P&gt;wv_index = 1.&lt;/P&gt;&lt;P&gt;LOOP AT wt_table1.&lt;/P&gt;&lt;P&gt;  Treatment.&lt;/P&gt;&lt;P&gt;  LOOP AT wt_table2 FROM wv_index.&lt;/P&gt;&lt;P&gt;    IF wt_table1-key = wt_table2-key.&lt;/P&gt;&lt;P&gt;       Treatment.&lt;/P&gt;&lt;P&gt;    ELSEIF wt_table2-key &amp;gt; wt_table1-key.&lt;/P&gt;&lt;P&gt;       wv_index = sy-tabix.&lt;/P&gt;&lt;P&gt;       EXIT.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDLOOP.&lt;/P&gt;&lt;P&gt;  Treatment.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope that this helps you,&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Sooness.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 10:42:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323501#M510438</guid>
      <dc:creator>dev_parbutteea</dc:creator>
      <dc:date>2007-06-13T10:42:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to avoid loop inside the loop ?</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323502#M510439</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;To avoid nested loops use 'For all entries'.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Jun 2007 10:58:17 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/how-to-avoid-loop-inside-the-loop/m-p/2323502#M510439</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-06-13T10:58:17Z</dc:date>
    </item>
  </channel>
</rss>

