What is ranked list ?

Hi SAP-ABAP Experts .
(a.) What is ranked list ? How it is different from simple list disply or ALV display .
May some body give any small example of ranked list ?
(b.) Difference b/t Report Painter and Sql Query ?
Regards : Rajneesh

hi ,
Ranked lists
You can use the APPEND statement to create ranked lists in standard tables. To do this, create an empty table, and then use the statement:
APPEND <wa> TO <itab> SORTED BY <f>.
The new line is not added to the end of the internal table <itab>. Instead, the table is sorted by field <f> in descending order. The work area <wa> must be compatible with the line type of the internal table. You cannot use the SORTED BY addition with sorted tables.
When you use this technique, the internal table may only contain as many entries as you specified in the INITIAL SIZE parameter of the table declaration. This is an exception to the general rule, where internal tables can be extended dynamically. If you add more lines than specified, the last line is discarded. This is useful for creating ranked lists of limited length (for example "Top Ten"). You can use the APPEND statement to generate ranked lists containing up to 100 entries. When dealing with larger lists, it is advisable to sort tables normally for performance reasons.
Examples
DATA: BEGIN OF WA,
        COL1 TYPE C,
        COL2 TYPE I,
      END OF WA.
DATA ITAB LIKE TABLE OF WA.
DO 3 TIMES.
  APPEND INITIAL LINE TO ITAB.
  WA-COL1 = SY-INDEX. WA-COL2 = SY-INDEX ** 2.
  APPEND WA TO ITAB.
ENDDO.
LOOP AT ITAB INTO WA.
  WRITE: / WA-COL1, WA-COL2.
ENDLOOP.
The output is:
          0
1         1
          0
2         4
          0
3         9
This example creates an internal table ITAB with two columns that is filled in the DO loop. Each time the processing passes through the loop, an initialized line is appended and then the table work area is filled with the loop index and the square root of the loop index and appended.
DATA: BEGIN OF LINE1,
        COL1(3) TYPE C,
        COL2(2) TYPE N,
        COL3    TYPE I,
      END OF LINE1,
      TAB1 LIKE TABLE OF LINE1.
DATA: BEGIN OF LINE2,
        FIELD1(1)  TYPE C,
        FIELD2     LIKE TAB1,
      END OF LINE2,
      TAB2 LIKE TABLE OF LINE2.
LINE1-COL1 = 'abc'. LINE1-COL2 = '12'. LINE1-COL3 = 3.
APPEND LINE1 TO TAB1.
LINE1-COL1 = 'def'. LINE1-COL2 = '34'. LINE1-COL3 = 5.
APPEND LINE1 TO TAB1.
LINE2-FIELD1 = 'A'. LINE2-FIELD2 = TAB1.
APPEND LINE2 TO TAB2.
REFRESH TAB1.
LINE1-COL1 = 'ghi'. LINE1-COL2 = '56'. LINE1-COL3 = 7.
APPEND LINE1 TO TAB1.
LINE1-COL1 = 'jkl'. LINE1-COL2 = '78'. LINE1-COL3 = 9.
APPEND LINE1 TO TAB1.
LINE2-FIELD1 = 'B'. LINE2-FIELD2 = TAB1.
APPEND LINE2 TO TAB2.
LOOP AT TAB2 INTO LINE2.
  WRITE: / LINE2-FIELD1.
  LOOP AT LINE2-FIELD2 INTO LINE1.
    WRITE: / LINE1-COL1, LINE1-COL2, LINE1-COL3.
  ENDLOOP.
ENDLOOP.
The output is:
A
abc 12          3
def 34          5
B
ghi 56          7
jkl 78          9
The example creates two internal tables TAB1 and TAB2. TAB2 has a deep structure because the second component of LINE2 has the data type of internal table TAB1. LINE1 is filled and appended to TAB1. Then, LINE2 is filled and appended to TAB2. After clearing TAB1 with the REFRESH statement, the same procedure is repeated.
DATA: BEGIN OF LINE,
        COL1 TYPE C,
        COL2 TYPE I,
      END OF LINE.
DATA: ITAB LIKE TABLE OF LINE,
      JTAB LIKE ITAB.
DO 3 TIMES.
  LINE-COL1 = SY-INDEX. LINE-COL2 = SY-INDEX ** 2.
  APPEND LINE TO ITAB.
  LINE-COL1 = SY-INDEX. LINE-COL2 = SY-INDEX ** 3.
  APPEND LINE TO JTAB.
ENDDO.
APPEND LINES OF JTAB FROM 2 TO 3 TO ITAB.
LOOP AT ITAB INTO LINE.
  WRITE: / LINE-COL1, LINE-COL2.
ENDLOOP.
The output is:
1         1
2         4
3         9
2         8
3        27
This example creates two internal tables of the same type, ITAB and JTAB. In the DO loop, ITAB is filled with a list of square numbers, and JTAB with a list of cube numbers. Then, the last two lines of JTAB are appended to ITAB.
DATA: BEGIN OF LINE,
        COL1 TYPE I,
        COL2 TYPE I,
        COL3 TYPE I,
       END OF LINE.
DATA ITAB LIKE TABLE OF LINE INITIAL SIZE 2.
LINE-COL1 = 1. LINE-COL2 = 2. LINE-COL3 = 3.
APPEND LINE TO ITAB SORTED BY COL2.
LINE-COL1 = 4. LINE-COL2 = 5. LINE-COL3 = 6.
APPEND LINE TO ITAB SORTED BY COL2.
LINE-COL1 = 7. LINE-COL2 = 8. LINE-COL3 = 9.
APPEND LINE TO ITAB SORTED BY COL2.
LOOP AT ITAB INTO LINE.
  WRITE: / LINE-COL2.
ENDLOOP.
The output is:
         8
         5
The program inserts three lines into the internal table ITAB using the APPEND statement and the SORTED BY addition. The line with the smallest value for the field COL2 is deleted from the table, since the number of lines that can be appended is fixed through the INITIAL SIZE 2 addition in the DATA statement.
SQL query is used for the fetching data from different tables,while report painter is used to display the data in some format.
Regards,
Veeresh

Similar Messages

  • About Ranking List, who can help me?

    Dear Guru;
        when i use ME65 - Ranking lists in IDES,  and i choose purchasing organization <1000> vendor between 1000 ad 2000,
    after execute , it show error message as below.. and who can help me solve it?
    Runtime errors         ASSIGN_OFFSET_NOTALLOWED
           Occurred on     2009/12/12 at 23:36:19
    Invalid field assignment in the ASSIGN statement in the program "RM06LBEU ".
    What happened?
    Error in ABAP application program.
    The current ABAP program "RM06LBEU " had to be terminated because one of the
    statements could not be executed.
    This is probably due to an error in the ABAP program.
    What can you do?
    Print out the error message (using the "Print" function)
    and make a note of the actions and input that caused the
    error.
    To resolve the problem, contact your SAP system administrator.
    You can use transaction ST22 (ABAP Dump Analysis) to view and administer
    termination messages, especially those beyond their normal deletion
    date.
    Error analysis

    Hi,
    I am not sure which version of IDES you are using.
    Try getting the latest version wherein this problem might have been fixed.
    Hope this helps.

  • Data read from Memory use - ranked list

    Dear Experts,
    I am trying to read data from memory use -ranked list.
    In general we use function pool to read the data but in case if we should read the data from a class can we do it.
    {O:267}-IF_PT_HRS_D_IF~IM_CONTRACT_TES[1]-TES
    in the above class in TES table we have data , we have to read data from TES .
    In memory use ranked list it is like below
    {O:451*\CLASS=CL_PT_HRS_IF}
    Object
    Regards,
    Kartheek.

    Philip
    This one is really tricky. Display value just shows the rank but it would hold the actual value when you try to do calculations.
    We have had similar problem but it was not related to ranking.
    One Simple approach could be
    Make them use Wrokbooks and do this calculation by using a SUM formula in Excel. Excel will consider whta is being displayed as a value for that cell
    One far complicated solution is you can use the Olympic ranks and Do your sum in a Macro.
    What I mean is if you get the last rank to be 10 then you can write your program to do the sum as
    1098765432+1.
    This approach could be taken only if they are OK with Olympic ranking.
    Edited by: Abhijit N on Dec 10, 2008 10:19 PM

  • What happened to "list" feature in calendar on iPhone 5 when I got upgrade to ios7

    What happened to 'list' feature on iPhone 5 calendar when I downloaded IOS7

    They changed it slightly. To access the closest you will get to the list view from the older iOS is to go to the magnifying glass in the upper right portion of the calendar screen. You cannot add appointments from this view however.

  • What is the list of file prefixes that make a file appear first in the finder?

    Hi!
    I was just curious :
    What is the list of file prefixes that make a file appear first in the finder?
    For example, files and folders whose names start with "A" will appear before files whose names start with "B",
    but what about a list of characters for files and folders before the letter "A"?
    I'm doing some file organisation, and I need certain things to appear at the top of the list.
    I have noticed that the character-prefixes "0" and "(" seem to make things appear before "A"
    I would like a complete list if there is one available.
    Thank you!

    Pretty much any number or a space character. Punctuation does too, in theory, but I'd advise to limit it to hyphens and underscores. Periods are OK in the middle of file names but you won't be able to start a file name with one at the Finder level since that would actually hide the file.
    Matt

  • What is invoice list

    hi gurus
    what invoice list does.  Where do we use this invoice list how to configure means where do we set customizing settings.   How it will be use ful in a business.
    Thanks & Regards
    Poitns will be rewarded

    hi,
    What is Invoice List
    The invoice list lets you create, at specified time intervals or on specific dates, a list of billing documents (invoices, credit and debit memos) to send to a particular payer.
    The billing documents in the invoice list can be single or collective documents (collective invoices combine items from more than one delivery).
    The standard version of the SAP R/3 System includes two types of invoice lists:
    for invoices and debit memos
    for credit memos
    If you wish, you can process invoices, debit memos, and credit memos at the same time. The system automatically creates a separate invoice list for credit memos.
    A payer may be the head office of a buying group, which pays all the invoices for goods that are shipped to individual members. The group payer takes responsibility for paying the invoice lists and then collecting payment from the individual members. In return for these services, the group payer usually earns a factoring or del credere discount.
    Depending on the tax structure of the payer's country, the payer may be liable to pay taxes on factoring discounts that he earns. In Germany, for example, factoring discounts are taxed at the standard rate of 15%. During invoice list processing, you can reimburse the payer in advance for this tax liability by creating special condition records.
    please follow the link to get drill down idead regarding the same
    *Confi of invoice list *
    http://help.sap.com/saphelp_47x200/helpdata/en/4a/ac853478616434e10000009b38f83b/frameset.htm
    http://help.sap.com/saphelp_47x200/helpdata/en/4a/ac853478616434e10000009b38f83b/frameset.htm
    hope this helps u
    regards,
    Arun prasad

  • What is Picking list, packing list, invoice list?

    Hi,
                   iam totally confused with list concepts. what is picking list? then what is packing list? what is invoice list?

    Hi,
    For general information about these terms, it is better you search the internet.
    In simple terms:
    1. Picking List - List of materials that need to be picked and is given to the person given the picking
    2. Packing List - List stating which materials are packed in which box, and is given to the Customer
    3. Invoice List - A list of invoices that is given to a third-party for payment collection from customers.
    Regards
    Nikhil

  • What is commission list?

    Hi all,
    What is commission list in sd, It should trigger after the execution of the pick list VL70 or VL03N, what r d mandatory field need,
    plz explain the fuctionality of pick list and the relation with commissionlist
    reward asure
    with regards,
    Thambe
    Edited by: Thambe  Durai on Jan 29, 2008 10:24 AM

    Hi all,
    What is commission list in sd, It should trigger after the execution of the pick list VL70 or VL03N, what r d mandatory field need,
    plz explain the fuctionality of pick list and the relation with commissionlist
    reward asure
    with regards,
    Thambe
    Edited by: Thambe  Durai on Jan 29, 2008 10:24 AM

  • Ranked list based on result

    Dearall
    i am working on bi7.0  how to calculate the ranks based on the resulting values.
    i wont report like this.help me in resolving this issue.Let me know know if more info is needed.
    thanjs
    vndor  profit  sales plandata rankbased onsales
    v1     p01     1000    700
    v1     p02     5000    500
    v1     p03     400     6000
               6400     7200          2
    v2     p04     2000    800
    v2     p05     5000    500
              7000     1300          1
    v3     p06    400     6000
               400     6000             3
    thanks

    Hi rama,
    your requirement is bit dicey to achieve, as if you check the Keyfigure propertise for Calculation of Single Row as: we have the option of rank List available, but for calulate result row as:, we dont have the same option available.
    You can give this solution a try:
    1) create a formula keyfigure, as SUMCT(Sales or keyfigure for your formula calculation).
    2) Then in Keyfigure properties, calculate single value as Rank List.
    PS: with this approach you will get the rank value at the row level of sumct. partially solving your problem
    Hope this helps...
    Regards,
    umesh

  • AdHoc - default setting for reference Currency ranked lists

    Hi
    Our main currency is NOK.  When creating AdHoc reports with statistics or ranked lists, the currency is USD.  This can be changed by chaning settings for "stats/ranked lists" in adhoc. 
    I assume USD is the default somehow.
    Can the default be changed?
    If not, is there a user parameter that can be set to change this?
    BR
    Kirsten

    Checked with SAP - and USD is the default in system.  Can only be changed by user settings, so I am closing this issue.

  • What are the list of Features available in OM.

    Hi All,
    What are the list of Features available in OM.
    Regards
    Rajesh

    Is this what you are looking for?
    http://help.sap.com/saphelp_45b/helpdata/EN/05/a0fb3d576011d189240000e8323d3a/frameset.htm

  • Ranked Listing in BeX

    Hello All ,
    I have a specific requirement where I have to give a ranked listing based on the percentages . This is pretty straight forward .
    To add to the complexity the ranked list should only display top n contributors contributing X percentage of the total .
    To further detail the scenario
    User wants a report for top contributors accounting for X % of the total business . where X is a variable to be entered by the user
    Top n doesn't suite as n is unknown .
    Please send pointers
    Regards
    Nikhil

    Hi Nikhil,
    You can achieve this by creating a condition in the query designer.
    Choose the create condition icon in the query designer (shiftctrlc)
    Select new condition
    Give a description for the condition and check the active checkbox
    Choose the characteristic or characteristic combination for which this condition is to be applied.In your case it will be the characteristic 'Contributor'.
    In the panel below click New.
    Choose the keyfigure which is business in your case.
    Select the operator Top% from the dropdown
    Select the Variables entry checkbox which enables to create a variable using the wizard.Have User entry/default value as the processing type.
    Click Transfer. Save and execute the query.
    Thus, you have the query which displays contributors contributing to top X% of the business where X is given by the user during query run time.
    Regards,
    Balaji

  • What r the list of selection screen events

    What r the list of selection screen events

    hi,
    chk out the following links...
    http://help.sap.com/saphelp_nw04/helpdata/en/56/1eb6c705ad11d2952f0000e8353423/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/9f/db9a2e35c111d1829f0000e829fbfe/content.htm
    http://www.sap-img.com/abap/different-types-of-selection-screens.htm
    Regards,
    Viji

  • Ranked List for sort ?

    Hi,
    Under one of my Product Group ; i have 5 Key Figures. I need to Sort based on one of these Key Figures.
    When i use a condition and apply the Top N Function to it; i get repeated values of the product name in all 5 rows which do not get suppressed using the query properties.
    This gets taken care of if i select single caharcterisitcs option in the condition. But using this option; the Sort applies only for the first few rows under that particular column.
    Could you tell me if ranked list can be used to conduct a sort in this case . If yes - how do i use it ?
    Regards
    Shweta

    Hi Tony,
    When i apply Top % to my condition ; it does sort in Descending order ; However; If i were to change your example,
    Rows : Material Group
    Column :Quantity
                 Stock
    The output that i get when the sort is working is as foloows:
    Material Group           Quantity
    Material Group           Stock
    and the Output that i want would be :
    Material Group           Quantity
                                     Stock.
    The query Property of Suppress repeated values does not apply either.
    Please tell me how can i take care of this.
    Regards
    Shweta

  • Problem in Requirement profile ranked list updation  in cj20n(PS)

    Hi
    I have created requirement profile in HR and qualifications for emoployees.Suitability ranges are also assigned But during work force planning in Cj20 n,It is not displaying Ranked list of employees on the basis of Requirement profile assigned.
    Thanks

    Hi,
       You can find the ranking list in the Person Assignment tab of network activity.
    Is the Rank List icon itself missing?
    Rdgs
    Sudhir Reddy

Maybe you are looking for