05-28-2013 9:45 AM
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
05-28-2013 5: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
05-29-2013 9: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
05-29-2013 11:09 AM
05-29-2013 11:17 AM
Hi Abhinay,
If possible just try putting a write statement in the code and debug it. 'Write' Statements are used in end-of-selection only.
Thanks,
Ankit.
05-30-2013 6:52 AM
Hi Satish,
The code I worte triggers in event Record Processing (after the START-OF-SELECTION).
But the problem is that the logic I wrote will trigger before the final data is appended to the output table. So, even after using the Sort and Delete adjacent Duplicates (which happens inside a loop by the way) I still get 1 record as duplicate.
I am not able to delete that record.
Thanks,
Abhinay
05-30-2013 6:53 AM
Hi Ankit,
I just put a simple statement like BREAK-POINT.
It was still not triggering in the END-OF-SELECTION event.
Thanks,
Abhinay
05-30-2013 3:46 PM
Hi Abinay,
Sorry but i would not be able to help then,
Please see if this helps,
http://scn.sap.com/thread/2111132
SAP mentors and Gurus please help.
Regards,
Ankit.
05-31-2013 5:34 AM
So your logic is in end of selection but this event is not getting triggered. Then check whether you have written some "CHECK" statement inside start-of-selection or at beginning of end-of-selection. If there is "CHECK" statement make sure that the condition is getting satisfied.
If possible can you paste your code that you have written in start-of-selection and end-of-selection.
06-04-2013 6:55 AM
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
03-19-2014 6: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
05-20-2015 4:16 AM