Skip to Content
avatar image
Former Member

Reduction of Data in SAP Query

Hi Experts,

I have an Infoset query which have multiple table joins on Material master data. All these tables are linked only by Material number.

Due to this there are many duplicate records coming in the output.

We use the SAP List viewer as output type for our Queries here.

I have tried writing a piece of code to remove the duplicates in Infoset Query -> Code section. I have written my logic in the event END-OF-SELECTION (Before List). All mu data declarations are in DATA section.

But my problem is I am not able to trigger the code I have written. Any idea on how to trigger this code or how to reduce the duplicates?

Or is there any BAdi or User exits available?

Thanks in Advance,

Abhinay

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • avatar image
    Former Member
    Mar 19, 2014 at 06:41 AM

    Hi

    Sometimes, from reasons I haven't discovered yet, the query output options are not the same: when you execute the query the "Output specifications" in the parameter screen sometimes have only one field of "Layout", and sometimes there are several output uptions.

    If the full list of options is shown when you run the query, the END-OF-SELECTION will be triggered.

    If you see only one option ("SAP List viewer") when you execute the query, go to the query definition (SQ01), in the first screen choose one of the options besides "SAP List viewer". Now try to execute the query and you'll see that END-OF-SELECTION is triggered.

    In the execution of the query you/the user can choose again the regular Output specifications = "SAP List viewer".

    Sorsha

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 28, 2013 at 04:48 PM

    Hi Abhinay,

    I have not worked on infoset queries but in general what we do is

    *)Sort the internal table by matnrĀ 

    *)delete adjacent duplicates from the internal table comparing matnr

    *) Use For-all Entries clause to fetch the data from other SAP Tables like MARC, MARD, MBEW, MVKE, MAKT etc.

    Thanks,

    Ankit

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 29, 2013 at 08:38 AM

    Hi Ankit,

    Thanks for your response.

    But this issue I face in Infoset Query and not in a report. We can enhance the infoset query with our custom code if needed and SAP provides that provision there.

    Here my issue is as to why the events END-OF-SELECTION does not trigger for SAP List viewer output. Or are there any Badi's or user exits that can be triggered after all the data is extracted from the tables.

    Thanks,

    Abhinay

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi Abhinay,

      Try this:

      1. DATA section

           DATA: it_mara TYPE TABLE OF mara,

                        st_mara TYPE                     mara.

      2. Record Processing section

           READ TABLE it_mara  INTO st_mara
                          WITH KEY MATNR = mara-MATNR.
           IF sy-subrc NE 0.
             SELECT  * FROM mara INTO TABLE it_mara
               WHERE  MATNR = mara-MATNR.

           ELSE.
             CHECK 0 = 1.
           ENDIF.

      I use " READ TABLE it_mara .... "  to determine the first line for each Material among

      all the lines which query supplies for every Material.

      Regards

      Boris    

  • avatar image
    Former Member
    May 20, 2015 at 03:16 AM
    Add comment
    10|10000 characters needed characters exceeded