Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to have a Distinct record in SQ01 (SAP Query)

Former Member
0 Kudos

Hi guys,

I have 2 records been retrieved in PA9200 and it is linked to PA0000 table. During the process i am getting 2 records. but all I want is 2 records will be counted as one since it has the same pernr.

Hope u understand my scenario.

Your response will be much appreciated.Thanks!

9 REPLIES 9

Madhurivs23
Participant
0 Kudos

Hi Ella,

The report generated for the query, we can make changes in it. in the start-of_selection event. There u can write the delete adjacent duplicates. please check that once.

Hope this will be helpful...

rgds,

Madhuri

0 Kudos

Thanks guys for your response.

I've been thinking to put codes in the Node - Infoset. But I don't know how to start. Because when I debug in record processing event, the data is stored in T01 table. From there, how will I insert delete adjacent duplicates?

0 Kudos

hay

u can write delete adjacent duplicates by sorting the table T01 in it loop itself if i am not wrong

0 Kudos

Thank you!

But T01 is not recognized. It will only be used in the background. I found this table when I tried to put a break sap id code in Infoset>Extras>Code>record processsing event. then a standard select statement is used and stored in T01. That's how query works. But how will I insert delete duplicate? should i also use again select statement in that event? and declare another internal table? not really sure how to use codes in infoset-sap query.

0 Kudos

Hi,

See in the program-> start-of-selection. Double click on the FM there you will find the select queries which coding gets generated automatically. there you will find the internal table name which is like final internal table. Or you can put break point in the record-processing event. and check which one is the final internal table and write like

:

declare on internal table in the data declaration

data:

lf_text(40) type c,

lt_jest type standard table of /1BCDWB/IQ000000000439.

( the name /1BCDWB/IQ000000000439 you need to find out while debugging. )

                                  • record processing event

break msonawane.

lt_jest[] = <ls_jest_buf>.

sort lt_jest by vkorg vtweg spart parvw kunnr kunn2 ."SMTP_ADDR001 SMTP_ADDR.

delete adjacent duplicates from lt_jest comparing vkorg vtweg spart parvw kunnr kunn2." SMTP_ADDR001 SMTP_ADDR .

<ls_jest_buf> = lt_jest[].

( <ls_jest_buf> is the final internal table in my case.)

PLease let me know if u need more info.

Rgds,

Madhuri

Edited by: madhuri sonawane on May 18, 2009 12:38 PM

Edited by: madhuri sonawane on May 18, 2009 12:47 PM

0 Kudos

Hi Madhuri,

Thanks for your advice. I am currently exploring it. but I can't find /1BCDWB/IQ000000000439. I even tried to put break sapd_id in the record processing event but it won't recognized. Need your futher details

Hoping for your response.

thank you so much again

0 Kudos

Hi Ella,

Go to SQ02.

Execute your query once.

then go to SE38. The name of the program will automatically come there.

In my case its like this:

for eg : AQZZZZ_FI_GL====ZZ_FI_GLLIST==

Former Member
0 Kudos

Hi,

as per my understanding you are getting two rows of values having same personal number and you want that to be made single.rt?

the output may containg diffrent values corresponing to the tables fetched //like line items in FI.. so wht i suggest is using loop and read the same internal table and add the second row,having diff valuse other than first row into the itab.

or if you are getting first and second line same

you can usee

delete adjacent duplicates from itab condition

avi6k
Explorer
0 Kudos

use this code inside infoset - code - data section

constants : wk_table(6) VALUE '%G00[]'.
FIELD-SYMBOLS : <t1> TYPE table.
data matnr type string VALUE 'VBAP-MATNR' .
data posnr type string VALUE 'VBAP-POSNR' .

infoset - code - end of selection after list section

ASSIGN (wk_table) TO <t1>.
 CHECK <t1> IS ASSIGNED.
 SORT <t1> by (posnr) (matnr).
 DELETE ADJACENT DUPLICATES FROM <t1> COMPARING (posnr) (matnr).