<?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: Loop-EndLoop in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/5379284#M1237178</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;Check this below select statement is returning values or not if c_vkdfif-vbtyp = 'K' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;netwr b&lt;/SUB&gt;lfimg a~kwmeng INTO CORRESPONDING FIELDS OF TABLE lt_vbap FROM lips AS b&lt;/P&gt;&lt;P&gt;INNER JOIN vbap AS a ON b&lt;SUB&gt;vgbel = a&lt;/SUB&gt;vbeln AND b&lt;SUB&gt;vgpos = a&lt;/SUB&gt;posnr WHERE b~vbeln = c_vkdfif-vbeln.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 23 Mar 2009 14:17:45 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-03-23T14:17:45Z</dc:date>
    <item>
      <title>Loop-EndLoop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/5379283#M1237177</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hallo&lt;/P&gt;&lt;P&gt;I have a code for net value. it is working good. But when c_vkdfif-vbtyp = 'K' it dont enter in second loop.&lt;/P&gt;&lt;P&gt;can somebody tell me where is my mistake.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;LOOP AT c_vkdfif.
  IF c_vkdfif-vbtyp = 'J' OR ( c_vkdfif-vbtyp = 'T' OR c_vkdfif-vbtyp = 'K' ).
    SELECT a~netwr b~lfimg a~kwmeng INTO CORRESPONDING FIELDS OF TABLE lt_vbap FROM lips AS b
    INNER JOIN vbap AS a ON b~vgbel = a~vbeln AND b~vgpos = a~posnr WHERE b~vbeln = c_vkdfif-vbeln.
    LOOP AT lt_vbap.
      lvx_netwr = ( lt_vbap-netwr / lt_vbap-kwmeng ) * lt_vbap-lfimg.
      lv_netwr  = lv_netwr  + lvx_netwr.
      IF c_vkdfif-vbtyp = 'T'.
        IF lv_netwr &amp;gt; 0 OR lv_netwr = 0.
          lv_netwr  = -1 * lv_netwr.
        ELSE.
          lv_netwr = lv_netwr - lvx_netwr.
        ENDIF.
      ENDIF.
      IF c_vkdfif-vbtyp = 'K'.
        IF lv_netwr &amp;gt; 0 OR lv_netwr = 0.
          lv_netwr  = -1 * ( lv_netwr  + lvx_netwr ).
        ELSE.
          lv_netwr = lv_netwr - lvx_netwr.
        ENDIF.
      ENDIF.
    ENDLOOP.
    c_vkdfif-netwr = lv_netwr.
    MODIFY c_vkdfif.
    CLEAR lv_netwr.
  ENDIF.
ENDLOOP.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks a lot&lt;/P&gt;&lt;P&gt;Waseem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Matt on Mar 23, 2009 4:24 PM - added  tags&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2009 14:12:16 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/5379283#M1237177</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-23T14:12:16Z</dc:date>
    </item>
    <item>
      <title>Re: Loop-EndLoop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/5379284#M1237178</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;Check this below select statement is returning values or not if c_vkdfif-vbtyp = 'K' &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SELECT a&lt;SUB&gt;netwr b&lt;/SUB&gt;lfimg a~kwmeng INTO CORRESPONDING FIELDS OF TABLE lt_vbap FROM lips AS b&lt;/P&gt;&lt;P&gt;INNER JOIN vbap AS a ON b&lt;SUB&gt;vgbel = a&lt;/SUB&gt;vbeln AND b&lt;SUB&gt;vgpos = a&lt;/SUB&gt;posnr WHERE b~vbeln = c_vkdfif-vbeln.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2009 14:17:45 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/5379284#M1237178</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-23T14:17:45Z</dc:date>
    </item>
    <item>
      <title>Re: Loop-EndLoop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/5379285#M1237179</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Maybe because the select return sy-subrc = 4 ?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So the internal table lt_vbap doesnt contains any value to loop. Remember that in a INNER JOIN union if the a value exits in A table but not in B table the statment doesnt return anything.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;BTW, I recommend you to make the select outside the LOOPS&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2009 14:18:24 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/5379285#M1237179</guid>
      <dc:creator>Rodrigo-Giner</dc:creator>
      <dc:date>2009-03-23T14:18:24Z</dc:date>
    </item>
    <item>
      <title>Re: Loop-EndLoop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/5379286#M1237180</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Try with removing those "("   and ")" . Why u are using this, though you have used this for the same condition field.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Kuntal&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2009 15:13:59 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/5379286#M1237180</guid>
      <dc:creator>former_member376453</dc:creator>
      <dc:date>2009-03-23T15:13:59Z</dc:date>
    </item>
    <item>
      <title>Re: Loop-EndLoop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/5379287#M1237181</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have proposed a code that might solve your problem, please declare an additional field VBELN in LT_VBAP structure. The code is also performance tuned.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;if c_vkdikk is not initial.&lt;/P&gt;&lt;P&gt;SELECT a~vbeln&lt;/P&gt;&lt;P&gt;             a~netwr       &lt;/P&gt;&lt;P&gt;             b~lfimg&lt;/P&gt;&lt;P&gt;             a~kwmeng&lt;/P&gt;&lt;P&gt;  INTO CORRESPONDING FIELDS OF TABLE lt_vbap&lt;/P&gt;&lt;P&gt;  FROM lips AS b&lt;/P&gt;&lt;P&gt;  INNER JOIN vbap AS a&lt;/P&gt;&lt;P&gt;            ON  b&lt;SUB&gt;vgbel = a&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;            AND b&lt;SUB&gt;vgpos = a&lt;/SUB&gt;posnr&lt;/P&gt;&lt;P&gt;            FOR ALL ENTRIES IN c_vkdfif&lt;/P&gt;&lt;P&gt;            WHERE b~vbeln = c_vkdfif-vbeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;SORT c_vkdfif BY vbeln.&lt;/P&gt;&lt;P&gt;SORT lt_vbap  BY vbeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT c_vkdfif.&lt;/P&gt;&lt;P&gt;  IF c_vkdfif-vbtyp = 'J' OR&lt;/P&gt;&lt;P&gt;     c_vkdfif-vbtyp = 'T' OR&lt;/P&gt;&lt;P&gt;     c_vkdfif-vbtyp = 'K'.&lt;/P&gt;&lt;P&gt;    CLEAR lt_vbap.&lt;/P&gt;&lt;P&gt;    READ TABLE lt_vbap WITH KEY vbeln =  c_vkdfif-vbeln&lt;/P&gt;&lt;P&gt;                                BINARY SEARCH.&lt;/P&gt;&lt;P&gt;    IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;      LOOP AT lt_vbap FROM sy-tabix.&lt;/P&gt;&lt;P&gt;        IF lt_vbap-vbeln = c_vkdfif-vbeln.&lt;/P&gt;&lt;P&gt;          lvx_netwr = ( lt_vbap-netwr / lt_vbap-kwmeng ) * lt_vbap-lfimg.&lt;/P&gt;&lt;P&gt;          lv_netwr = lv_netwr + lvx_netwr.&lt;/P&gt;&lt;P&gt;          IF c_vkdfif-vbtyp = 'T'.&lt;/P&gt;&lt;P&gt;            IF lv_netwr &amp;gt; 0 OR lv_netwr = 0.&lt;/P&gt;&lt;P&gt;              lv_netwr = -1 * lv_netwr.&lt;/P&gt;&lt;P&gt;            ELSE.&lt;/P&gt;&lt;P&gt;              lv_netwr = lv_netwr - lvx_netwr.&lt;/P&gt;&lt;P&gt;            ENDIF.&lt;/P&gt;&lt;P&gt;          ELSEIF c_vkdfif-vbtyp = 'K'.&lt;/P&gt;&lt;P&gt;            IF lv_netwr &amp;gt; 0 OR lv_netwr = 0.&lt;/P&gt;&lt;P&gt;              lv_netwr = -1 * ( lv_netwr + lvx_netwr ).&lt;/P&gt;&lt;P&gt;            ELSE.&lt;/P&gt;&lt;P&gt;              lv_netwr = lv_netwr - lvx_netwr.&lt;/P&gt;&lt;P&gt;            ENDIF.&lt;/P&gt;&lt;P&gt;          ENDIF.&lt;/P&gt;&lt;P&gt;        ELSE.&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;      c_vkdfif-netwr = lv_netwr.&lt;/P&gt;&lt;P&gt;      MODIFY c_vkdfif.&lt;/P&gt;&lt;P&gt;      CLEAR lv_netwr.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;  ENDIF.&lt;/P&gt;&lt;P&gt;endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 23 Mar 2009 15:27:36 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/5379287#M1237181</guid>
      <dc:creator>jcutinho</dc:creator>
      <dc:date>2009-03-23T15:27:36Z</dc:date>
    </item>
    <item>
      <title>Re: Loop-EndLoop</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/5379288#M1237182</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks I solved my problem with your tip.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 25 Mar 2009 13:32:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/loop-endloop/m-p/5379288#M1237182</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-25T13:32:06Z</dc:date>
    </item>
  </channel>
</rss>

