Select Max record for the report

Post Author: ROMZILBER
CA Forum: WebIntelligence Reporting
Hello,
Here is our problem we have history data on a table like
Example
Data:
11111   bbb       12/31/2004
11111   nnn       12/31/2005
11111   ddd       12/31/2007
On a report we only need to display the most current record (based on a date).
11111   ddd       12/31/2007
How can we do that, we have try to create subquery but it does not allowed to enter logic for the max date for the same id.  So we are kind of stuck, I am more then sure this would be a very common conditions specially for data warehousing.
we are on Oracle 10g
Thank you for all your help.

Post Author: ROMZILBER
CA Forum: WebIntelligence Reporting
To create a view is not a problem, supporting it is a different story
But we have find a solution, you were correct about the filter.  I just did not know you can put the whole subselect in a  filter
but here is a logic for the filter if someone would come up with the same problem
tablename.NNNN_PROOF_DT = (SELECT MAX(X.NNNN_PROOF_DT) FROM tablename X  WHERE tablename.NNNN_CLAIM_NUMBER = X.NNNN_CLAIM_NUMBER AND   tablename.NNNN_LINE_CD = X.NNNN_LINE_CD)
please let me know if you have any questions.
sorry I am new to this so please do not take any offense

Similar Messages

  • Selecting Specific Records for a Report

    I have a report that requires 16 unique records to be displayed when the report is run.  The table holds thousands of records but the Daily Report only wants the records that have 16 unique entries for that specific period.  Is it possible to select these records only ?  Cannot be by date because the entries could have been made anytime during the past 24 hours.
    Ron Smith

    Hi Ron,
    Can you filter it with your max(readingfield)
    and, perhaps, a case statement.
    Select Tabel.Meter
          Case "West" : "A''
          Case "East"  : "B"
    or use Wallie's idea of an "in" statement
    Maybe you can use max(readingfield) in a sub select
    of the where clause.
    where table.date = (select max(readingfield) from table)
    or, if each meter has a different max(readingfield) ,  then pull each one
    in separately.
    or, create a view that pulls in the TOP 16 meters and link that
    to the table.  This should work if all else fails.
    I hope this helps,
    The Panda

  • Select one record for the first matching condition only in four where condi

    I need your suggestion to write one tricky SQL query to select only one record from database on the following condition.I explained simple table structure below.I have a table temp with four columns a,b,c,d in it.
    I have to select column d from this temp table based on the following four conditions.If it matches any condition, It should skip other conditions, that's the tricky thing.
    Conditions order is like shown below.
    1) a='argument1' and b='argument2' and c='argument3'(If it matches this condition, it should stop selecting below 3 conditions)
    2) a='argument1' and b='argument2' and c='none'(If it matches this condition, it should stop selecting below 2 conditions)
    3) a='argument1' and b='none' and c='argument3'(If it matches this condition, it should stop selecting below condition)
    4) a='argument1' and b='none' and c='none'(this is last condition)
    If I use OR operator , it matches all of those other conditions too.I never wrote query like this before.
    I greatly appreciate if somebody sheds light on me to start writing this query with a simple suggestion.
    Thanks,
    GD

    This forum might help you out, as they are experienced SQL developers, however, this forum is primarily for queries about the tool, SQL Developer. I recommend you post this on the SQL & PL/SQL forum where they focus on these queries:
    PL/SQL
    Sue

  • Parameter REPORT for the Report Web item in the Web template is empty or mi

    Hello,
    I tried to create a Web-Template (WAD). By executing the report, I get the selection screnn, but by confirming the selection I get the following message:
    Web Item Report Error
    Web template error in specifications for the Web item report
    Parameter REPORT for the Report Web item in the Web template is empty or missing
    Use the BEx Web Application Designer to add parameter REPORT to the report Web item in the Web template, and assign a report name to the parameter
    Contact your system administrator. This error was recorded
    What can I do to solve this error?
    Thanks!
    XmchX

    As DP_1 Type Query_view_Data_provider, I have assinged a Query Designer Query wich works fine, if I execute it as QDR.
    The entry Query_view_Data_provider makes sense for me, but what do I need to maintain for the type "Filter"?
    Thanks!
    XmchX

  • How can I numbered the records in the report

    Hi, can anyone please show me how do I number the records in the reports in the Report Builder?
    Thank you.

    Hi,
    Follow the following steps:
    1. Create a summary column in the data model of the report.
    2. Select the function as Count.
    3. Select the source for which you want to generate the serial no.
    4.Reset the column at Report level.
    5. Now create a field in the paper layout of the report and select this summary column as the source. The field should be in the same repeating frame as its source.
    This will generate the nos. as reqd.
    Swati

  • Authorization for the report

    Hi
    I have made one report,  I needed to check the authorization for the report, how to do it.
    Eg.  One employee is executing the report, he only needed to select his transaction
    If somebody from one sales organisation, they only needed to take the data belongs to the sales office.
    SELECT-OPTIONS: p_vkorg  FOR tvkot-vkorg.
    SELECT-OPTIONS: p_pernr FOR pa0001-pernr
    for example two selection parameter is displaying. if my employee no is 100, while trying to enter execute the report for 200 employee no. no data should show. like that vkorg filed also should work.
    Please let me know how it possible.
    Regards
    Sebastian John

    Hi,
    You can change the code below
    *---Authorization for Company code entered by the users.
    *---This code will restrict users to see data for company
    *---codes which they are not authorized to.
    *---Select all the company codes based upon selection entered by the
    *---user
    SELECT bukrs
       FROM t001
       INTO TABLE li_bukrs
      WHERE bukrs IN z_bukrs.
    IF sy-subrc EQ 0.
    *---Clear Screen variable for Company code
       CLEAR z_bukrs.
       REFRESH z_bukrs.
    *---Filter and prepare Select options for Company code table to be
    *---passed to query. Table will only have values of company codes he is
    *---authorized to for display.
       LOOP AT li_bukrs INTO lwa_bukrs.
         AUTHORITY-CHECK OBJECT 'F_BKPF_BUK'
                           ID 'BUKRS' FIELD lwa_bukrs
                           ID 'ACTVT' FIELD '03'.
         IF sy-subrc = 0.
           z_bukrs-sign = 'I'.
           z_bukrs-option = 'EQ'.
           z_bukrs-low = lwa_bukrs.
           z_bukrs-high = space.
           APPEND z_bukrs.
         ELSE.
           lv_flag = 'X'.
         ENDIF.
       ENDLOOP.
    *---Give warning message to the user in case he is not authorized to see
    *---data for all the company codes that he has entered.
       IF lv_flag = 'X'.
         MESSAGE ID 'ZFNG' TYPE 'W' NUMBER '015'.
       ENDIF.
    ENDIF.
    This code does an authorization check at company code level and removes all the company codes that user has entered but is not authorized to look for. After that we pass the filtered list of company codes for which user is authorized to in the select query and fetch the results. You can first select all the records from database for PERNR and VKORG. Then filter them and prepare new list of VKORG and PERNR after performing authorization check and pass it further to select queries in your program.
    KR Jaideep,

  • SSRS tablix not be visible when no data is selected to display on the report

    In an SSRS 2008 r2 existing dashboard application, I display a tablix (as a header) based upon the following selection criteria:
    =iif(Len(First(Fields!CustomerNumber.Value, "Main")) = 0, true, false).
    The CustomerNumber value is passed between the various SSRS reports in the dashboard application. There are times when the Fields!CustomerNumber.Value is selected for a particular report and there is no detail data to display. What happens with the existing
    reports, is the space that would be allocated for the tablix is shown.
    When there is no data to display, there is a NoRowsmessage that can be displayed on the report.
    Basically when there are no detail records to display on the report, I would like the tablix report header not to display when there is no detail data for the report.
    Thus can you tell me how to code the tablix report header not to display when there is no detail data?

    Sorry, I overlooked Katherine's simple solution, partly because the header doesn't go away, it is just replaced with something that cannot be differentiated from the report background. Keep in mind that the space the tablix is in is still occupied by the
    tablix as you can see below:
    Sample report with no data and an empty rows message of "  ".
    Above is the same report without a no rows message but with the header row hidden using thisformula: =IIf(Count(1)>0, false, true). You can see that the space that the header normally occupies is collapsed away when hiding the header whereas the spaces
    ("  ") occupy that space when using the no rows message.
    "You will find a fortune, though it will not be the one you seek." -
    Blind Seer, O Brother Where Art Thou
    Please Mark posts as answers or helpful so that others may find the fortune they seek.

  • Report S_ALR_87013105 : no authorization for the report/ table 7KU6_001

    Hi Gurus,
    While executing the program S_ALR_87013105 (Detailed Reports 
    For Sales Order : Plan/Actual Comparison ) system showing the selection log.
    "Have no authorization for the report/table  7KU6_001 and 7KU6_002".
    But for the user the authorization check through SU53 was successful.
    Pl can any one suggest on this issue.
    Thanks in advance,
    Vijay

    Hi,
    Contact your basis consultant to provide the missing authorisation. This is one of the authorisation object.
    Regards,
    Sankar

  • Merging two records in a single record for the same matnr,werks and bwart.

    Hi I have a requirement to merge two records into one single record using the quantity field from MSEG table.
    I am selecting two records from the table MSEG. Now for these two records i have to add the quantity values into one variable.
    Then there should be only one record for the same matnr,werks,bwart.
    Any suggestion would be appreciated.
    Regards,
    Amit

    hi,
    You can COLLECT statement only if all non key fields are numeric.
    This statement Adds all such fields and give us a single record.
    Regards
    Sumit Agarwal

  • Display the total number of rows for the report in OBIEE 11g

    Hi, In obiee 11g, the pagination will be 1-25. Is there any possiblity in obiee to show the total rows count next to pagination. Ex: if the result contains 120 rows. it should display after the pagination
    Records 1-25. Total of Records : 120
    Is there any way we can display the total number of rows for the report.
    Kindly help me.. Its very urgent requirement.
    MAny Thank in advacne

    Check this http://obiee100.blogspot.com/2011/07/display-total-number-of-records-in.html
    and
    http://docs.oracle.com/cd/E28280_01/bi.1111/e10544/appsql.htm#CHDCDIDA
    You have to go something like as suggested in previous link.
    Mark as correct/helpful

  • Table for the report RPUAUD00  Logged Changes in Infotype data

    Hi
    I have a query with the program RPUAUD00 Logged changes in Infotype Data.  In which table stores the details of the program RPUAUD00.  for example in the 1st period there is a LWP record for the employee.  If in the 2nd period the LWP entered in 1st period has deleted, in the log the LWP displays for 1st period  new field contents, Action Indicator I.  The deleted information displayes in Old field contents with the Action Indicator D. We want to know in which table the LWP insert and LWP delete (d) details are stored.
    This information required to create a report for ESI.  In the report No of days (payroll processed for) has to mention.  To know the no of days need to access the report RPUAUD00.  From the RPUAUD00 the details of LWP insert and delete can be known.
    Request to help in solving the issue
    Thanks & Regards
    EKP Yadav

    Hello:
    Logged changes in Infotype Data are stored in cluster table PCL4 ID  LA and SA for employee and LB and SB for applicant. Maybe L is for longterm and S for shorterm
    Cheers.
    Antoine

  • How to get the spool id or how to create a spool id for the report .

    hi,
    how to get the spool id or how to create a spool id for the report .
    this spool id i have to use it in CONVERT_ABAPSPOOLJOB_2_PDF fm to get the pdf download file.
    my requirement is to download a pdf file from the alv grid list.

    Hi Raghu,
    Execute this program.
    REPORT  ZTEST_3318                              .
    tables: usr01.
    perform send_report_to_spool.
    *&      Form  send_report_to_spool
          text
    form send_report_to_spool.
      data: loc_dest like pri_params-pdest,
            wf_listname type char12,
            wf_listtext like PRI_PARAMS-PRTXT,
            wf_copies type i,
            wf_days type i,
            wf_PARAMS LIKE PRI_PARAMS,     " achieving file PRI_PARAMS.
            wf_valid type c.
      clear : wf_listname , loc_dest , wf_listtext .
      move: 'AP interface' to   wf_listname .
      move: 'AP interface' to   wf_listtext .
    select single spld into usr01-spld from usr01 where bname eq sy-uname .
      if sy-subrc eq 0 .
        move: usr01-spld to loc_dest .
      endif .
      call function 'GET_PRINT_PARAMETERS'
        EXPORTING
          destination    = loc_dest
          copies         = 1
          list_name      = wf_listname
          list_text      = wf_listtext
          immediately    = ' '
          release        = ' '
          new_list_id    = 'X'
          expiration     = 1
          line_size      = 200
          line_count     = 65
          layout         = 'X_65_200'
          sap_cover_page = 'X'
          receiver       = 'SAP*'
          department     = ''
          no_dialog      = 'X'
        IMPORTING
          out_parameters = wf_params
          valid          = wf_valid.
      if wf_valid <> space.
        new-page print on parameters wf_params no dialog.
        perform write_summary .
        new-page print off.
      endif .
    endform.                    "send_report_to_spool
    *&      Form  write_summary
          text
    -->  p1        text
    <--  p2        text
    FORM write_summary .
    data: begin of itab occurs 0,
          matnr type matnr,
          end of itab.
    select matnr
           from mara
           into table itab
           up to 10 rows.
    loop at itab.
    write: / itab-matnr.
    endloop.
    ENDFORM.                    " write_summary
    This will create spool in SP01.What data you want to put in Spool write it in form write_summary.I have done coding for testing purpose
    After that use that spool for your purpose.
    If Useful award point

  • Using Select List value for building report

    I have an interactive report form. I have a "After Header" (LOAD) process that run sql commands that will populate a table with the data that the report needs for a given week.
    I have a Select List item that is run as a "Before Header" that gets a list of dates from a table. The dates only contain the first day of the week for the past two years. It is called "WEEK_OF" table and the column is called "WEEK_OF_DATE".
    The default value for the Select List is the first day of the current week. And then all of the first day of the week from the WEEK_OF table.
    I would like the LOAD process to use the value in the Select List. So at start up I would like the List to show the current week and report to begin with data from the current week.
    So I have tried to use the variable :WEEK_OF_DATE (Item name) as the beginning date for the report. However :WEEK_OF_DATE is null.
    Also, after I have the report displayed, I would like to select a new date from the list and have the report automatically refresh with that new data.
    Any Ideas what I am doing wrong?

    Hi Lyle,
    When setting a default value for a select list that is to be used to filter a report, I have found it best to do that using a computation, conditional on the item being NULL and running Before Header. If other computations rely on this value, then it should have the lowest sequence number to ensure that the value is available for those.
    Andy

  • Documentaion for the report in the ALV display

    Hi
    I am using the function module 'REUSE_ALV_LIST_DISPLAY
    ' to display the list. I want some options which can display the documentation of the report after ALV displays the list.
    Now i  am using the documentation (se38) for the report which we can see pressing a button 'i' on the selection screen.
    Ramesh

    Hi Ramesh,
    i use it like this:
      CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM       = PROGNAME
    I_CALLBACK_PF_STATUS_SET = 'MAIN'
                I_CALLBACK_USER_COMMAND  = 'USER_COMMAND'
                IS_VARIANT               = VARIANT
                IS_LAYOUT                = LAYOUT
                IT_FIELDCAT              = FIELDCAT
                IT_SORT                  = SORT
                IT_FILTER                = FILTER
                I_SAVE                   = 'A'
                IT_EVENTS                = EVENTS
                IT_EVENT_EXIT            = EVENT_EXIT
                IS_PRINT                 = PRINT
                I_TABNAME_HEADER         = 'HEADER'
                I_TABNAME_ITEM           = 'BESTAND'
                IS_KEYINFO               = KEYINFO
           TABLES
                T_OUTTAB_HEADER          = HEADER
                T_OUTTAB_ITEM            = BESTAND
           EXCEPTIONS
                PROGRAM_ERROR            = 1
                OTHERS                   = 2.
    And this:
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
                            RS_SELFIELD TYPE SLIS_SELFIELD.
    aktueller Satz beider Tabellen lesen, da hierarchisch
      READ TABLE HEADER  INDEX RS_SELFIELD-TABINDEX.
      READ TABLE BESTAND INDEX RS_SELFIELD-TABINDEX.
      IF  R_UCOMM EQ '&IC1'  AND RS_SELFIELD-TABNAME =  'HEADER'.
        IF RS_SELFIELD-FIELDNAME = 'QMNUM'.
          PERFORM IW53    USING HEADER-QMNUM.
        ENDIF.
        IF RS_SELFIELD-FIELDNAME = 'AUFNR' AND HEADER-AUFNR <> SPACE.
          PERFORM CS_AUFTRAG USING HEADER-AUFNR.
        ENDIF.
        IF RS_SELFIELD-FIELDNAME = 'EQUNR'.
          PERFORM PM_HIER USING HEADER-EQUNR.
        ENDIF.
        IF RS_SELFIELD-FIELDNAME = 'MATNR'.
          PERFORM MM03 USING HEADER-MATNR.
        ENDIF.
        IF RS_SELFIELD-FIELDNAME = 'SERIALNR'.
          PERFORM IQ03 USING HEADER-MATNR HEADER-SERIALNR.
        ENDIF.
      ELSEIF R_UCOMM = '&IC1' AND RS_SELFIELD-TABNAME = 'BESTAND'.
        IF RS_SELFIELD-FIELDNAME = 'OTGRP'.
          PERFORM EXCEL_OBJEKT.
        ENDIF.
      ELSEIF R_UCOMM = 'REFR'.
    Ausgabe neu einlesen
        RS_SELFIELD-REFRESH = 'X'.
        PERFORM DATEN_EINLESEN.
    Programmdokumentation.
    ELSEIF R_UCOMM = 'DOKU'.
    CALL FUNCTION 'DSYS_SHOW_FOR_F1HELP'
    EXPORTING
    DOKCLASS = 'RE'
    DOKNAME = PROGNAME
    SHORT_TEXT = 'X'
    EXCEPTIONS
    CLASS_UNKNOWN = 1
    OBJECT_NOT_FOUND = 2
    OTHERS = 3.
    IF SY-SUBRC <> 0.
    MESSAGE I010 WITH 'Keine Dokumentation vorhanden!'.
    ENDIF.
      ELSEIF R_UCOMM = 'GRAPH'.
        PERFORM GRAPHIK.
      ELSE.
        MESSAGE I010 WITH 'Bitte markieren sie eine gültige Tabellenzeile!'.
      ENDIF.
    ENDFORM.
    And it works in the Output-List correct.
    Regards, Dieter

  • Want to display records for the specified month only

    Hi all,
    In my report I am displaying records for the specified month only.
    I am able to display it in range of the dates, but i want to display name of the month at the top of page.
    e.g.
    i am giving range like
    01.04.2008 to 30.04.2008
    then, it shoud display April, 2008.
    Thanks & Regards,
    Sandip Sonar

    Hi,
    Ru using alv grid?
    Use following FM to get month in words.
    and then using TOP-OF-Page event print the month.
    DATA X_MONTH(11).
    CALL FUNCTION 'CONVERSION_EXIT_LDATE_OUTPUT'
         EXPORTING
           INPUT         = SY-DATUM
         IMPORTING
           OUTPUT        = X_MONTH.
    Regards,
    Dhan

Maybe you are looking for

  • Not a question - I give up - the Apple TV is crap

    I've now had the Apple TV since August, and I've had nothing but troubles. You name a problem, and I've had it. Sometimes it resolves itself after a week. Other times, I have to look through the many discussions to find solutions and try them all. My

  • Error - The site does not contain a default keywords termstore

    Getting the "The site does not contain a default keywords termstore" error in mysites (SharePoint 2010). The "This service application is the default storage location for Keywords." box is already checked. Which from my Googling, is normally the fix.

  • Oracle ERP Tools

    Why choose Oracle ERP Tools over other competitors ERP's? What are the benefits of implementing Oracle ERP Tools with a company?

  • Mail composing Error

    Hi all,        I am new to workflow. I am composed the mail content with  struc SOLISTI1.            T_OBJCONT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE, write the message line by line and append in to T_OBJCONT.and describe the space for the t_object

  • Assigning employee to two positions

    Hello, In my organization the HR department has decided to enable employees to be assigned to two positions at the same time (work percentage of 50% for each). However, the SAP-HR solution was bulit on the assumption that an employee is assigned to o