<?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 abap logic in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-logic/m-p/2154227#M454980</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;may i know if the logic is correct? &lt;/P&gt;&lt;P&gt;i only doubt is the last loop, where the select statement in the loop.&lt;/P&gt;&lt;P&gt;wa_report-vgbel and wa_report-vgpos, this combination is unique and no duplication. can the control in the select statement when meet endselect after process 1 record (the unique combination), will go to next record in the loop?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   sort it_delivery by vbeln vgbel vgpos.&lt;/P&gt;&lt;P&gt;   loop at it_delivery into wa_delivery.&lt;/P&gt;&lt;P&gt;      move wa_delivery-vbeln to wa_report-vbeln. &lt;/P&gt;&lt;P&gt;      move wa_delivery-vgbel to wa_report-vgbel. &lt;/P&gt;&lt;P&gt;      move wa_delivery-vgpos to wa_report-vgpos. &lt;/P&gt;&lt;P&gt;      move wa_delivery-matnr to wa_report-matnr.&lt;/P&gt;&lt;P&gt;      move wa_delivery-charg to wa_report-charg.&lt;/P&gt;&lt;P&gt;      move wa_delivery-lfimg to wa_report-lfimg.&lt;/P&gt;&lt;P&gt;      collect wa_report into it_report.&lt;/P&gt;&lt;P&gt;   endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    loop at it_report into wa_report.&lt;/P&gt;&lt;P&gt;      v_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;      select a~kwmeng&lt;/P&gt;&lt;P&gt;             b&lt;SUB&gt;vkorg b&lt;/SUB&gt;vtweg b&lt;SUB&gt;spart b&lt;/SUB&gt;vbtyp&lt;/P&gt;&lt;P&gt;           into (wa_report-kwmeng, wa_report-vkorg,&lt;/P&gt;&lt;P&gt;                 wa_report-vtweg, wa_report-spart, wa_report-vbtyp)&lt;/P&gt;&lt;P&gt;           from vbap as a inner join vbak as b&lt;/P&gt;&lt;P&gt;                                     on a&lt;SUB&gt;vbeln = b&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;           where a~vbeln = wa_report-vgbel and&lt;/P&gt;&lt;P&gt;                 a~posnr = wa_report-vgpos.&lt;/P&gt;&lt;P&gt;       if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          SELECT SINGLE tknum FROM vttp INTO wa_report-tknum&lt;/P&gt;&lt;P&gt;                   WHERE vbeln = wa_delivery-vbeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          SELECT SINGLE * FROM vbpa&lt;/P&gt;&lt;P&gt;                  WHERE vbeln = wa_report-vbeln AND&lt;/P&gt;&lt;P&gt;                        parvw = 'SH'.&lt;/P&gt;&lt;P&gt;          READ TABLE it_customer WITH KEY kunnr = vbpa-kunnr.&lt;/P&gt;&lt;P&gt;          IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;            wa_report-kunnr = vbpa-kunnr.&lt;/P&gt;&lt;P&gt;          endif.&lt;/P&gt;&lt;P&gt;          wa_report-openqty = wa_report-kwmeng - wa_report-lfimg.&lt;/P&gt;&lt;P&gt;       modify it_report from wa_report index v_tabix transporting&lt;/P&gt;&lt;P&gt;                        kwmeng vkorg vtweg spart vbtyp tknum kunnr.&lt;/P&gt;&lt;P&gt;       endif.&lt;/P&gt;&lt;P&gt;       endselect.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 14 Apr 2007 08:42:25 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2007-04-14T08:42:25Z</dc:date>
    <item>
      <title>abap logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-logic/m-p/2154227#M454980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;may i know if the logic is correct? &lt;/P&gt;&lt;P&gt;i only doubt is the last loop, where the select statement in the loop.&lt;/P&gt;&lt;P&gt;wa_report-vgbel and wa_report-vgpos, this combination is unique and no duplication. can the control in the select statement when meet endselect after process 1 record (the unique combination), will go to next record in the loop?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;thanks&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;   sort it_delivery by vbeln vgbel vgpos.&lt;/P&gt;&lt;P&gt;   loop at it_delivery into wa_delivery.&lt;/P&gt;&lt;P&gt;      move wa_delivery-vbeln to wa_report-vbeln. &lt;/P&gt;&lt;P&gt;      move wa_delivery-vgbel to wa_report-vgbel. &lt;/P&gt;&lt;P&gt;      move wa_delivery-vgpos to wa_report-vgpos. &lt;/P&gt;&lt;P&gt;      move wa_delivery-matnr to wa_report-matnr.&lt;/P&gt;&lt;P&gt;      move wa_delivery-charg to wa_report-charg.&lt;/P&gt;&lt;P&gt;      move wa_delivery-lfimg to wa_report-lfimg.&lt;/P&gt;&lt;P&gt;      collect wa_report into it_report.&lt;/P&gt;&lt;P&gt;   endloop.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    loop at it_report into wa_report.&lt;/P&gt;&lt;P&gt;      v_tabix = sy-tabix.&lt;/P&gt;&lt;P&gt;      select a~kwmeng&lt;/P&gt;&lt;P&gt;             b&lt;SUB&gt;vkorg b&lt;/SUB&gt;vtweg b&lt;SUB&gt;spart b&lt;/SUB&gt;vbtyp&lt;/P&gt;&lt;P&gt;           into (wa_report-kwmeng, wa_report-vkorg,&lt;/P&gt;&lt;P&gt;                 wa_report-vtweg, wa_report-spart, wa_report-vbtyp)&lt;/P&gt;&lt;P&gt;           from vbap as a inner join vbak as b&lt;/P&gt;&lt;P&gt;                                     on a&lt;SUB&gt;vbeln = b&lt;/SUB&gt;vbeln&lt;/P&gt;&lt;P&gt;           where a~vbeln = wa_report-vgbel and&lt;/P&gt;&lt;P&gt;                 a~posnr = wa_report-vgpos.&lt;/P&gt;&lt;P&gt;       if sy-subrc = 0.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          SELECT SINGLE tknum FROM vttp INTO wa_report-tknum&lt;/P&gt;&lt;P&gt;                   WHERE vbeln = wa_delivery-vbeln.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;          SELECT SINGLE * FROM vbpa&lt;/P&gt;&lt;P&gt;                  WHERE vbeln = wa_report-vbeln AND&lt;/P&gt;&lt;P&gt;                        parvw = 'SH'.&lt;/P&gt;&lt;P&gt;          READ TABLE it_customer WITH KEY kunnr = vbpa-kunnr.&lt;/P&gt;&lt;P&gt;          IF sy-subrc = 0.&lt;/P&gt;&lt;P&gt;            wa_report-kunnr = vbpa-kunnr.&lt;/P&gt;&lt;P&gt;          endif.&lt;/P&gt;&lt;P&gt;          wa_report-openqty = wa_report-kwmeng - wa_report-lfimg.&lt;/P&gt;&lt;P&gt;       modify it_report from wa_report index v_tabix transporting&lt;/P&gt;&lt;P&gt;                        kwmeng vkorg vtweg spart vbtyp tknum kunnr.&lt;/P&gt;&lt;P&gt;       endif.&lt;/P&gt;&lt;P&gt;       endselect.&lt;/P&gt;&lt;P&gt;    endloop.&lt;/P&gt;&lt;P&gt;   endif.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Apr 2007 08:42:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-logic/m-p/2154227#M454980</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-14T08:42:25Z</dc:date>
    </item>
    <item>
      <title>Re: abap logic</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/abap-logic/m-p/2154228#M454981</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Performance point of view it is not good to use Select query inside a loop statement .Rather u can use for all entries and get the data into int tables and then loop it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;Zarina&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 14 Apr 2007 09:04:07 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/abap-logic/m-p/2154228#M454981</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2007-04-14T09:04:07Z</dc:date>
    </item>
  </channel>
</rss>

