Display duplicate records

Hi,
I want to make a report which shows duplicate records in a table. We can fetch the duplicate records by using the rowid in sql but how to make it work in OBIEE? the table does not hold a unique key.

try something similar http://carpediemconsulting.wordpress.com/2008/08/13/displaying-duplicate-values-in-obiee-reports/
OR
Use Direct Database Request to write direct SQLs as you do in Database

Similar Messages

  • Select query-using Union All display duplicate records.

    Hello All Gurus-
    I am using Oracle 9.i
    When i use the following query to fetch the records based on BUILDNUMBERNAME and ASSIGNED_BUILD then i am getting duplicate records -
    select T1.ID FROM Defect T1,statedef T2,repoproject T3
    WHERE T1.STATE=T2.ID AND T1.repoproject = T3.dbid AND T3.name Like 'ABC' AND T1. ASSIGNED_BUILD like '1.4.5.6'
    Union All
    select T1.ID FROM Defect T1,statedef T2,repoproject T3
    WHERE T1.STATE=T2.ID AND T1.repoproject = T3.dbid AND T3.name Like 'ABC' AND T1.BUILDNUMBERNAME like '1.4.5.6'
    How can i use the order by on T1.ID ? When i use the Order by T1.ID then it throws some error.
    Kindly help me in this :(
    Thanks in advance.

    Sorry for not providing all of the details -
    I am using Toad tool to run the query.
    1-When i use the following query -
    Select T1.ID FROM Defect T1,statedef T2,repoproject T3
    WHERE T1.STATE=T2.ID AND T1.repoproject = T3.dbid AND T3.name Like 'ABC' AND T1. ASSIGNED_BUILD like '1.4.5.6' order by T1.ID
    Union All
    select T1.ID FROM Defect T1,statedef T2,repoproject T3
    WHERE T1.STATE=T2.ID AND T1.repoproject = T3.dbid AND T3.name Like 'ABC' AND T1.BUILDNUMBERNAME like '1.4.5.6' order by T1.ID
    ORA-00933: SQL command not properly ended.
    2-If i am not using the T1.ID and run the following query
    Select T1.ID FROM Defect T1,statedef T2,repoproject T3
    WHERE T1.STATE=T2.ID AND T1.repoproject = T3.dbid AND T3.name Like 'ABC' AND T1. ASSIGNED_BUILD like '1.4.5.6'
    Union All
    select T1.ID FROM Defect T1,statedef T2,repoproject T3
    WHERE T1.STATE=T2.ID AND T1.repoproject = T3.dbid AND T3.name Like 'ABC' AND T1.BUILDNUMBERNAME like '1.4.5.6'
    Then it is running fine but it is displaying the duplicate values like -
    00089646
    00087780
    00089148
    00090118
    00090410
    00088503
    00080985
    00084526
    00087108
    00087109
    00087117
    00088778
    00086714
    00079518
    00087780
    00089148
    00090392
    00090393
    00090395
    00090398
    00090401
    00090402
    00090403
    00090406
    00090408
    00088503
    00080985
    00084526
    00087108
    00087109
    00087117
    00088778
    00086714
    00079518

  • Query displaying duplicate records

    I have written a query to display  materials having no purchasing group.
    Can any one plz tell me that why it is displaying duplicate results.
    Thanks
    aprr

    Apprr,
    You have given us no information to help you.
    Please list the Datasource:  Table Join, Direct Read, Logical database, or program.
    Please list any Table or Tables you are using.
    If you are using Table join(s), please list the joined tables and all linking fields.
    Rgds,
    DB49

  • Avoid displaying duplicates records?

    I have the following query to display records from two tables:
    select * from COLLATERAL CL, COLLATERAL_REF CF where CF.ACCOUNT_NUMBER like '1000000001%' AND CF.COLLATERAL_ID=CL.COLLATERAL_ID
    How do i change this query to avoid duplicate collateral_id's?.
    Collateral_id is the primary key on Collateral table and foreign key on Collateral_ref table.
    null

    Thanks isotope for your reply.
    I just ran the query and I get 00904:"cl"."collateral_id": invalid identifier.
    Here is my table structure:
    Collateral (Collateral_id is Primary Key):
    Collateral_id Collateral_type Description Serial_Number ..
    1 Title 97 Accord 111111
    32 Mortgage 122 Grand Av
    26 Title          2008 BMW 222222
    Collateral_Ref (Collateral_id is foreign key)
    Collateral_id Account_Number      Description ..
    1          100000001 111111111     97 Accord     
    1          100000001 222222222     97 Accord     
    32          100000001 444444444     122 Grand Av
    32          100000001 333333333     122 Grand Av
    32          100000001 999999999     122 Grand Av
    26          200000001 222222222 2008 BMW
    So, My query currently returns all the duplicate (1 twice and 32 thrice)
    expected results should be:
    Collateral_id Collateral_type Description ..
    1 Title 97 Accord
    32 Mortgage 122 Grand Av

  • Counting duplicate records in a table

    Hi,
    I have to display duplicate records in a table,but the table name and column should be passed dynamically(In procedure). Please let me know the query for this.

    Try this one, is used to find the duplicate value from table
    Type: I
    SELECT * FROM employees e1 WHERE rowid> (SELECT min(rowid)
    FROM employees e2 WHERE e1.department_id=e2.department_id);
    Type: II
    SELECT * FROM my_table t1 WHERE EXISTS (SELECT 'x' FROM my_table t2
    WHERE t2.key_value1 = t1.key_value1
    AND t2.key_value2 = t1.key_value2
    AND t2.rowid > t1.rowid);
    Type: III
    SELECT count(*), empn FROM empmast_dum
    GROUP BY empn HAVING count(*) >1 ORDER BY empn;
    Type: IV
    SELECT dep, name,net,RANK() OVER (PARTITION BY dep ORDER BY net) rank
    FROM empmast_dump
    WHERE dep=04;
    Type: V
    SELECT empn FROM empmast_dump
    WHERE empn NOT IN(SELECT MIN(empn)
    FROM empmast_dump GROUP BY NAME;
    I have to display duplicate records in a
    table,but the table name and column should be passed
    dynamically(In procedure). Please let me know the
    query for this.When you need to pass table name dynamically in your procedure ,
    just enter table name as substitution variable or bind variable, if u want to know about
    this, read here
    venki
    http://venki-hb.blogspot.com/2008/02/basic-sql-query-tips.html

  • Duplicate records in a collection

    Hi Experts,
    Just now I've seen a thread related to finding duplicate records in a collection. I understand that it is not advisable to sort/filter data in a collection.
    (https://forums.oracle.com/thread/2584168)
    Just for curiosity I tried to display duplicate records in a collection. Please Please .. this is just for practice purpose only. Below is the rough code which I wrote.
    I'm aware of one way - can be handled effectively by passing data into a global temporary table and display the duplicate/unique records.
    Can you please let me know if there is any other efficient wayto do this.
    declare
      type emp_rec is record ( ename varchar2(40), empno number);
      l_emp_rec emp_rec; 
      type emp_tab is table of l_emp_rec%type index by binary_integer;
      l_emp_tab emp_tab;
      l_dup_tab emp_tab;
      l_cnt number;
      n number :=1;
    begin
    -- Assigning values to Associative array
      l_emp_tab(1).ename := 'suri';
      l_emp_tab(1).empno := 1;
      l_emp_tab(2).ename := 'surya';
      l_emp_tab(2).empno := 2;
      l_emp_tab(3).ename := 'suri';
      l_emp_tab(3).empno := 1;
    -- Comparing collection for duplicate records
    for i in l_emp_tab.first..l_emp_tab.last
    loop
        l_cnt :=0;  
    for j in l_emp_tab.first..l_emp_tab.last 
        loop      
           if l_emp_tab(i).empno  =  l_emp_tab(j).empno and l_emp_tab(i).ename  =  l_emp_tab(j).ename then
               l_cnt := l_cnt+1;          
                   if l_cnt >=2 then
                      l_dup_tab(n):= l_emp_tab(i);
                   end if;
           end if;                   
        end loop;  
    end loop;
    -- Displaying duplicate records
    for i in l_dup_tab.first..l_dup_tab.last
    loop
       dbms_output.put_line(l_dup_tab(i).ename||'  '||l_dup_tab(i).empno);
    end loop;
    end;
    Cheers,
    Suri

    Dunno if this is either easier or more efficient but it is different.  The biggest disadvantage to this technique is that you have extraneous database objects (a table) to keep track of.  The advantage is that you can use SQL to perform the difference checks easily.
    Create 2 global temporary tables with the structure you need, load them, and use set operators (UNION [ALL], INTERSECT, MINUS) to find the differences.  Or, create 1 GTT with an extra column identifying the set and use the extra column to identify the set records you need.

  • How to suppress duplicate records in rtf templates

    Hi All,
    I am facing issue with payment reason comments in check template.
    we are displaying payment reason comments. Now the issue is while making batch payment we are getting multiple payment reason comments from multiple invoices with the same name and it doesn't looks good. You can see payment reason comments under tail number text field in the template.
    If you provide any xml syntax to suppress duplicate records for showing distinct payment reason comments.
    Attached screen shot, template and xml file for your reference.
    Thanks,
    Sagar.

    I have CRXI, so the instructions are for this release
    you can create a formula, I called it cust_Matches
    if = previous () then 'true' else 'false'
    IN your GH2 section, right click the field, select format field, select the common tab (far left at the top)
    Select the x/2 to the right of Supress  in the formula field type in
    {@Cust_Matches} = 'true'
    Now every time the {@Cust_Matches} is true, the CustID should be supressed,
    do the same with the other fields you wish to hide.  Ie Address, City, etc.

  • Duplicate records problem

    Hi everyone,
    I'm having a a little difficulty resolving a problem with a repeating field causing duplication of data in a report I'm working on, and was hoping someone on here can suggest something to help!
    My report is designed to detail library issues during a particular period, categorised by the language of the item issued. My problem is that on the sql database that out library management system uses, it is possible for an item to have more than one language listed against it (some books will be in more than one language). When I list the loan records excluding the language data field, I get a list of distinct loan records. Bringing the language data into the report causes the loan record to repeat for each language associated with it, so if a book is both in English and French, it will cause the loan record to appear like this:
    LOAN RECORD NO.     LANGUAGE CODE
      123456                             ENG
      123456                             FRE
    So, although the loan only occurred once I have two instances of it in my report.
    I am only interested in the language that appears first and I can exclude duplicated records from the report page. I can also count only the distinct records to get an accurate overall total. My problem is that when I group the loan records by language code (I really need to do this as there are millions of loan records held in the database) the distinct count stops being a solution, as when placed at this group level it only excludes duplicates in the respective group level it's placed in. So my report would display something like this:
    ENG     1
    FRE      1
    A distinct count of the whole report would give the correct total of 1, but a cumulative total of the figures calculated at the language code group level would total 2, and be incorrect. I've encountered similar results when using Running Totals evaluating on a formula that excludes repeated loan record no.s from the count, but again when I group on the language code this goes out of the window.
    I need to find a way of grouping the loan records by language with a total count of loan records alongside each grouping that accurately reflects how many loans of that language took place.
    Is this possible using a calculation formula when there are repeating fields, or do I need to find a way of merging the repeating language fields into one field so that the report would appear like:
    LOAN RECORD     LANGUAGE CODE
      123456                      ENG, FRE
    Any suggestions would be greatly appreciated, as aside from this repeating language data there are quite a few other repeating database fields on the system that it would be nice to report on!
    Thanks!

    if you create a group by loan
    then create a group by language
    place the values in the group(loan id in the loan header)
    you should only see the loan id 1x.
    place the language in the language group you should only see that one time
    a group header returns the 1st value of a unique id....
    then in order to calculate avoiding the duplicates
    use manual running totals
    create a set for each summary you want- make sure each set has a different variable name
    MANUAL RUNNING TOTALS
    RESET
    The reset formula is placed in a group header report header to reset the summary to zero for each unique record it groups by.
    whileprintingrecords;
    Numbervar  X := 0;
    CALCULATION
    The calculation is placed adjacent to the field or formula that is being calculated.
    (if there are duplicate values; create a group on the field that is being calculated on. If there are not duplicate records, the detail section is used.
    whileprintingrecords;
    Numbervar  X := x + ; ( or formula)
    DISPLAY
    The display is the sum of what is being calculated. This is placed in a group, page or report footer. (generally placed in the group footer of the group header where the reset is placed.)
    whileprintingrecords;
    Numbervar  X;
    X

  • Problem with duplicates record

    I have created an SAP_DataMart Fixed Query in SAP MII but I am getting duplicates records.
    Also, in my parameters settings I have  - PARAM.20 - 20140601  and PARAM.21  - 20140615 for dates
    Yet, I have the dates only displaying for 20140601 to 20140608?
    Please see attached part of a screenshot.
    Thank you.

    Hi Amr,
    It probably looks like an issue with the query itself. I suggest you verify the query by executing it directly in the source data system e.g in SAP using SQ01 and see if you get the same results.
    If yes, then it is a query join issue.
    Regards,
    Saumya Govil

  • Duplicate Records error when processing transaction file....BPC 7.0

    Hi All,
    I have a situation. I am using BPC NW 7.0 and I have updated my dimension files. When I try to validate my transaction file every single record is validated successfully. But when I try to import the flat file into my application, I am getting a lot of dupplication records error and these are my questions.
    1. Will we get duplicate records in transaction files?
    2. Even if there are duplication, since it is a cube it should summarize not display that as a error and reject records?
    3. Is there something I can do to accept duplicates (I have checked the Replace option in the data package, to overwrite the simillar records, but it is only for account, category and entity only.
    5. In mycase I see identical values in all my dimension and the $value is the only difference. Why is it not summing up.
    Your quickest reply is much appreciated.
    Thanks,
    Alex.

    Hi,
    I have the same problem.
    In my case the file that I want to upload has different row that differ for the nature column. In the conversion file I map different nature to one internal nature.
    ES: cost1 --> cost
          cost2 --> cost
          cost3 --> cost
    In my desire was that in BPC the nature cost assume the result  cost = cost1 + cost2 + cost3.
    The result is that only the first record is uploaded and all other recorda are rejected as duplicate.
    Any suggestion?

  • Duplicate Records in Output

    I have a script which works fine however what I cant seem to work out is why I get duplicate records in the output. If anyone knows why it would be a great help/
    My code is below:
    Connect-QADService "domain.com"
    Function CheckUserExistance {
    if(Get-QADUser -Identity $Global:Sam) {
    Write-Host "User Found: $Global:Sam"
    $Example = $Global:Sam + "2"
    $prompt = "This User Already Exists, Please Choose Another Name. (e.g. $Example)"
    $Title = "Error"
    Add-Type -AssemblyName microsoft.visualbasic
    $popup = [Microsoft.VisualBasic.interaction]::MsgBox($prompt,"OkOnly,Critical", $title)
    if ($popup -eq "Ok"){
    $prompt = "Please Enter The Name To Create (All Lowercase e.g john.smith):"
    $Title = "User To Create"
    Add-Type -AssemblyName microsoft.visualbasic
    $Global:Sam = [Microsoft.VisualBasic.interaction]::inputbox($prompt,$title)
    if ($Global:Sam -eq ""){exit}
    # The following Function is used to randomly generate complex passwords.
    function New-Password
    param
    [int]$length,
    [switch]$lowerCase,
    [switch]$upperCase,
    [switch]$numbers,
    [switch]$specialChars
    BEGIN
    # Usage Instructions
    function Usage()
    Write-Host ''
    Write-Host 'FUNCTION NAME: New-Password' -ForegroundColor White
    Write-Host ''
    Write-Host 'USAGE'
    Write-Host ' New-Password -length 10 -upperCase -lowerCase -numbers'
    Write-Host ' New-Password -length 10 -specialChars'
    Write-Host ' New-Password -le 10 -lo -u -n -s'
    Write-Host ' New-Password'
    Write-Host ''
    Write-Host 'DESCRIPTION:'
    Write-Host ' Generates a random password of a given length (-length parameter)'
    Write-Host ' comprised of at least one character from each subset provided'
    Write-Host ' as a switch parameter.'
    Write-Host ''
    Write-Host 'AVAILABLE SWITCHES:'
    Write-Host ' -lowerCase : include all lower case letters'
    Write-Host ' -upperCase : include all upper case letters'
    Write-Host ' -numbers : include 0-9'
    Write-Host ' -specialChars : include the following- !@#$%^&*()_+-={}[]<>'
    Write-Host ''
    Write-Host 'REQUIREMENTS:'
    Write-Host ' You must provide the -length (four or greater) and at least one character switch'
    Write-Host ''
    function generate_password
    if ($lowerCase)
    $charsToUse += $lCase
    $regexExp += "(?=.*[$lCase])"
    if ($upperCase)
    $charsToUse += $uCase
    $regexExp += "(?=.*[$uCase])"
    if ($numbers)
    $charsToUse += $nums
    $regexExp += "(?=.*[$nums])"
    if ($specialChars)
    $charsToUse += $specChars
    $regexExp += "(?=.*[\W])"
    $test = [regex]$regexExp
    $rnd = New-Object System.Random
    do
    $pw = $null
    for ($i = 0 ; $i -lt $length ; $i++)
    $pw += $charsToUse[($rnd.Next(0,$charsToUse.Length))]
    Start-Sleep -milliseconds 20
    until ($pw -match $test)
    return $pw
    # Displays help
    if (($Args[0] -eq "-?") -or ($Args[0] -eq "-help"))
    Usage
    break
    else
    $lCase = 'abcdefghijklmnopqrstuvwxyz'
    $uCase = $lCase.ToUpper()
    $nums = '1234567890'
    $specChars = '!@#$%^&*()_+-={}[]<>'
    PROCESS
    if (($length -ge 4) -and ($lowerCase -or $upperCase -or $numbers -or $specialChars))
    $newPassword = generate_password
    else
    Usage
    break
    $newPassword
    END
    Import-Csv "C:\ExternalADAccounts.csv" |
    ForEach-Object {
    $First = $_.Forename
    $Last = $_.Surname
    $Password = New-Password -length 8 -upperCase -lowerCase -numbers -specialChars
    $stuff = $_.stuff
    $OU = "domain.com/ou"
    $UPN = "$First.$Last@$stuff.domain.com"
    $Global:Sam = "$First.$Last"
    $Display = "$First $Last"
    $Global:Sam = $Global:Sam -Replace " ", ""
    $Global:Sam = $Global:Sam -Replace "'",""
    $Count = $Global:Sam.Length
    If($Count -gt "19"){
    $Global:Sam = $First[0] + "." + $Last
    Do{CheckUserExistance}
    While(Get-QADUser -Identity $Global:Sam)
    Write-Host "Creating User: $Global:Sam"
    New-QADUser -FirstName $First `
    -LastName $Last `
    -DisplayName $Display `
    -Name $Global:Sam `
    -SamAccountName $Global:Sam.ToLower() `
    -UserPassword $Password `
    -UserPrincipalName $UPN.ToLower() `
    -ParentContainer $OU
    do{
    $Test = Get-QADUser -Identity $Global:Sam
    } until(Get-QADUser -Identity $Global:Sam)
    Set-QADUser $Global:Sam -Title 'Non-Managed'
    } | Select-Object @{label="DisplayName";expression={$Display}},@{label="SamAccountName";expression={$Global:Sam}}, @{label="Password";expression={$Password}}, @{label="Stuff";expression={$Stuff}} |
    Sort-Object $Stuff |
    Export-Csv "C:\NonManagedCreated.csv" -NoTypeInformation
    Any help is greatly appreciated.
    James

    Hi James,
    Please try the script below, which will use Psobject to format the output:
    $output=@()##########
    Import-Csv "C:\ExternalADAccounts.csv" |
    ForEach-Object {
    do{
    $Test = Get-QADUser -Identity $Global:Sam
    } until(Get-QADUser -Identity $Global:Sam)
    Set-QADUser $Global:Sam -Title 'Non-Managed'
    ###########output
    $Object = New-Object -TypeName PSObject
    $object | Add-Member -Name 'DisplayName' -MemberType Noteproperty -Value $DisplayName
    $object | Add-Member -Name 'SamAccountName' -MemberType Noteproperty -Value $Global:Sam
    $object | Add-Member -Name 'Password' -MemberType Noteproperty -Value $Password
    $object | Add-Member -Name 'Stuff' -MemberType Noteproperty -Value $Stuff
    $output+=$Object
    $output|select DisplayName,SamAccountName,Password,Stuff| Sort-Object Stuff |Export-Csv "C:\NonManagedCreated.csv" -NoTypeInformation
    If there s anything else regarding this issue, please feel free to post back.
    Best Regards,
    Anna Wang

  • Duplicate Records in Details for ECC data source. Help.

    Hello. First post on SDN. I have been searching prior posts, but have come up empty. I am in the middle of creating a report linking directly into 4 tables in ECC 6.0. I am having trouble in getting either the table links set up correctly, or filtering out duplicate record sets that are being reporting in the details section of my report. It appears that I have 119 records being displayed, when the parameters values should only yeild 7. The details section is repeating the 7 records 17 times (there are 17 matching records for the parameter choices in one of the other tables which I think is the cause).
    I think this is due to the other table links for my parameter values. But, I need to keep the links the way they are for other aspects of the report (header information). The tables in question are using an Inner Join, Enforced Both, =. I tried the other link options, with no luck.
    I am unable to use the "Select Disctinct Records" option in the Database menu since this is not supported when connecting to ECC.
    Any ideas would be greatly appreciated.
    Thanks,
    Barret
    PS. I come from more of a Functional background, so development is sort of new to me. Take it easy on the newbie.

    If you can't establish links to bring back unique data then use a group to diplay data.
    Group report by a filed which is the lowest commom denominator.
    Move all fields into group footer and suppress Group header and details
    You will not be able to use normal summaries as they will count/sum all the duplicated data, use Running Totals instead and select evaluate on change of the introduced group
    Ian

  • Duplicate records in TABLE CONTROL

    Hi folks,
    i am doing a module pool where my internal table (itab) data is comming to table ontrol(ctrl).then i need to select one record in table control & then i press REFRESH push button.
    after putting the refresh button, some new records are comming to that same internal table.then i need to display the modified internal table (some new records are added) data in the table control.
    The modified internal table data is comming to the table control but to the last of table control, some records are repeating.
    before comming to table control, i checked the modified itab. it contains correct data.i.e it contains 15 records.(previously i have 5 records.after REFRESH button 10 more records are added.). but when this table is comming to table control, it contains some 100 record.i should get only 15 record.
    why these records r repeting. how to delete the duplicate records from table control?
    plz suggest me where i am doing mistake.
    correct answer will be rewarded
    Thanks & Regards

    Hi ,
    Thanks for ur help. but i should not refresh the internal table  as some records r already present.after putting the REFRESH button, some new records r appending to this existing table.then i am going to display the previous records & the new records as well.
    i checked the internal table after modification.it contains actual number of records. but after comming to table control , more records r comming.
    is this the problem with scrolling or waht?
    plz suggest where i am doing mistake.i am giving my coding below.
    PROCESS BEFORE OUTPUT.
    MODULE STATUS_0200.
    module tc_shelf_change_tc_attr.
    loop at object_tab1
           with control tablctrl
           cursor tablctrl-current_line.
        module tc_shelf_get_lines.
      endloop.
    PROCESS AFTER INPUT.
    module set_exit AT EXIT-COMMAND.
       loop at object_tab1.
             chain.
              field: object_tab1-prueflos,
                     object_tab1-matnr.
               module shelf_modify on chain-request.
             endchain.
            field object_tab1-idx
             module shelf_mark on request.
                   endloop.
    module shelf_user_command.
    module user_command_0200.
    ***INCLUDE Y_RQEEAL10_STATUS_0200O01 .
    *&      Module  STATUS_0200  OUTPUT
          text
    MODULE STATUS_0200 OUTPUT.
      SET PF-STATUS 'MAIN'.
    SET TITLEBAR 'xxx'.
    ENDMODULE.                 " STATUS_0200  OUTPUT
    *&      Module  tc_shelf_change_tc_attr  OUTPUT
          text
    MODULE tc_shelf_change_tc_attr OUTPUT.
    delete adjacent duplicates from object_tab1 comparing prueflos matnr.
    describe table object_tab1 lines tablctrl-lines.
    ENDMODULE.                 " tc_shelf_change_tc_attr  OUTPUT
    *&      Module  tc_shelf_get_lines  OUTPUT
          text
    MODULE tc_shelf_get_lines OUTPUT.
    data:  g_tc_shelf_lines  like sy-loopc.
    if tablctrl-current_line > tablctrl-lines.
    stop.
    endif.
    g_tc_tablctrl_lines = sy-loopc.
    *refresh control tablctrl from screen 0200.
    ENDMODULE.                 " tc_shelf_get_lines  OUTPUT
    ***INCLUDE Y_RQEEAL10_SHELF_MODIFYI01 .
    *&      Module  shelf_modify  INPUT
          text
    MODULE shelf_modify INPUT.
    modify object_tab1
        index tablctrl-current_line.
    ENDMODULE.                 " shelf_modify  INPUT
    *&      Module  set_exit  INPUT
          text
    module set_exit INPUT.
    leave program.
    endmodule.                 " set_exit  INPUT
    *&      Module  shelf_mark  INPUT
          text
    MODULE shelf_mark INPUT.
    data: g_shelf_wa2 like line of object_tab1.
      if tablctrl-line_sel_mode = 1
      and object_tab1-idx = 'X'.
        loop at object_tab1 into g_shelf_wa2
          where idx = 'X'.
          g_shelf_wa2-idx = ''.
          modify object_tab1
            from g_shelf_wa2
            transporting idx.
        endloop.
      endif.
      modify object_tab1
        index tablctrl-current_line
        transporting idx plnty plnnr plnal.
    ENDMODULE.                 " shelf_mark  INPUT
    *&      Module  shelf_user_command  INPUT
          text
    MODULE shelf_user_command INPUT.
    ok_code = sy-ucomm.
      perform user_ok_tc using    'TABLCTRL'
                                  'OBJECT_TAB1'
                         changing ok_code.
      sy-ucomm = ok_code.
    ENDMODULE.                 " shelf_user_command  INPUT
    *&      Module  user_command_0100  INPUT
          text
    MODULE user_command_0200 INPUT.
    data:v_line(3).
    case OK_CODE.
    when 'LAST'.
    read table object_tab1 with key idx = 'X'.
    if sy-subrc = 0.
    select * from qals
                          where enstehdat <= object_tab1-enstehdat
                          and   plnty ne space
                          and   plnnr ne space
                          and   plnal ne space.
    if sy-dbcnt > 0.
    if qals-enstehdat = object_tab1-enstehdat.
       check qals-entstezeit < object_tab1-entstezeit.
       move-corresponding qals to object_tab2.
       append object_tab2.
       else.
       move-corresponding qals to object_tab2.
       append object_tab2.
       endif.
         endif.
            endselect.
       sort object_tab2 by enstehdat entstezeit descending.
    loop at object_tab2 to 25.
      if not object_tab2-prueflos is initial.
    append object_tab2 to object_tab1.
      endif.
      clear object_tab2.
    endloop.
      endif.
    when 'SAVE'.
    loop at object_tab1 where idx = 'X'.
      if ( not object_tab1-plnty is initial and
                    not object_tab1-plnnr is initial and
                               not object_tab1-plnal is initial ).
       select single * from qals into corresponding fields of wa_qals
       where prueflos = object_tab1-prueflos.
          if sy-subrc = 0.
           wa_qals-plnty = object_tab1-plnty.
           wa_qals-plnnr = object_tab1-plnnr.
           wa_qals-plnal = object_tab1-plnal.
    update qals from wa_qals.
      if sy-subrc <> 0.
    Message E001 with 'plan is not assigned to lot in sap(updation)'.
    else.
    v_line = tablctrl-current_line - ( tablctrl-current_line - 1 ).
    delete object_tab1.
    endif.
       endif.
          endif.
               endloop.
    when 'BACK'.
    leave program.
    when 'NEXT'.
    call screen 300.
    ENDCASE.
    ***INCLUDE Y_RQEEAL10_USER_OK_TCF01 .
    *&      Form  user_ok_tc
          text
         -->P_0078   text
         -->P_0079   text
         <--P_OK_CODE  text
    form user_ok_tc  using    p_tc_name type dynfnam
                              p_table_name
                     changing p_ok_code like sy-ucomm.
       data: l_ok              type sy-ucomm,
             l_offset          type i.
       search p_ok_code for p_tc_name.
       if sy-subrc <> 0.
         exit.
       endif.
       l_offset = strlen( p_tc_name ) + 1.
       l_ok = p_ok_code+l_offset.
       case l_ok.
         when 'P--' or                     "top of list
              'P-'  or                     "previous page
              'P+'  or                     "next page
              'P++'.                       "bottom of list
           perform compute_scrolling_in_tc using p_tc_name
                                                 l_ok.
           clear p_ok_code.
       endcase.
    endform.                    " user_ok_tc
    *&      Form  compute_scrolling_in_tc
          text
         -->P_P_TC_NAME  text
         -->P_L_OK  text
    form compute_scrolling_in_tc using    p_tc_name
                                           p_ok_code.
       data l_tc_new_top_line     type i.
       data l_tc_name             like feld-name.
       data l_tc_lines_name       like feld-name.
       data l_tc_field_name       like feld-name.
       field-symbols <tc>         type cxtab_control.
       field-symbols <lines>      type i.
       assign (p_tc_name) to <tc>.
       concatenate 'G_' p_tc_name '_LINES' into l_tc_lines_name.
       assign (l_tc_lines_name) to <lines>.
       if <tc>-lines = 0.
         l_tc_new_top_line = 1.
       else.
         call function 'SCROLLING_IN_TABLE'
           exporting
             entry_act      = <tc>-top_line
             entry_from     = 1
             entry_to       = <tc>-lines
             last_page_full = 'X'
             loops          = <lines>
             ok_code        = p_ok_code
             overlapping    = 'X'
           importing
             entry_new      = l_tc_new_top_line
           exceptions
             others         = 0.
       endif.
       get cursor field l_tc_field_name
                  area  l_tc_name.
       if syst-subrc = 0.
         if l_tc_name = p_tc_name.
           set cursor field l_tc_field_name line 1.
         endif.
       endif.
       <tc>-top_line = l_tc_new_top_line.
    endform.                              " COMPUTE_SCROLLING_IN_TC
    Thanks

  • Remove duplicate records in the Footer

    Hello all:
    I only want to print the final result(distinct records) in the footer section, therefore, the header and details sections are suppressed. However, I'm showing duplicate records in the footer section. How do I suppress the duplicate records?
    Please help.....Thank you so much in advance
    Here are my formulas : 
    Header
    WhilePrintingRecords;
    StringVar ConCat:=""
    Details
    WhilePrintingRecords;
    StringVar Concat;
    ConCat := Concat + Trim(ToText({MEDICATE.STARTDATE},"MM/dd/yyyy") + chr(7) + {MEDICATE.DESCRIPTION}) + chr(13)
    Footer
    WhilePrintingRecords;
    StringVar ConCat;
    Here's my desired output:
    HUMALOG PEN 100 UNIT/ML SOLN
    LANTUS 100 U/ML SOLN
    METFORMIN HCL 1000 MG TABS
    Below is an example my current output:
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    01/24/2007-METFORMIN HCL 1000 MG TABS
    01/24/2007-METFORMIN HCL 1000 MG TABS
    01/24/2007-METFORMIN HCL 1000 MG TABS
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    01/24/2007-METFORMIN HCL 1000 MG TABS
    01/24/2007-METFORMIN HCL 1000 MG TABS
    01/24/2007-METFORMIN HCL 1000 MG TABS
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-HUMALOG PEN 100 UNIT/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    11/24/2009-LANTUS 100 U/ML SOLN
    01/24/2007-METFORMIN HCL 1000 MG TABS
    01/24/2007-METFORMIN HCL 1000 MG TABS
    01/24/2007-METFORMIN HCL 1000 MG TABS

    Sorry, I forgot to mention I'm already grouping by Patient Name, and that's where I have created a formula called:
    MEDSHEAD - which I've modified and added the concat line.
    WhilePrintingRecords;
    //StringVar ConCat:="";
    StringVar ConCat;
    ConCat := Concat + Trim(ToText({MEDICATE.STARTDATE},"MM/dd/yyyy") + chr(7) + {MEDICATE.DESCRIPTION}) + chr(13);
    In the detail section : I'm displaying the the patient's name, DOB and Gender and the hemoglabin lab result and date of the lab result.
    In the patient's footer section is where I have the formula called: medsfooter (WhilePrintingRecords; StringVar Concat; Concat;)
    The changes that I made, eliminate some of the duplicate records, however, it's no longer initializing the values - what I meant is I am getting the previous patient's medication information:
    See output below:
    Patient One              4/25/1958     F
    6/26/09 12.2
    9/2/2008-Glipizide XL 5 MG TB24
    4/2/2009-Novolog 100 unit/ml soln
    Patient Two          12/11/45       F
    9/2/2008-Glipizide XL 5 MG TB24
    4/2/2009-Novolog 100 unit/ml soln
    11/24/2009-Humalog Pen 100 Unit/ML soln

  • Displaying of records unable to using GROUP BY

    Hi,
    I have a requirement where i need to display the records based upon item types:I have the records like as
    Invoice Number Item Type Amt
    23221 LI 23
    23231 SD 45
    23221 LI 11
    23221 ST 14
    I want to display as:
    Invoice Number Item Type Amt
    23221 LI 34
    23231 SD 45
    23221 ST 14
    Any help will be needful for me

    918308 wrote:
    Hi,
    I have a requirement where i need to display the records based upon item types:I have the records like as
    Invoice Number Item Type Amt
    23221 LI 23
    23231 SD 45
    23221 LI 11
    23221 ST 14
    I want to display as:
    Invoice Number Item Type Amt
    23221 LI 34
    23231 SD 45
    23221 ST 14
    Any help will be needful for meLike Karthik I wonder why you can't use GROUP BY. Using GROUP BY would be easiest. I also do not understand why when you said you can't use GROUP BY every example posted so far as used it.
    Anyway, ...
    Consider the analytic sum() function. Here is an example you can adapt to your needs - the COUNT() I am using is similar to the SUM() you need
    select distinct cd_id, count(cd_id) over (partition by cd_id)
      from m_cd_tracks
    order by 1
    CD_ID   COUNT()
    1     34
    2     32
    3     32
    4     32
    5     30The analytic COUNT() is similar to the GROUP BY COUNT() but it returns every row. DISTINCT eliminates the duplicates. The OVER () clause allows the PARTITION definition which defines the group. You can read all about the analytic functions in the online documentation.

Maybe you are looking for