Display only the last record per material in SAP query

Hi,
I have created a SAP Query using the quickviewer that is a join between 2 tables (MSEG and MKPF) that consist of material document information and date of posting.
The results are fine however I would like only the last record per material to be displayed.
Can anyone tell what do I need to add so for only the last record per material be displayed in the output.
Thanks,
Mark

Hi Mark,
May be if you use Control Level processing .........I think you will be able to get the result you want. Try displaying as Below,
LOOP AT XXXXX.
AT FIRST material.
ENDAT.
AT LAST material.
*...Display what ever you want here. It will display at end of every material.
ENDAT.
ENDLOOP.
Before using sort the table with key material in ascending.
Hope what I had to say is helpful to you.
Cheers,
Raga Suman.

Similar Messages

  • How do I get email to display only the last 50 or 100 emails ?

    How do I get email to display only my last 50 or 100 emails?

    I think I figured it out. I downloaded all the email in my wife's hotmail account(500) to the iphone and then deleted 350 of the emails on the iphone. then I set the iphone to look for the 200 most recent messages. When I did this the iphone updates all the new emails and the old ones that I deleted on the iphone are still in hotmail.
    Mike

  • Updating only the last record.

    Hi,
    I have a scenario where we get more than 1 record based on style. Everytime the new record comes in, I need to update the last record inserted. It requires a procedure to do it, but need some help on how to just update the last record only and not all the previous received records.
    Here is the scenario.
    create table test_1 as
    with data_Set as
    ( select 'ABCD' style, 20080101 date_received, 2 duration,20080301 expire_Date from dual union all
    select 'PQRS' style, 20080201 date_received, 2, 20080401 expire_Date from dual
    ) select * from data_set
    so now on next run when i get another record
    insert into test_1
    select 'ABCD' style, 20080401 date_received, 3 duration,20080701 expire_Date from dual.
    now the procedure should insert the incoming record and also update the expire_date for the previous record to a day before date_received for the new record. I am ok doing it when its only 2 records , but when i get another record of same style, i dont want to update all the previous received records. I only want to update the last record on file.
    can anyone suggest?

    STYLE     DATE_RECEIVED     DURATION     EXPIRE_DATE     SEQ_INSERTED
    110427     7/31/2006     0     7/31/2006     2
    110427     9/1/2007     12     9/1/2008     2
    110427     8/2/2008     24     8/2/2010     3
    468130     3/13/1997     0          2
    468130     3/13/1997     12     3/13/1998     2
    468130     1/12/2008     12     1/12/2009     3
    Here is my data set
    and here is the query i use to update, does it look correct?
    update test b
    set ( expire_Date) =
    (select start_date - 1
    from test a
    where (style_no, date_received) in
    (select style_no, max(date_received)
    from test c
    group by style_no
    and a.style_no = b.style_no
    and style_no in ('468130','110427')

  • Query needs display only the recent record that was updated into BW.

    Hi Gurus,
    I have a question related to query creation.
    I hve one Infoset which was built on top of Opportunities data and Activities data cubes.  Tthey are linked using Opportunity GUID.  And in the query I am displaying the Opportunity ID(from Opportunity cube),  Sales order Number from the Activities data and a keyfigure No of Doc headers from the opportunities cube.  Everything is fine.  I want to display One Opportunity ID and One Activity associated with it.  I mean I want to display only the activity ID which is very recent.  But the query displays all the activity IDs which are associated with the opportunity ID.   We are not using any time characteristics too as the query has to display all the data that is there in the cubeI just want to see the recent activity that has got updated into the cube.  Kindly advice on how to achieve this..
    THanks in Advance
    Mohan Kumar

    Hi mohan,
    try to do some restriction by using  request ID (0requid) and variable 0S_RQMRC (Most current data on 0requid).
    for example a restriction on activiy id by most current request ID.
    hope it helps.

  • How to display only the duplicate records

    Hi friends,
    I have a query that provides me with a set of data,which has some duplicate rows. I require to display only the duplicates.
    This is the result I have:
    card_no cust_no address paymnt_mode
    1234 A123 XYZ CQ
    1234 A234 nmb CC
    9876 B123 mnnjn cc
    5678 A123 XYZ CQ
    5678 A123 XYZ CQ
    7876 Mk89 mku CC
    From the above ,
    I require to display something like this:(Duplicates based on card number alone)
    card_no cust_no address paymnt_mode
    1234 A123 XYZ CQ
    1234 A234 nmb CC
    5678 A123 XYZ CQ
    5678 A123 XYZ CQ
    Please share some ideas,
    Thanks a lot

    with data as
      select 1234 as card_no, 'A123' as cust_no, 'XYZ' as address, 'CQ' as paymnt_mode from dual union all
      select 1234, 'A234', 'nmb', 'CC' from dual union all
      select 9876, 'B123', 'mnnjn', 'cc' from dual union all
      select 5678, 'A123', 'XYZ', 'CQ' from dual union all
      select 5678, 'A123', 'XYZ', 'CQ' from dual union all
      select 7876, 'Mk89', 'mku', 'CC' from dual
    select card_no, cust_no, address, paymnt_mode
    from
        select card_no, cust_no, address, paymnt_mode, count(*) over (partition by card_no) as cardinality
        from data
    where cardinality > 1;
    CARD_NO                CUST_NO ADDRESS PAYMNT_MODE
    1234                   A123    XYZ     CQ         
    1234                   A234    nmb     CC         
    5678                   A123    XYZ     CQ         
    5678                   A123    XYZ     CQ          Change the column list in the partition by clause if you want to check over other columns as well.

  • WAD - display only the last value in the chart

    hi...
    I designed a chart in WAD wich displayed a range of values in a line. Now im searching for a possibility to display the value for the points in my chart, but not for all values, only for the last value in the line! And every month the line will extended with new value-points, so it is necassary that the function is dynamic, always for the last point in the chart the value should displayed!?
    thx for some ideas!
    david

    hi @ all... once more information:
    the chart displayed only one keyfigure of a query. for example it display the revenue per month. in jan. = 10, feb. = 15, mar. = 25, apr. = 13, jun. = 23. these values should be displayed in a line in the chart aaaand additional for the last one in the line the valuecaption direct in the chart (f.e.: jun. = 23). not for all "periods-points"only for the last one.
    in jul. = 25 the chart changed and only for july the value-caption should be displayed. Is it possible?
    Regards,
    David

  • Display only the first record

    I have report in BEx where we want to find the first time a customer ordered Quantity of more than 500 in a data range (For Ex: From April 10 to April 30). In a particluar date range the customer may order more than once (Qty > 500). The catch is we want display only one first time he ordered qty > 500.
    Customer    Date         Qty > 500.
    ABC         4/21/2005        2,035 CA
              4/22/2005        12,290 CA
              4/23/2005        4,826 CA
              4/26/2005        6,397 CA
              4/27/2005        1,538 CA
              4/28/2005        4,849 CA
    XYZ         4/25/2005        2,000 CA
              4/26/2005        12,000 CA
              4/27/2005        4,500 CA
              4/28/2005        6,300 CA
    In the output report we want to display the first record for each customer as:
    Customer    Date         Qty > 500.
    ABC         4/21/2005        2,035 CA
    XYZ         4/25/2005        2,000 CA
    Your help is really appreciated. Thanks.

    jayant,
    i think, you could use your date as a condition to filter by in your report... try looking that the properties of your KF and, under Calculations, set the 'Calculate Result as...' to the first value only.
    hope this helps - don't forget to give out points. =)
    ryan.
    ps. i've tried this, and it sort of works - just need a bit more of tweaking around. =)
    Message was edited by: Ryan Kristoffer Tan

  • Only put the last record retreived into the item form

    Hi All,
    I am trying to show all the retreived records of a query in a multi-line formTEXT item. However, it seems to me that only the last record shows rather than all records. The code is below where DM_AR is a package and OPEN_R_TYPE, Fetch_data are two procedures which uses a cursor variable. The below code runs perfectly in SQLPLus if we replace the :RESULT_TEXT := .., with a DBMS_output.put_line build-in procedure.
    Any suggestion Plz......
    F
    DECLARE
    -- declare a cursor variable
    RES DM_AR.ruleitem_type;
    TEMP_row TEMP_TBL%ROWTYPE;
    BEGIN
    -- open the cursor using a variable
    DM_AR.OPEN_R_TYPE(RES, :MODEL_NAME);
    -- fetch the data and display it
    LOOP
    DM_AR.Fetch_data(RES, TEMP_ROW);
    EXIT WHEN RES%NOTFOUND;
    :RESULT_TEXT := 'RuleNo: ' || TEMP_ROW.RULE_ID || ' Conf: '|| TEMP_ROW.R_CONF || 'Supp: ' || TEMP_ROW.R_SUPP || ' IF: ' || TEMP_ROW.ANTECEDENT || ' THEN: ' || TEMP_ROW.CONSEQUENT;
    END LOOP;
    END;

    You are overwriting your item :RESULT_TEXT everytime in the loop. So, you only see the final result. You probably want this:
    :RESULT_TEXT := :RESULT_TEXT || ' RuleNo: ' || ...
    ...

  • Info Records Per Material Group Standard Report Not Running at All.

    Hi Experts,
    We had a Small problem Where while Running Info Records Per Material Group(T-code ME1W ) Standard Report the Report is not Showing any output in PRD, where else running Info Records Per Material (T-Code ME1M ) Standard Report the Output is getting Displayed.
    Our System is Currently SAP EEC 6.0 & Application Package SAP_APPL is of release 604     & Level 0007, Highest Support Package is SAPKH60407.
    is this Issue covered in Some OSS Note?
    Thanks & Regards
    Priyesh Shah

    Hi,
    The info-records for the materials which appears in the standard report ME1M/ME1L is different from the one which appear in ME1W.
    If you try with the material groups of the ME1L or ME1M info-records it wont be displayed in ME1W.
    ME1W will display only the info-records which are created @ material group level.
    i.e. try to create a new info-record using ME11 without entering material, in the general data screen you have to enter the material group & other parameters.
    Now once you save this info-record,same will appear in ME1W.
    Hope its clear.
    Thanks & Regards,

  • How to get the last record??

    Hi, I now have to get only the last record from one table
    from MS Access.
    I was looking for the useful method from API, however,
    I cannot get it.
    How to get only the last record from one table ???
    Please help, thanks.

    In RDBMS, row order is really not relavent by iteself. Meaning there is no such thing as 'last record' unless it's in the context of a column (e.g. timeStamp).
    Of course, rows are inserted and stored in some natural order, but you cannot assume they'll come back the same way in a 'Select *' as they were entered.
    So, if you mean last row as in last inserted row, I would add a timestamp field that's set at insert, or use a autonumber column. Either way, have a column that will always contain the highest number or newest timestamp, and then you can build your where clause from that.
    For instance, in Access, I have an autonumbered field called 'fred', with other columns. If I want the last record, I simply use the following:
    select * from atable where fred in (SELECT max(fred) AS Max FROM atable);
    the 'where in' clause will filter to only those records in the subsequent select statment, which of course is only one, the max of the column fred.
    bRi

  • How to get the only the last raw of the table

    Hello All,
    While fetching a table into internal table, how to get only the last record of the table.?
    Thanks and Regards, Pradeep

    I hope following code will solve your problem.
    DATA : it_bseg TYPE TABLE OF bseg,
           x_bseg TYPE bseg,
           v_index TYPE i.
    SELECT COUNT(*)
      FROM bseg
      INTO v_index.
    SELECT *
      FROM bseg
      INTO TABLE it_bseg.
    READ TABLE it_bseg INTO x_bseg INDEX V_INDEX.
    First SELECT will give you the number of rows in a table in v_index. Second SELECT will fetch all table data and then READ will give you the last record of the table in a structure x_bseg.
    Reward points if the answer is helpful.

  • Selecting the last record from a database table

    In my ABAP Program, I have to use a select statement to retrieve the last record from the database table with the same key.  In other words, the Program will get more than one hit on the database table for the selected keys and I need to retrieve values from only the last record and not the first.  I know I can use an internal table to sort the records first and then retrieve the right value.   But to make things easier, is there a SELECT statement keyword than I can use to do this in one single step?  Thanks!

    hi,
    tables:mara.
        data: begin of it_mara occurs 0,
                matnr like mara-matnr,
                meins like mara-meins,
                mtart like mara-mtart,
                end of it_mara.
    select-options:s_matnr for mara-matnr.
    select matnr
              meins
              mtart
    from mara
    into table it_mara
    where matnr in s_matnr.
    if not it_mara[] is initial.
    sort it_mara by matnr descending.
    read table it_mara index 1.
    endif.
    then you get the last record of the select statement.
    reward points if useful,
    venkat.

  • Function in select statement need to be called only for the last record.

    Select state,
    local,
    fun_state_loc_other_details(19) details
    from state_local
    where pm_key=19
    resuts:_
    State Local Details
    AP APlocal details1
    UP UPLocal details1
    MP MPLocal details1
    i) The above query returns 100 records
    ii) fun_state_loc_other_details is also getting called 100 times. But I want this function to be called only for the last record that is 100th record.
    is there any way to do that?

    Thanks amatu.
    One more small query. Can I do it on condition based.
    Select state,
    local,
    fun_state_loc_other_details(19) details
    from state_local
    where pm_key=19
    Like if one state it need to be called once.
    AP -- 50 records
    UP - 20 records
    MP -- 10 records.
    fyi: this record no. varies
    I want the function to be called for AP once, UP once, MP once.

  • RFC - XI - JDBC(mapping only the last row of a record)

    Hello all,
    in a mapping response from an oracle base after a RFC call with a select statement, i have the following response :
    <StatementSelect_response>(cardinality 0..1)
    <row1>(cardinality 0..unbounded)
    <field1>1</field1>
    <field2>2</field2>
    </row1>
    <row2>
    <field1>3</field1>
    <field2>4</field2>
    </row2>
    </statement>
    i have to map those fields in a RFC_response like :
    <RFC_response>(0..1)
    <field1>
    <field2>
    </rfc _response>
    Problem : I only need to send back to the rfc_response the last records of my StatementSelect_response in order to have the following message :
    <RFC_response>
    <field1>3
    <field2>4
    </rfc _response>
    How can i select only the last row of my records plz ?
    Thanks by advance

    VJ wrote:>
    > Hi,
    >
    > public void LastRow(String[] a,ResultList result,Container container){
    >
    > int len = a.length();
    > Result.addValue(a\[len-1\]);
    >
    > }
    VJ,
    Please don't confuse him. If you want to update the thread, let me leave it aside.Coz it shouldn't cause him trouble. Can u check a.length() is correct? it has to be a.length, isn't it?
    We all here to help others, not under any motivation of compete..
    Sorry, if I hurt you..
    raj.

  • When I send mi presentation to a Quick Movie, the program record only the last frame

    Why when I send mi presentation to a Quick Movie, the program record only the last frame, how I do to record the whole presentation of 52 frames

    I mean when I try to burn a CD.

Maybe you are looking for