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

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!

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

Similar Messages

  • How to count no of records returned from a query?

    Hello,
    I need to find out how many records displayed from a query without writing any other queries.
    i mean that.
    I have a query such as:
    query = "select * from users";
    and the resultset for it is rs.
    and i need to display how many records fetched from this query without using any other query such as "select count(user_id) from users" etc.
    Is there any function ?

    No, unfortunately there is no method or property that will tell you how many rows have been returned by a query.
    People use many different techniques.
    1.The simplest would be, keep incrementing a counter in while ( rs.next() ) and at the end you'll have the count. But only at the end, after the loop.
    2. Run another query with count(*) just to fetch the count.
    3. Run the same query twice, once for counting and then again for printing out. Very dumb idea though, might as well do 2. suggested above.
    4. If you have a scrollable resultset, you could go to the lastRecord and then getRow number and hence know how many there are and then rewind the resultset. I don't know how advisable using scrollable resultsets is.
    5. Create a slightly clumsy query like : select count(*) as "totalcount", emp_id, emp_name, emp_email, emp_phone from employees group by emp_id, emp_name, emp_email, emp_phone. You'll need to use the group by clause since count() is an aggregate function and you can't mix aggregate functions and columns unless you add the group by to all the columns you're fetching.

  • How can I define Double Click Processing in SAP Query ?

    The first question is : How Can I define drill-down for SAP Query report ?
    The second one :  How can I program Double Click in SAP Query report for Different columns like ALV Grid processing ?

    you can attach a repot or at tcode etc in an SAP query using report assignment in SQ01 but as far as i remember you cannot attach multiple reports.
    regards,
    khusro habib

  • How to identify whether a TCode is for SAP query or for a customized TCode

    Hi,
    We have a list of TCodes starting with Y_*
    Some of these TCodes could be related to SAP Queries and some could be real custom transactions. How do I find out which one of those are related to SAP queries and which ones are related to custom SAP transactions?
    I have already checked table TSTC for the program names of these Transactions, but the program name field (PGMNA) is blank. Also in TCode SE93 the transaction mentioned is START_REPORT. Also for some, when I go to the transaction (Y_*) and then environment->status to check the program name the values found are something like AQ11FI==========F10A==========.
    Please help on how to identify whether a TCode is actually for an SAP query or for a customized transaction.
    Thanks in advance.
    Mick

    Thanks Anil.
    In TSTC, the filed for program name is blank. Therefore I would have to go to each and every transaction (I  have around 250 Y_* TCodes with me) and then to environment->status to get the program name and then check whether it is A......
    Is there any easier way to know whether a TCode refers to an SAP query or a custom developed transactions/program.
    Mick

  • SQ01 Sap Query - additional fields doesn't appear

    Hi everybody,
    i've created a SAP Query with transaction SQ01 but one of my additional fields doesn't appear when i execute my Query.
    My query shows the G/L account number and the field status Group (table SKB1)
    I just need to display equally the text field of "field status Group" but it doesn't work.
    When i look at the parameters i can see that it makes the link between the table T004G and SKB1 in order to find the textfield but the field stay blank.
    For information T004g is a Pooled table.
    Is someone could help me?
    Thank you

    Hi,
    First you need to create a structure in Data Dictionary - SE11. This structure will contain all the fields that you want to display in the query output.
    Example - Name the Strucutre as zz_infoset01
    fields of the structure( for your requirement )
    BUKRS
    SAKNR
    FSTAG
    FSTTX
    Go to T-code SQ02
    1) Enter the Infoset name - zinfoset01 press create
    2) Enter a Short Description - G/L Infoset - 01
    3) select radio button - "Data retrieval by program"
                   and in "data structure" enter   zz_infoset01
    4) select "Integrated program" radio button
    5) In the next screen click on the "Data reading program" push button(on the application toolbar)
    6) An Editor will open with the following code
    REPORT  rsaqdvp_template .
      declarations
      (insert your declarations in this section)
    DATA:
      zz_infoset01                          TYPE zz_infoset01                          ,
      it_data TYPE STANDARD TABLE OF zz_infoset01 WITH HEADER LINE.
      selection screen statements
      (define your selection-screen here)
    !! the following comment MUST NOT BE CHANGED !!
    *<QUERY_HEAD>
      read data into IT_DATA
    (select your data here into internal table IT_DATA)
      output of the data
      (this section can be left unchanged)
    LOOP AT it_data.
      zq01  = it_data.                        .
    !! the following comment MUST NOT BE CHANGED !!
    *<QUERY_BODY>
    ENDLOOP.     
    7) when you insert your code in the sections it will look like this
    REPORT  rsaqdvp_template .
      declarations
      (insert your declarations in this section)
    Tables:SKB1,
              t004g.          
    DATA:
      zz_infoset01                          TYPE zz_infoset01 ,
      it_data TYPE STANDARD TABLE OF zz_infoset01 WITH HEADER LINE.
      selection screen statements
      (define your selection-screen here)
    !! the following comment MUST NOT BE CHANGED !!
    *<QUERY_HEAD>
    *These will be the input parameters for the query
    parameters: sp_bukrs like skb1-bukrs,
             sp_saknr like skb1-saknr.     
      read data into IT_DATA
    (select your data here into internal table IT_DATA)
    *get all the G/L for com code and G/L in selection screen
    SELECT bukrs saknr fstag
                INTO TABLE it_data
                FROM skb1
                WHERE bukrs = sp_bukrs
                AND   saknr = sp_saknr.
      output of the data
      (this section can be left unchanged)
    *for every G/L get the status text from t004g for lang 'EN'
    LOOP AT it_data.
    SELECT SINGLE fsttx
                    FROM t004g
                    INTO it_data-fsttx
                    WHERE spras = 'EN' "Language
                    AND   bukrs = it_data-bukrs
                    AND   fstag = it_data-fstag.
      zz_infoset01  = it_data.                        .
    !! the following comment MUST NOT BE CHANGED !!
    *<QUERY_BODY>
    ENDLOOP.     
    8) Save and generate the Infoset.By clicking on the generate button.
    9) Now assign the Infoset to the query in SQ01 and select the output list fields.
    let me know if you need more info. Also award points if helpful.
    Regards,
    Santosh

  • How to have few distincts colors per day on the year calendar, ( like month or day calendar ) thank

    When i use Ical, ( dayly, week, month ) i can have lot of distinct colors for each days, few colors in the same day,
    When i use Ical ( year ) just one color appear each day,
    Can i change that to have the same wiev of day in each calendar ( ex: in the year calendar, how to see i've doctor the 2013 01 10 in blue
    the teacher the 2013 01 10 in yellow and pay the taxe the 2013 01 10 in red )
    thank for reply
    sorry for my english

    I believe, I have answered my own question....
    thx

  • How to reach customer record from a SAP Query (Report)

    Dear all,
    I have created a Query to list customers based on parameters like 'Created by' and 'Creation date'.
    from that query output screen how can we enter customer master data screen in display mode.
    that means I have listed all customers using a query, but by clicking on any customer number it has to take us to the customer master data screen in dispaly mode - (XD03 / VD03).
    Please educate me to resolve this issue, your help will be highly appreciated.
    Thank you,
    Raghu Ram

    try: sq01 - goto - report assignment
    A.

  • DISTINCT RECORDS IN TABLE sql query

    Hi everybody
    Can I SELECT more than one column from a table and only have the first value distinct.

    If you want to have one column distinct with selection of more than one column, you can use Row_Number()
    Declare @VtABLE tABLE (id int, Name varchar)
    Insert into @vTable
    Select 1, 'A' Union All
    Select 2, 'A' Union All
    Select 3, 'B'
    ;with wcte as (
    Select Row_Number()over (Partition By Name Order by ID) RNO,id,name from @vTable
    ) Select * from wcte where RNO = 1
    Please visit my Blog for some easy and often used t-sql scripts
    My BizCard

  • Copy Z program into SQ01 - SAP Query

    Hi all,
    i have this situation that i need to put a z program back into SQ01, can this be possibly done.
    I have previously generated the Z program from a different client using SQ01.
    please advice....
    Regards
    William Wilstroth

    Yes,
       You can do.Because System will generate a program .After processing its own code next the code which is under START-OF-SELECTION will get executed.Here if u want your output in excel or in file you do it by useing function module for excel & opendatabase statement  for files.
    If you want to see the progarm of system generated ,first execute query you will get your selection screen.Now open one more session using tcode SE38 there you can see the system program in display mode.
    Note : if there is no requiremnet of using event  "RECORD PROCESSING" then use "LEAVE."  word under this.With this your program performance will get increase.
    Let me know if you want more details.
    Pls. reward if  it useful

  • How to get the output format options of SAP QUERY

    Hi Gurus,
    I want to get the output options available for sapquery program.means when you execute the program "AQZZ/SAPQUERY/FDF1============" you will get output options like sap alv,display as table,wordprocessing  etc.
    i am not able to unsderstand the logic in that standard code.my requirement is after fetching the data from the database i want to provide the ouput options SAP ALV,DISPLAY AS TABLE,WORD PROCESSING,SPREAD SHEET,FILESTORE.
    I can output the data in SAP ALV and i can store the data.But i am not able to use the the remaining options in my program.please provide me solution.
    I am very much thankful to the people who can provide me the solution.

    Hi,
    If you have a query then go to transaction 'SQ01' . Then press the change button . Then u will able to see the Output Options.Their u can select the option what ever u want.

  • How to change title of a field in SAP Query

    Dear All,
    I have created a financial query. I want to change the field title which is displayed in the layout. Pls guide what is the process to change the title of a field appearing in the report.
    Regards
    Kundan
    Edited by: Kundan Pariyar on Jan 23, 2009 11:41 AM

    Hello,
    I believe you have created the query in SQ00.
    Go to SQ00.
    Select your Query.
    Click on Change
    On the Top Left Hand Corner, you will find "BASIS MODE"
    Click on the Basis Mode Button
    Once you click on Basis Mode Button, you will get "Title"
    Change the title what you are intended to change.
    SAVE the entries.
    Execute the Query.
    You will be able to see new Heading on the Query.
    Hope this helps you.
    Regards,
    Ravi

  • SAP Query: How to filter records from SAP Query output before display

    Hi Friends,
      Can I delete records from an SAP query basic list before it is displayed?
    For example I want to delte all the orders whose system status is "RELEASED" before the basic list of that SAP query is displayed.
    I have gone through SAP help and found out that we can write some code in <b>END code</b> section which will execute before the basic list of the query is displayed. But I could not figure out how the code this...following is an excerpt form SAP help.
    <b>"The END-OF-SELECTION code consists of two parts (Before list output and After list output). The first part is processed before the list is output and the second part afterwards."</b>
    Can anybody help me?
    Regards,
    Bharat.
    Message was edited by:
            Bharat Reddy V

    Try this simple procedure. <b>Hope</b> this should work for you.
    You do the slection of the status in the List-Processing. say your final field of status flag is GF_STATUS.
    Immediatly after that use this within the List-Processing.
    CHECK GF_STATUS EQ '<RELEASED STATUS>'
    How it works:
    SELECT  <>       "<-------Query processing(system code).
    *< Your code put in the List processing
    CHECK GF_STATUS EQ '<RELEASED STATUS>'   "< --only released records passed.
    *>
    ENDSELECT      "<-----Query endselect(system code).
    Please let me know the result.
    Regards,
    A.Singh
    Message was edited by:
            Amarjit Singh

  • How to return the record count of a query to a number variable

    How would I get the record count from a query without using a cursor to step through the query and count the records individually?
    query: select * from table1 where column1 = column2
    How would I get the record count of the query above?
    thanks,
    michelle

    I figured it out
    select count(*) into theCount
    from ( select * from table1 where column1=column2 );
    thanks,
    michelle

  • How to find the report for the SAP query (Query exists in table AQLQCAT)

    Hello Experts,
    I need to find the tables used in the SAP Query but i don't have access to transaction SQ01,SQ02 and SQ03 to check the same.
    Therefore i checked table AQLQCAT and got the SAP Queries in the system. Then searched for the reports that would have been generated for the same passing  AQusergroupquery name*  in transaction SE38.
    But unfortunately the program does not exists for the given paramenter.
    Could you please let me know how to get the report name for the SAP Query.
    Secondly please suggest any other way of checking the tables used in the SAP Query.
    Also the table name from where i can download the SAP Queries.
    Thanks in advance.
    Regards,
    Rahul Sinha

    I suggest you a simple method.
    Execute the query. When the selection screen is showed,  go to menu and click to SYSTEM->STATUS.
    Check the program name and double click it to access the program code.
    Search for tables or functions into the source code in order to understand where data are taken.
    If you do not find anything , go to the program atttribute and check for logic database, sometimes they are used....
    Best regards.

  • How to create t.code for a sap query

    i have created a sap query.
    user wants this as a t.code.
    how to assign a t.code for teh sap query.
    kindly explain me.

    hi,
    The other way of doing it.
    1. Instead of creating your queries in SQ01, use SQVI. Create a query in your production system.
    2. Now execute the query. When you have reached the selection screen, go to System > Status.
    3. Copy the program name.
    4. Now create a Z executable program in your development client. Put this one line of code in it:
    submit program_name_copied_fr_production via selection-screen and return.
    5. Create a TCode and assign the Z program to the TCode.
    6. Transport the Z program and TCode over to Production system.
    Hope this works for you, Do reward.

Maybe you are looking for

  • Get data in a subreport based on a shared variable from the main report.

    Goodd morning, My question/problem is how to manage this scenario. I am transfering 2 shared variables (pereiod from /period To, ) from the main report to a subreport and now  i would like to get data in this subreport based on these 2 variables... T

  • Flex Cube - Deposits and CASA documentation

    Flex Cube - Deposits and CASA documentation: someone could help me to find documentation and information about CA SA and Deposits Flex CUbe MOdule ? Thanks.

  • PCK loopback configuration in NW04s

    Hello, my company has a few PCK installations on Unix and Linux machines (NW04s). I am trying to create a loopback scenario. By loopback I mean that the PCK works without an integration server and it sends the messages to itself. I use file sender an

  • Iphoto 08 cannot see pictures from this past year in events?

    Hi! I have been using iphoto 08 pretty successfully this past year, getting used to not being able to access the files directly, uploading on to snapfish, and accessing my photo library on the external hard drive. well, tonight I was trying to post a

  • How do I remove previous editions (8, 9 , 10, 11 and 12) of Elements?

    I currently have Elements 14 installed and my computer is not happy. The techie working on my computer as tried to remove the old software but neither of us have been successful.  All of the copies were legally obtained and paid for but I no longer h