<?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: ALV Report Data Discrepancy in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274242#M1988152</link>
    <description>&lt;P&gt;I've checked these queries and data is absolutely fine in these queries when i checked it from the debugger but i'm not getting it that why is it not looping against the selected inspection lot. the following query is showing 5 specifications results but showing a single record in the alv as it is looping only once.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select prueflos,vorglfnr,merknr,kurztext
   FROM qamv INTOTABLE@DATA(lt_kurztext)FORALLENTRIESIN@it_data
   WHERE prueflos eq@it_data-prueflos.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 16 Sep 2020 08:33:30 GMT</pubDate>
    <dc:creator>Hamza_imran</dc:creator>
    <dc:date>2020-09-16T08:33:30Z</dc:date>
    <item>
      <title>ALV Report Data Discrepancy</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274240#M1988150</link>
      <description>&lt;P&gt;Hi Gurus,&lt;/P&gt;
  &lt;P&gt;I need a lil help in my code. The scenario is that my report is showing a single specification against a single inspection lot although in the QAMV table there are multiple specifications of a given inspection lots. I need help there where i might need tweaking in my code. I have also come up to the deduction that the loop it_data has a single record that's why it's not looping all the specifications. Need a little bit of help from the experts in this regards.&lt;/P&gt;
  &lt;PRE&gt;&lt;CODE&gt;FORM get_itab_data .

SELECT  * INTO  TABLE @DATA(it_data)
FROM       qals
WHERE prueflos IN @s_insp.


 SELECT matnr, maktx
    FROM makt INTO TABLE @DATA(lt_maktx)
    FOR ALL ENTRIES IN @it_data
    WHERE matnr EQ @it_data-matnr.

select prueflos,vorglfnr,merknr,kurztext
   FROM qamv INTO TABLE @DATA(lt_kurztext)
   FOR ALL ENTRIES IN @it_data
   WHERE prueflos eq @it_data-prueflos.
*   and vorglfnr eq @it_data-vorglfnr
*   and merknr eq @it_data-merknr.

*-------Specification-------------------*
SELECT prueflos,GRUPPE1,vorglfnr,merknr
  from qamr INTO TABLE @DATA(lt_gruppe1)
  FOR ALL ENTRIES IN @it_data
  WHERE prueflos eq @it_data-prueflos.

  if sy-subrc = 0.
    select AUSWAHLMGE,CODEGRUPPE
      from qpac into TABLE @DATA(lt_auswahlmge)
      for ALL ENTRIES IN @lt_gruppe1
      where codegruppe eq @lt_gruppe1-gruppe1.

      SELECT AUSWAHLMGE,ktx01
        from qpam INTO TABLE @data(lt_ktx01)
        FOR ALL ENTRIES IN @lt_auswahlmge
        where auswahlmge eq @lt_auswahlmge-auswahlmge.


    ENDIF.


       loop at it_data INTO DATA(ls_data).
         CLEAR ls_output.
      ls_output-prueflos = ls_data-prueflos.
      ls_output-matnr = ls_data-matnr.
      ls_output-charg = ls_data-charg.

       READ TABLE lt_maktx REFERENCE INTO DATA(ld_maktx)
      WITH KEY matnr = ls_data-matnr.
    IF sy-subrc = 0.
      ls_output-maktx = ld_maktx-&amp;gt;maktx.
    ENDIF.

       READ TABLE lt_kurztext REFERENCE INTO DATA(ld_kurztext)
      WITH KEY prueflos = ls_data-prueflos.
    IF sy-subrc = 0.
      ls_output-kurztext = ld_kurztext-&amp;gt;kurztext.
    ENDIF.

sort lt_gruppe1 BY merknr.
    READ TABLE lt_gruppe1 REFERENCE INTO DATA(ld_gruppe1)
    with key prueflos = ls_data-prueflos .

    if sy-subrc = 0.
      read TABLE lt_auswahlmge REFERENCE INTO DATA(ld_auswahlmge)
      with key codegruppe = ld_gruppe1-&amp;gt;gruppe1.
      if sy-subrc = 0.

      READ TABLE lt_ktx01 REFERENCE INTO DATA(ld_ktx01)
      with KEY auswahlmge = ld_auswahlmge-&amp;gt;auswahlmge.
      if sy-subrc = 0.
        ls_output-ktx01 = ld_ktx01-&amp;gt;ktx01.
        endif.
      endif.
      endif.

append ls_output to it_output.
         endloop.



  ENDFORM.

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  build_layout
*&amp;amp;---------------------------------------------------------------------*
*       Set Layout For ALV Display
*----------------------------------------------------------------------*
FORM display_alv.

*/.. Set field catalogs for alv
  PERFORM get_fieldcatalog.

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_program     = sy-repid
      i_callback_top_of_page = 'TOP-OF-PAGE'
      is_layout              = gs_layout
      it_fieldcat            = gt_fcat
      i_save                 = 'A'
    TABLES
      t_outtab               = it_output
    EXCEPTIONS
      program_error          = 1
      OTHERS                 = 2.




ENDFORM.

**&amp;amp;---------------------------------------------------------------------*
**&amp;amp;      Form  GET_FIELDCATALOG
**&amp;amp;---------------------------------------------------------------------*
**       Create field catalog from dictionary structure
**----------------------------------------------------------------------*
**  --&amp;gt;  p_struc_name        Stucture Name
**  --&amp;gt;  p_rtname            Reference Table Name
**  --&amp;gt;  p_repid             Program Name
**  &amp;lt;-&amp;gt;  c_fcat              Field Catalog
**----------------------------------------------------------------------*
FORM get_fieldcatalog.

  CLEAR: gs_fcat.
  REFRESH: gt_fcat.

  gs_fcat-col_pos   = 1.
  gs_fcat-fieldname = 'PRUEFLOS'.
  gs_fcat-tabname   = 'IT_OUTPUT'.
  gs_fcat-seltext_m = 'Inspection Lot'.
  APPEND gs_fcat TO gt_fcat.
  CLEAR  gs_fcat.

  gs_fcat-col_pos   = 2.
  gs_fcat-fieldname = 'MATNR'.
  gs_fcat-tabname   = 'IT_OUTPUT'.
  gs_fcat-seltext_m = 'Material'.
  gs_fcat-outputlen = '12'.
  APPEND gs_fcat TO gt_fcat.
  CLEAR  gs_fcat.

  gs_fcat-col_pos   = 3.
  gs_fcat-fieldname = 'MAKTX'.
  gs_fcat-tabname   = 'IT_OUTPUT'.
  gs_fcat-seltext_m = 'Material Description'.
  gs_fcat-outputlen = '12'.
  APPEND gs_fcat TO gt_fcat.
  CLEAR  gs_fcat.

  gs_fcat-col_pos   = 4.
  gs_fcat-fieldname = 'CHARG'.
  gs_fcat-tabname   = 'IT_OUTPUT'.
  gs_fcat-seltext_m = 'Batch'.
  gs_fcat-outputlen = '12'.
  APPEND gs_fcat TO gt_fcat.
  CLEAR  gs_fcat.

  gs_fcat-col_pos   = 5.
  gs_fcat-fieldname = 'KURZTEXT'.
  gs_fcat-tabname   = 'IT_OUTPUT'.
  gs_fcat-seltext_m = 'Test Parameter'.
  gs_fcat-outputlen = '12'.
  APPEND gs_fcat TO gt_fcat.
  CLEAR  gs_fcat.

  gs_fcat-col_pos   = 6.
  gs_fcat-fieldname = 'KTX01'.
  gs_fcat-tabname   = 'IT_OUTPUT'.
  gs_fcat-seltext_m = 'Specification'.
  gs_fcat-outputlen = '12'.
  APPEND gs_fcat TO gt_fcat.
  CLEAR  gs_fcat.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Sep 2020 07:46:22 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274240#M1988150</guid>
      <dc:creator>Hamza_imran</dc:creator>
      <dc:date>2020-09-16T07:46:22Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Report Data Discrepancy</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274241#M1988151</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;humza_immi&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;You have clearly mentioned that the Table at which the LOOP is applied has only one entry. In that case watch closely how the table is being filled.&lt;/P&gt;&lt;P&gt;First Check the below Query, check the number of entries you get in debugging and in backend:&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt; SELECT matnr, maktx
    FROM makt INTO TABLE @DATA(lt_maktx)
    FOR ALL ENTRIES IN @it_data
    WHERE matnr EQ @it_data-matnr.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Then proceed to check the next query similarly both in debugging and in back end.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select prueflos,vorglfnr,merknr,kurztext
   FROM qamv INTOTABLE@DATA(lt_kurztext)FORALLENTRIESIN@it_data
   WHERE prueflos eq@it_data-prueflos.&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;This should definitely be a data issue, kindly check and let us know.&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 08:28:04 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274241#M1988151</guid>
      <dc:creator>former_member1716</dc:creator>
      <dc:date>2020-09-16T08:28:04Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Report Data Discrepancy</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274242#M1988152</link>
      <description>&lt;P&gt;I've checked these queries and data is absolutely fine in these queries when i checked it from the debugger but i'm not getting it that why is it not looping against the selected inspection lot. the following query is showing 5 specifications results but showing a single record in the alv as it is looping only once.&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;select prueflos,vorglfnr,merknr,kurztext
   FROM qamv INTOTABLE@DATA(lt_kurztext)FORALLENTRIESIN@it_data
   WHERE prueflos eq@it_data-prueflos.
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 16 Sep 2020 08:33:30 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274242#M1988152</guid>
      <dc:creator>Hamza_imran</dc:creator>
      <dc:date>2020-09-16T08:33:30Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Report Data Discrepancy</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274243#M1988153</link>
      <description>&lt;SPAN class="mention-scrubbed"&gt;humza_immi&lt;/SPAN&gt;,What is the number of entries in IT_DATA?</description>
      <pubDate>Wed, 16 Sep 2020 08:39:48 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274243#M1988153</guid>
      <dc:creator>former_member1716</dc:creator>
      <dc:date>2020-09-16T08:39:48Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Report Data Discrepancy</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274244#M1988154</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;humza_immi&lt;/SPAN&gt;,,&lt;/P&gt;&lt;P&gt;Your final entries purely dependent on the entries in IT_DATA, tell us what is the number of entries in IT_DATA.&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 08:49:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274244#M1988154</guid>
      <dc:creator>former_member1716</dc:creator>
      <dc:date>2020-09-16T08:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Report Data Discrepancy</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274245#M1988155</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;satishkumarbalasubramanian&lt;/SPAN&gt; it's 1.&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 09:27:06 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274245#M1988155</guid>
      <dc:creator>Hamza_imran</dc:creator>
      <dc:date>2020-09-16T09:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Report Data Discrepancy</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274246#M1988156</link>
      <description>&lt;P&gt;&lt;SPAN class="mention-scrubbed"&gt;humza_immi&lt;/SPAN&gt;,&lt;/P&gt;&lt;P&gt;That is the answer for you.&lt;/P&gt;&lt;P&gt;You are actually looping a table with one entry and that means the Loop iteration will run only once, thus the output will yield only one entry irrespective of the entries in other table.&lt;/P&gt;&lt;P&gt;In case you wanted to display all the five entries of table lt_kurztext then you can follow any of the below method:&lt;/P&gt;&lt;P&gt;1) Simply loop at the table lt_kurztext instead of IT_DATA. (Recommended)&lt;/P&gt;&lt;P&gt;2) You can also write a loop of lt_kurztext inside the loop of IT_DATA. (This Would reduce the performance -&amp;gt; Not Recommended unless the business requirement demands).&lt;/P&gt;&lt;P&gt;Hope this solves your issue!&lt;/P&gt;&lt;P&gt;Regards!&lt;/P&gt;</description>
      <pubDate>Wed, 16 Sep 2020 10:09:25 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274246#M1988156</guid>
      <dc:creator>former_member1716</dc:creator>
      <dc:date>2020-09-16T10:09:25Z</dc:date>
    </item>
    <item>
      <title>Re: ALV Report Data Discrepancy</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274247#M1988157</link>
      <description>&lt;P&gt;  &lt;SPAN class="mention-scrubbed"&gt;satishkumarbalasubramanian&lt;/SPAN&gt; i tried both your methods but still it didn't solved the problem for me. looping at lt_kurztext was giving me alot of errors and looping it inside it_data wasn't giving me my desired results.&lt;/P&gt;</description>
      <pubDate>Wed, 23 Sep 2020 11:35:52 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/alv-report-data-discrepancy/m-p/12274247#M1988157</guid>
      <dc:creator>Hamza_imran</dc:creator>
      <dc:date>2020-09-23T11:35:52Z</dc:date>
    </item>
  </channel>
</rss>

