<?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: SAP Script: Loop write only last record in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-script-loop-write-only-last-record/m-p/991424#M74287</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it is only possible in a main window. Can you test your code there?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 16 Sep 2005 11:25:50 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2005-09-16T11:25:50Z</dc:date>
    <item>
      <title>SAP Script: Loop write only last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-script-loop-write-only-last-record/m-p/991423#M74286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;/P&gt;&lt;P&gt;I have been searching and searching, but haven't find anything usefull. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a script where I wan't to print different matnr. &lt;/P&gt;&lt;P&gt;From my printprogram I have an internal table with 2 entries. &lt;/P&gt;&lt;P&gt;When I make the print, it is allways the last entries from the internal table that are printed - in both the window for entry no 1 and in the window for entry no 2. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code in my print program looks like this: &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;

Code: 

  LOOP AT g_caufv_tab. 

    CASE l_count. 

      WHEN 0. 

        CALL FUNCTION 'WRITE_FORM' 
             EXPORTING 
                  element = 'DESCR' 
                  window  = 'TEXT'. 

        CALL FUNCTION 'WRITE_FORM' 
             EXPORTING 
                  element = 'BARCODE_OUT' 
                  window  = 'BARCL'. 

      WHEN 1. 

        CALL FUNCTION 'WRITE_FORM' 
             EXPORTING 
                  element = 'DESCR' 
                  window  = 'TEXT1'. 

        CALL FUNCTION 'WRITE_FORM' 
             EXPORTING 
                  element = 'BARCODE_OUT' 
                  window  = 'BARCL1'. 

      WHEN 2. 

        CALL FUNCTION 'WRITE_FORM' 
             EXPORTING 
                  element = 'DESCR' 
                  window  = 'TEXT2'. 

        CALL FUNCTION 'WRITE_FORM' 
             EXPORTING 
                  element = 'BARCODE_OUT' 
                  window  = 'BARCL2'. 

      WHEN 3. 

        CALL FUNCTION 'WRITE_FORM' 
             EXPORTING 
                  element = 'DESCR' 
                  window  = 'TEXT'. 

        CALL FUNCTION 'WRITE_FORM' 
             EXPORTING 
                  element = 'BARCODE_OUT' 
                  window  = 'BARCL3'. 

      WHEN OTHERS. 

    ENDCASE. 

    ADD 1 TO l_count. 

  ENDLOOP. 
&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When I am debugging mode (both in printprogram and Scrip) are looking at my material number, it has the right no. First time Matnr A, and then Matnr B. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any suggestions ??!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2005 11:20:54 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-script-loop-write-only-last-record/m-p/991423#M74286</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-16T11:20:54Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Script: Loop write only last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-script-loop-write-only-last-record/m-p/991424#M74287</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I think it is only possible in a main window. Can you test your code there?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 16 Sep 2005 11:25:50 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-script-loop-write-only-last-record/m-p/991424#M74287</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-16T11:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Script: Loop write only last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-script-loop-write-only-last-record/m-p/991425#M74288</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanx.... that was it.&lt;/P&gt;&lt;P&gt;But isn't possible to do a loop in other windows, than MAIN window?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Sep 2005 06:44:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-script-loop-write-only-last-record/m-p/991425#M74288</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-18T06:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Script: Loop write only last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-script-loop-write-only-last-record/m-p/991426#M74289</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Lars,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you do a loop inside a non MAIN window, it will print the values in a single line. So you will get only the last record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Vinod&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 18 Sep 2005 07:00:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-script-loop-write-only-last-record/m-p/991426#M74289</guid>
      <dc:creator>Vinod_Chandran</dc:creator>
      <dc:date>2005-09-18T07:00:44Z</dc:date>
    </item>
    <item>
      <title>Re: SAP Script: Loop write only last record</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/sap-script-loop-write-only-last-record/m-p/991427#M74290</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Dear Lars,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think it is not. However I've read quite some posts about using several (more than 1) main windows. However I've no experience with this myself. Perhaps you can do a search on the forum.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 19 Sep 2005 07:01:12 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/sap-script-loop-write-only-last-record/m-p/991427#M74290</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2005-09-19T07:01:12Z</dc:date>
    </item>
  </channel>
</rss>

