<?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: report in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326776#M1227503</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer this link: &lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1271803"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 17 Mar 2009 05:37:58 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2009-03-17T05:37:58Z</dc:date>
    <item>
      <title>report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326775#M1227502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Moved to correct forum.&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Hi  friends,&lt;/P&gt;&lt;P&gt;I have a problem to upload data in a Report,&lt;/P&gt;&lt;P&gt;My program  i given below .&lt;/P&gt;&lt;P&gt;And my selection screen  field  is - vbeln.  Value = 4970.&lt;/P&gt;&lt;P&gt;My problem is when i get the output it shows only 1 record, but in vbap table  (value - 4970)&lt;/P&gt;&lt;P&gt;hold 4 record, and vbak hold 1 record.That means it shows  5 record.&lt;/P&gt;&lt;P&gt;but in my report it show 1 record.&lt;/P&gt;&lt;P&gt;why, please tell me . &lt;/P&gt;&lt;P&gt;I confuse.&lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;TABLES : vbak,vbap.

DATA: BEGIN OF it_vbak OCCURS 0,
      vbeln LIKE vbak-vbeln,
      vkorg LIKE vbak-vkorg,
      kunnr LIKE vbak-kunnr,
      ernam LIKE vbak-ernam,
      END OF it_vbak.

DATA: BEGIN OF it_vbap OCCURS 0,
      vbeln LIKE vbap-vbeln,
      posnr LIKE vbap-posnr,
      matnr LIKE vbap-matnr,
      matkl LIKE vbap-matkl,
      END OF it_vbap.

DATA: BEGIN OF it_final OCCURS 0,
      vbeln LIKE vbak-vbeln,
      vkorg LIKE vbak-vkorg,
      kunnr LIKE vbak-kunnr,
      ernam LIKE vbak-ernam,
      posnr LIKE vbap-posnr,
      matnr LIKE vbap-matnr,
      matkl LIKE vbap-matkl,
      END OF it_final.

SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE  text-001.
SELECT-OPTIONS : s_vbeln FOR vbak-vbeln No-Extension.
SELECTION-SCREEN : END OF BLOCK b1.

START-OF-SELECTION.

  PERFORM data-selection.
  PERFORM read-data.

FORM data-selection.

  SELECT vbeln
         vkorg
         kunnr
         ernam
         FROM vbak INTO TABLE it_vbak
         WHERE vbeln IN  s_vbeln.

  SELECT vbeln
         posnr
         matnr
         matkl
         FROM vbap INTO TABLE it_vbap
         FOR ALL ENTRIES IN it_vbak
         WHERE vbeln = it_vbak-vbeln.


ENDFORM.                    "DATA-SELECTION

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  READ-DATA
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
FORM read-data.

  LOOP AT it_vbak.
    it_final-vbeln = it_vbak-vbeln.
    it_final-vkorg = it_vbak-vkorg.
    it_final-kunnr = it_vbak-kunnr.
    it_final-ernam = it_vbak-ernam.

    READ TABLE it_vbap
            WITH KEY vbeln = it_vbak-vbeln.
    it_final-posnr = it_vbap-posnr.
    it_final-matnr = it_vbap-matnr.
    it_final-matkl = it_vbap-matkl.

    APPEND it_final.
    CLEAR it_final.

    LOOP AT it_final.
      WRITE: / it_final-vbeln,it_final-vkorg,it_final-kunnr ,it_final-ernam, it_final-posnr,it_final-matnr,
               it_final-matkl.
    ENDLOOP.
  ENDLOOP.
ENDFORM.                    "READ-DATA&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;&lt;STRONG&gt;Use meaningful Subject for your questions&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Vijay Babu Dudla on Mar 17, 2009 5:07 AM&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Matt on Mar 17, 2009 4:18 PM &lt;STRONG&gt;&lt;SPAN __default_attr="red" __jive_macro_name="color"&gt;Added  tags&lt;/SPAN&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 05:33:34 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326775#M1227502</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-17T05:33:34Z</dc:date>
    </item>
    <item>
      <title>Re: report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326776#M1227503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Refer this link: &lt;A class="jive_macro jive_macro_thread" href="https://community.sap.com/" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1271803"&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 05:37:58 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326776#M1227503</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-17T05:37:58Z</dc:date>
    </item>
    <item>
      <title>Re: report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326777#M1227504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Since you are looping at LOOP AT it_vbak which contains only one record. You then use READ TABLE it_vbap to read value of VBAP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So VBAK loop will interate only once so you get only one record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In case you want all the records of VBAP then select all the key fields of VBAP into internal table and then change your code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_VBAP&lt;/P&gt;&lt;P&gt;read table IT_VBAK &lt;/P&gt;&lt;P&gt;append IT_FINAL&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT IT_FINAL&lt;/P&gt;&lt;P&gt;write ......&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;OR &lt;/P&gt;&lt;P&gt; &lt;/P&gt;&lt;P&gt;LOOP AT IT_VBAP&lt;/P&gt;&lt;P&gt;  read table IT_VBAK &lt;/P&gt;&lt;P&gt;  WRITE ALL THE REQUIRED FIELDS. &lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Edited by: Sunil Sawaikar on Mar 17, 2009 7:03 AM&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 06:02:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326777#M1227504</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-17T06:02:30Z</dc:date>
    </item>
    <item>
      <title>Re: report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326778#M1227505</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;Use in this way&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;FORM read-data.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_vbak.&lt;/P&gt;&lt;P&gt;it_final-vbeln = it_vbak-vbeln.&lt;/P&gt;&lt;P&gt;it_final-vkorg = it_vbak-vkorg.&lt;/P&gt;&lt;P&gt;it_final-kunnr = it_vbak-kunnr.&lt;/P&gt;&lt;P&gt;it_final-ernam = it_vbak-ernam.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;loop at it_vbap where vbeln = it_vbak-vbeln.&lt;/P&gt;&lt;P&gt;it_final-posnr = it_vbap-posnr.&lt;/P&gt;&lt;P&gt;it_final-matnr = it_vbap-matnr.&lt;/P&gt;&lt;P&gt;it_final-matkl = it_vbap-matkl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;APPEND it_final.&lt;/P&gt;&lt;P&gt;CLEAR it_final.&lt;/P&gt;&lt;P&gt;endloop.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_final.&lt;/P&gt;&lt;P&gt;WRITE: / it_final-vbeln,it_final-vkorg,it_final-kunnr ,it_final-ernam, it_final-posnr,it_final-matnr,&lt;/P&gt;&lt;P&gt;it_final-matkl.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM. "READ-DATA&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;U'll all 4 records by this code.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 06:11:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326778#M1227505</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-17T06:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326779#M1227506</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Why do you unnecessary append the values ti any final itab and then looping it write the output.Loop the line item table values and pick up the corresponding header for that.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Do as below.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;LOOP AT it_vbap.&lt;/P&gt;&lt;P&gt;it_final-vbeln = it_vbap-vbeln.&lt;/P&gt;&lt;P&gt;it_final-posnr = it_vbap-posnr.&lt;/P&gt;&lt;P&gt;it_final-matnr = it_vbap-matnr.&lt;/P&gt;&lt;P&gt;it_final-matkl = it_vbap-matkl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;READ TABLE it_vbak&lt;/P&gt;&lt;P&gt;WITH KEY vbeln = it_vbap-vbeln.&lt;/P&gt;&lt;P&gt;it_final-vkorg = it_vbak-vkorg.&lt;/P&gt;&lt;P&gt;it_final-kunnr = it_vbak-kunnr.&lt;/P&gt;&lt;P&gt;it_final-ernam = it_vbak-ernam.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;WRITE: / it_final-vbeln,it_final-vkorg,it_final-kunnr ,it_final-ernam, it_final-posnr,it_final-matnr,&lt;/P&gt;&lt;P&gt;it_final-matkl.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLEAR it_final.&lt;/P&gt;&lt;P&gt;ENDLOOP.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDFORM. "READ-DATA&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 09:17:28 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326779#M1227506</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-17T09:17:28Z</dc:date>
    </item>
    <item>
      <title>Re: report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326780#M1227507</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;gt; My problem is when i get the output it shows only 1 record, but in vbap table (value - 4970)&lt;/P&gt;&lt;P&gt;&amp;gt; hold 4 record, and vbak hold 1 record.That means it shows 5 record.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;with 5 records it can not be a performance issue&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If it becomes larger, then you should use BINARY SEARCH or a Sorted tables for the read.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The second LOOP is wrong as already said.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Siegfried&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 09:33:31 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326780#M1227507</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-17T09:33:31Z</dc:date>
    </item>
    <item>
      <title>Re: report</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326781#M1227508</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Instead of using two select quries you can join both the tables on the basis of key fields and if your first table holds large no of records then for all entries statement will always create a problem.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For large no of records for all entries statement give dump so better you join both the tables to fetch the records.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 17 Mar 2009 10:11:00 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/report/m-p/5326781#M1227508</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2009-03-17T10:11:00Z</dc:date>
    </item>
  </channel>
</rss>

