Using rank - urgent

Consider oracle standard emp table, I wrote the below query
select rownum,a.* from (
select empno, deptno, sal, rank() over (partition by deptno order by sal desc nulls last) rank,
dense_rank() over (partition by deptno order by sal desc nulls last) dept_rank
from emp) a
the output is:
ROWNUM EMPNO DEPTNO SAL RANK DEPT_RANK
1 7839 10 5000 1 1
2 7782 10 2950 2 2
3 7934 10 1300 3 3
4 7788 20 3000 1 1
5 7902 20 3000 1 1
6 7566 20 2975 3 2
7 7876 20 1100 4 3
8 7369 20 800 5 4
9 7698 30 2850 1 1
10 7499 30 1600 2 2
11 7844 30 1500 3 3
12 7654 30 1250 4 4
13 7521 30 1250 4 4
14 7900 30 950 6 5
I want to display 1,2 as rank if salaries are same

Hallo ,
in this case you need analytical function row_number():
select rownum,a.* from (
select empno, deptno, sal, rank() over (partition by deptno order by sal desc nulls last) rank,
dense_rank() over (partition by deptno order by sal desc nulls last) dept_rank,
row_number() over (partition by deptno order by sal desc nulls last) row_num_rank
from emp) aRegards
Dmytro
In this example Row_number() shows 1 and 2
for equal salaries randomily, because there is no other sort criteria in order by , other as salary.
You might change your order by - clause,
for example order by sal, empno. Then the rows with equal salary are numerated ascendant by empno
Message was edited by:
Dmytro Dekhtyaryuk

Similar Messages

  • How to use "Rank" function  in Oracle?

    I need to display Top 15 records by using rank function.
    Here is my query...I need to pull top 15 FAQ's using the below query.. How can I use RANK function to display the Top 15 FAQ"s in the list.
    Select  distinct SUb1.FAQ,Sub1.FAQ_Hits,GU.display_Name_FMLS as displayname,ev.ParentLinkrecordid,ev.userid from User GU
    Join Event ev
    ON LOWER (ev.userid) IN (LOWER (GU.lanid), LOWER (Gu.racfid))
    Join (Select distinct sm.stem as FAQ,Sum(ev.Eventresults) as FAQ_Hits,ev.ParentLinkrecordid as Topic_ID from Event ev
    Join SubjectMatter sm
    ON (TO_CHAR (sm.smrecordid) = ev.eventdetail1) AND ev.eventdetail1 IS NOT NULL AND sm.smtype = 1
    Where (Upper(ev.eventsubtype) in (Upper('FAQ'),Upper('OPENFAQ')))
    AND TO_DATE (eventdatetime, 'yyyy-mm-dd hh24:mi:ss') >= TO_DATE ('20100601', 'yyyymmdd')
    and TO_DATE (eventdatetime, 'yyyy-mm-dd hh24:mi:ss') <= TO_DATE ('20100831', 'yyyymmdd')
    Group by sm.stem,ev.Parentlinkrecordid
    order by FAQ )sub1
    ON Sub1.Topic_ID = ev.ParentLinkrecordid)

    A few bits that I noticed in the query ...
    in (Upper('FAQ'),Upper('OPENFAQ'))1) Do you really a upper for a string which is already in upper case.
    Select distinct sm.stem as FAQ,Sum(ev.Eventresults) as FAQ_Hits,ev.ParentLinkrecordid as Topic_ID2) Do you need a distinct when you are using a GROUP function viz. SUM ?
    You rank query is as follows, I am not very good at the ANSI style JOIN so changed it slightly ... :-)
    Also notice the usage rank function in the "sub1" query.
    select distinct sub1.faq,
                    sub1.faq_hits,
                    gu.display_name_fmls as displayname,
                    ev.parentlinkrecordid,
                    ev.userid
    from user gu, event ev,
      (select rank() over (order by sum(ev.eventresults) desc) rnk,
              sum(ev.eventresults) as faq_hits,
              sm.stem as faq,         
              ev.parentlinkrecordid as topic_id
         from event ev, subjectmatter sm
        where (to_char(sm.smrecordid) = ev.eventdetail1)
          and ev.eventdetail1 is not null
          and sm.smtype = 1
          AND upper(ev.eventsubtype) in ('FAQ', 'OPENFAQ')
          and to_date(eventdatetime, 'yyyy-mm-dd hh24:mi:ss') >= to_date('20100601', 'yyyymmdd')
          and to_date(eventdatetime, 'yyyy-mm-dd hh24:mi:ss') <= to_date('20100831', 'yyyymmdd')
        group by sm.stem, ev.parentlinkrecordid
        order by faq) sub1
    where lower(ev.userid) in (lower(gu.lanid), lower(gu.racfid))
      and sub1.topic_id = ev.parentlinkrecordid)
      and sub1.rnk <= 15;Like mentioned above, some sample data would have helped.

  • How to use to use rank over() function in block coding

    Hi,
    I am having problem with using rank () over function in block coding. I can't use it in declaration section with select statement.
    How to use in executable section of pl sql ?
    --Sujan                                                                                                                                                                                                                                                                                                                                                                                                           

    thanks

  • How to use rank() over(...) in a map?

    I use rank() over(...) in a Filter operator
    validate give a error: ora-30483

    Currently OWB does not directly support analytical functions. The (not very elegant) workaround could be implementing these feature in custom transformations.
    Regards:
    Igor

  • Sql tuning using rank function

    Hi,
    Can someone help me in writing the below qry using rank() function?
    DELETE FROM stc_calllog_ext a
    WHERE a.stc_save_status = 'CT'
    AND ROWID IN (SELECT a.ROWID
    FROM stc_calllog_ext a, calllog_ext b
    WHERE a.prod_line_code= b.prod_line_code
    AND a.brand_code = b.brand_code
    AND a.model_number = b.model_number
    AND a.stc_save_status != b.stc_save_status
    AND trunc(a.stc_start_time) = trunc(b.stc_start_time)
    AND a.stc_start_time BETWEEN TRUNC(SYSDATE-8) AND TRUNC(SYSDATE)
    AND a.call_taker_userid = b.call_taker_userid
    AND a.cons_telephone_no =b.cons_telephone_no
    )

    With the information you have provided, I've come up with the following.
    SELECT A.ACCOUNT_NO, A.PAYMENT_TYPE, A.INSTALLMENT_TYPE, A.DATE_CHANGE
    FROM
        (SELECT account_no, payment_type, installment_type, date_change,
                LEAD( (payment_type), 1)
                     over (partition by account_no order by account_no, DATE_CHANGE)  LEAD_PAY,
                LEAD( (installment_type), 1)
                     over (partition by account_no order by account_no, DATE_CHANGE)  LEAD_INST
          from T_ACCNTS ) A
    WHERE A.PAYMENT_TYPE <> NVL(A.LEAD_PAY,99)
       OR A.INSTALLMENT_TYPE <> NVL(A.LEAD_INST,99)
    ORDER BY 1, 4;

  • Error using Rank function in Answers

    Hi All,
    Am trying to generate a report in Answers which lists Top Accounts with Revenue.
    I Ranked the Revenue field and it is returning me correct values. ( Rank(account.revenue) )
    But, when I try to filter on this field and restrict the rows which shows only top 10 Accounts, it is returning the following error:
    State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 17001] Oracle Error code: 1792, message: ORA-01792: maximum number of columns in a table or view is 1000 at OCI call OCIStmtExecute. [nQSError: 17010] SQL statement preparation failed. (HY000)
    Can any one help me on this.
    Thanks in Advance,
    Imtiaz.

    Hi Joe,
    This is the Physical query generated when I use Rank function and the report is fine.
    select distinct D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8,
    D1.c9 as c9,
    D1.c10 as c10,
    D1.c11 as c11,
    D1.c12 as c12,
    D1.c13 as c13,
    D1.c14 as c14,
    D1.c15 as c15
    from
    (select D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8,
    D1.c9 as c9,
    D1.c10 as c10,
    D1.c11 as c11,
    D1.c12 as c12,
    D1.c13 as c13,
    D1.c14 as c14,
    D1.c15 as c15
    from
    (select Case when D1.c1 is not null then Rank() OVER ( ORDER BY D1.c1 DESC NULLS LAST ) end as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c1 as c4,
    D1.c4 as c5,
    D1.c5 as c6,
    D1.c6 as c7,
    D1.c7 as c8,
    D1.c8 as c9,
    D1.c9 as c10,
    D1.c10 as c11,
    D1.c11 as c12,
    D1.c12 as c13,
    D1.c13 as c14,
    D1.c14 as c15,
    ROW_NUMBER() OVER (PARTITION BY D1.c1, D1.c2, D1.c3, D1.c4, D1.c5, D1.c6, D1.c7, D1.c8, D1.c9, D1.c10, D1.c11, D1.c12, D1.c13, D1.c14 ORDER BY D1.c1 ASC, D1.c2 ASC, D1.c3 ASC, D1.c4 ASC, D1.c5 ASC, D1.c6 ASC, D1.c7 ASC, D1.c8 ASC, D1.c9 ASC, D1.c10 ASC, D1.c11 ASC, D1.c12 ASC, D1.c13 ASC, D1.c14 ASC) as c16
    from
    (select distinct T690.SUM_REVN_AMT as c1,
    T690.NAME as c2,
    T2216.NAME as c3,
    T690.X_PETROFAC_REVN as c4,
    T690.SUM_WIN_PROB as c5,
    T690.X_PERCENT_GET as c6,
    T690.SUM_WIN_PROB * T690.X_PERCENT_GET / nullif( 100, 0) as c7,
    T690.X_EC_PRIORITY as c8,
    T19028.LOGIN as c9,
    T690.X_COUNTRY as c10,
    T690.X_REGION as c11,
    T18311.NAME as c12,
    T18641.NAME as c13,
    T18238.NAME as c14
    from
    SIEBEL.S_BU T18238 left outer join (
    SIEBEL.S_USER T19028 left outer join (
    SIEBEL.S_OPTY T690 left outer join SIEBEL.S_STG T2216 On T690.CURR_STG_ID = T2216.ROW_ID) left outer join SIEBEL.S_ORG_EXT T1189 On T690.PR_DEPT_OU_ID = T1189.ROW_ID) left outer join SIEBEL.S_ORG_EXT T18311 /* Competitor */ On T690.PR_CMPT_OU_ID = T18311.ROW_ID) left outer join SIEBEL.S_ORG_EXT T18641 /* Partner */ On T690.PR_PRTNR_ID = T18641.ROW_ID) left outer join SIEBEL.S_POSTN T19114 On T690.PR_POSTN_ID = T19114.PAR_ROW_ID) left outer join SIEBEL.S_OPTY_BU T18280 On T690.ROW_ID = T18280.OPTY_ID) left outer join SIEBEL.S_OPTY_X T19415 On T690.ROW_ID = T19415.PAR_ROW_ID) On T19028.PAR_ROW_ID = T19114.PR_EMP_ID) On T18238.ROW_ID = T18280.BU_ID
    ) D1
    ) D1
    where ( D1.c16 = 1 )
    ) D1
    order by c1 desc
    But When I apply Filter on this Rank column then it gives me the error. THis is the Physical query for that
    select distinct Case when D1.c1 is not null then Rank() OVER ( ORDER BY D1.c1 DESC NULLS LAST ) end as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c1 as c4,
    D1.c4 as c5,
    D1.c5 as c6,
    D1.c6 as c7,
    D1.c7 as c8,
    D1.c8 as c9,
    D1.c9 as c10,
    D1.c10 as c11,
    D1.c11 as c12,
    D1.c12 as c13,
    D1.c13 as c14,
    D1.c14 as c15
    from
    (select D1.c1 as c1,
    D1.c2 as c2,
    D1.c3 as c3,
    D1.c4 as c4,
    D1.c5 as c5,
    D1.c6 as c6,
    D1.c7 as c7,
    D1.c8 as c8,
    D1.c9 as c9,
    D1.c10 as c10,
    D1.c11 as c11,
    D1.c12 as c12,
    D1.c13 as c13,
    D1.c14 as c14
    from
    (select T690.SUM_REVN_AMT as c1,
    T690.NAME as c2,
    T2216.NAME as c3,
    T690.X_PETROFAC_REVN as c4,
    T690.SUM_WIN_PROB as c5,
    T690.X_PERCENT_GET as c6,
    T690.SUM_WIN_PROB * T690.X_PERCENT_GET / nullif( 100, 0) as c7,
    T690.X_EC_PRIORITY as c8,
    T19028.LOGIN as c9,
    T690.X_COUNTRY as c10,
    T690.X_REGION as c11,
    T18311.NAME as c12,
    T18641.NAME as c13,
    T18238.NAME as c14,
    Case when T690.SUM_REVN_AMT is not null then Rank() OVER ( ORDER BY T690.SUM_REVN_AMT DESC NULLS LAST ) end as c15
    from
    SIEBEL.S_BU T18238 left outer join (
    SIEBEL.S_USER T19028 left outer join (
    SIEBEL.S_OPTY T690 left outer join SIEBEL.S_STG T2216 On T690.CURR_STG_ID = T2216.ROW_ID) left outer join SIEBEL.S_ORG_EXT T1189 On T690.PR_DEPT_OU_ID = T1189.ROW_ID) left outer join SIEBEL.S_ORG_EXT T18311 /* Competitor */ On T690.PR_CMPT_OU_ID = T18311.ROW_ID) left outer join SIEBEL.S_ORG_EXT T18641 /* Partner */ On T690.PR_PRTNR_ID = T18641.ROW_ID) left outer join SIEBEL.S_POSTN T19114 On T690.PR_POSTN_ID = T19114.PAR_ROW_ID) left outer join SIEBEL.S_OPTY_BU T18280 On T690.ROW_ID = T18280.OPTY_ID) left outer join SIEBEL.S_OPTY_X T19415 On T690.ROW_ID = T19415.PAR_ROW_ID) On T19028.PAR_ROW_ID = T19114.PR_EMP_ID) On T18238.ROW_ID = T18280.BU_ID
    ) D1
    where ( D1.c15 <= 10 )
    ) D1
    order by c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, c14, c15
    Thanks,
    Imtiaz

  • 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

  • USING RANK

    I created a simple sql query using rank function as shown below.  My question is how do I check the values in the total_income to see if they are different?
    Query:
    select * from
     select cardholderid, appcnum,total_income,  Rank() over (PARTITION BY A.APPCNUM
    ORDER BY A.EFFENDDATE DESC, A.EFFSTARTDATE DESC, A.CREATEDATE DESC) as Rank
     from
    TBL_EPIC_BILLSTATUS A
     ) tmp
     where Rank in (2,3)
    Results:
    CARDHOLDER
    APPCNUM
        TOTAL_INCOME
      RANK
    704355
    2121362
    21912
    2
    704355
    2121362
    20938
    3

    what do you mean by check values in total income?? you have column total column there right??
    if i understand it right, you do another rank for total income..
    Rank() over (partition by APPCnum order by total_income desc) as [total income rank]
    Hope it Helps!!
    That wouldn't quite help as even if they were the same value, rank would still give 1 and 2. Dense_rank would give them both 1 if they were the same but wouldn't help identify if they were the same from a dynamic view. You could either do a lead to read the
    total_income of the next if that is appropriate or you'd have to pivot them to one row and then compare

  • Using Ranking on MS SQL Server 2005

    Hello,
    We are on BOXI3.1 base version and have a universe on top of MS SQL Server 2005.
    My question is regarding use of rank functions. BO guides state that
    You can perform a database ranking only if your database supports
    it. If this is not the case, the Add a database ranking button is disabled on
    the Query Panel toolbar. Databases that support ranking are Oracle, DB2,
    Terradata and Redbrick.
    So SQL Server is not in the list. However the add database ranking button is enabled on
    my report panel. If i add a ranking the query runs for a long time and times-out.
    Is there any universe parameter i need to enable to use ranking? Has any-one mangaged to
    use ranking functionality with SQL Server 2005.
    Thanks in advance.

    Hi Bashir Awan,
    When we create this Object (using your example) at Universe level is the ranking hardcoded ?
    My questions is, say i have Product object (with values A, B, C, D, E), and sales aggregated (10, 20, 30, 40, 50, 60, 70, 80, 90, 100)
    Say the table is as follows
    Product;        sales
        A;               10
        A;                70*
        B;                 50
        B;                 20*
        C;                 30
        C;                 60*
        D;                 40
        D;                 90
        E;                 80
        E;                100
    Note: * represents Oversees sales outside US
    Case 1: Now when we rank whole data to select top 3 we should get (E, D, C in Desc order)
    Case 2: Now if I apply prompt on Country of sales as US will I get (E, B, D) or is it still (E, D, C as earlier).
    Case 3: Similarly if I apply prompt on Product (no prompt on Country) in the filter pane and select (A, D, E) will my results show (E, D, A) or (E, D) as the value of A may be restricted due to ranking formula based on sales at Universe level.
    I am sorry I may be asking a very basic question. Thanks
    Sudhir.

  • How to display total values of revenue after applying top 5 using rank?

    Dear Team,
    I have a requirement to display sum of all revenues after applying top 5 using rank in Webi.
    for Eg:
    revenue  product
    100      aa
    200      bb
    300      cc
    400      dd
    500      ee
    600      ff
    700      gg
    If i apply top  5 using rank i will be getting in my output:700, 600,500,400, 300.
    But simultaneously i want to get sum of all revenue values (i.e) 2800.
    How to achieve this? ur suggestion is much appreciated.
    Regards,
    Bansi

    Hi Bansi,
    You can use =nofilter([Revenue])
    or sum([Revenue] in report)

  • Using ranking and sum to get top 5 products' share of total market

    Hi everybody,
    I have been playing around with ranking for a while now and I am stuck..
    I have a crosstab where I want to show the top 5 products in a specific month. So I have month in my column and products in my rows. I applied a ranking based on revenue only showing the top 5 products. This works like a charm.
    Now I would like to sum up the top 5 products' revenue and compare it with the revenue of all products in the market. I have managed to sum the top 5 products' revenue by using the "sum" function in the block, but I have not been able to compare this measure with a total market revenue measure. It seems like because I made the ranking on the top 5 products I cannot create a measure which includes more than these top 5 products and put it in that block.
    Is this not something Webi can easily handle??
    Thanks in advance!
    Best regards,
    Morten

    Hi Jaime,
    Thank for the suggestion. I forgot to mention that the month column is only showing one month. There is a filter on the month dimension, so that only one month is shown.
    I tried using the In Report context, but it gave me wrong results... It seems like it included all months.. I also tried using the noFilter function, but it also gave me wrong results.
    Best regards,
    Morten

  • Error while creating BOM using BAPI (urgent)

    Hi all,
    Thanks for ur help. i am getting some error while creting a BOM using that BAPI
    BAPI_MATERIAL_BOM_GROUP_CREATE.
    errors are
    1) Error/warning when checking the structure of the BOM group with ID =
    2)Alternative does not exist for material assignment to material BAPIBOMFG1
    is it mandatory to pass the bom group id to this bapi?
    In bomgroup structure , i am not passing anything to BOM_GROUP field.
    is it mandatory to pass this data? i am giving my coding below.plz suggest , where i am making mistake. it is urgent.
    regards
    pabitra
    report z_bom_create
    line-size 132
    line-count 65
    no standard page heading.
    *-- DATA DECLARATION--
    include <icon> .
    *---Tables
    tables : s076, t100, marc .
    *---Types
    types : begin of t_upload, " Upload file data
    col1(18),
    col2(10),
    col3(30),
    col4(12),
    col5(50),
    end of t_upload,
    begin of t_split,
    location like stpu-ebort,
    end of t_split.
    data:begin of i_return occurs 10.
    include structure bapiret2.
    data:end of i_return.
    types:begin of t_item."occurs 10.
    include structure BAPI1080_ITM_C.
    types:end of t_item.
    types:begin of t_subitem." occurs 10.
    include structure BAPI1080_SUI_C.
    types:end of t_subitem.
    types:begin of t_header." occurs 10.
    include structure BAPI1080_MBM_C.
    types:end of t_header.
    types:begin of t_bomgroup." occurs 10.
    include structure BAPI1080_BGR_C.
    types:end of t_bomgroup.
    types:begin of t_variant." occurs 10.
    include structure BAPI1080_BOM_C.
    types:end of t_variant.
    *--- Tables
    data: i_upload type standard table of t_upload, " to hold data
    i_upload1 type standard table of t_upload,
    i_split type standard table of t_split,
    i_item type standard table of t_item,
    i_subitem type standard table of t_subitem,
    i_header type standard table of t_header,
    i_bomgroup type standard table of t_bomgroup,
    i_variant type standard table of t_variant.
    data: wa_upload type t_upload, " to hold file data,
    wa_upload1 type t_upload, " to hold plan data,
    wa_split type t_split,
    wa_item type t_item,
    wa_subitem type t_subitem,
    wa_header type t_header,
    wa_bomgroup type t_bomgroup,
    wa_variant type t_variant.
    data:v_matnr like mara-matnr,
    v_start like sy-index,
    v_count(3) type c.
    *--Constants
    data: c_dot type c value '.',
    c_x type c value 'X',
    c_comma type c value ','.
    -------Selection Screen Design -
    *Selection screen for input of upload file address
    selection-screen skip 2.
    selection-screen begin of block blk1 with frame.
    parameters : p_file like rlgrap-filename obligatory .
    parameters : p_matnr like mara-matnr obligatory,
    p_werks like marc-werks obligatory memory id wrk,
    p_stlan like afko-stlan obligatory default '1' .
    selection-screen end of block blk1.
    ---AT SELECTION SCREEN -
    at selection-screen on value-request for p_file.
    *--For popup to select file.
    perform f_give_help.
    at selection-screen on p_matnr.
    perform f_check_matnr.
    -----START OF SELECTION -
    *--Data upload using WS_Upload.
    perform f_get_data.
    perform f_get_bom_data.
    perform f_get_bom_data1.
    perform f_call_bapi.
    *& Form f_give_help
    text
    --> p1 text
    <-- p2 text
    FORM f_give_help.
    call function 'WS_FILENAME_GET'
    exporting
    mask = ',.,..'
    mode = 'O'
    importing
    filename = p_file
    exceptions
    inv_winsys = 1
    no_batch = 2
    selection_cancel = 3
    selection_error = 4
    others = 5.
    if sy-subrc <> 0 and not sy-msgty is initial.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    ENDFORM. " f_give_help
    *& Form f_check_matnr
    text
    --> p1 text
    <-- p2 text
    FORM f_check_matnr.
    CALL FUNCTION 'BAPI_MAT_BOM_EXISTENCE_CHECK'
    EXPORTING
    MATERIAL = p_matnr
    PLANT = p_werks
    BOMUSAGE = '1'
    VALID_FROM_DATE =
    VALID_TO_DATE =
    TABLES
    RETURN = i_return.
    ENDFORM. " f_check_matnr
    *& Form f_get_data
    text
    --> p1 text
    <-- p2 text
    FORM f_get_data.
    call function 'WS_UPLOAD'
    exporting
    CODEPAGE = ' '
    filename = p_file
    filetype = 'DAT'
    tables
    data_tab = i_upload
    exceptions
    conversion_error = 1
    file_open_error = 2
    file_read_error = 3
    invalid_type = 4
    no_batch = 5
    unknown_error = 6
    invalid_table_width = 7
    gui_refuse_filetransfer = 8
    customer_error = 9
    others = 10
    if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    endif.
    ENDFORM. " f_get_data
    *& Form f_get_bom_data
    text
    --> p1 text
    <-- p2 text
    FORM f_get_bom_data.
    delete i_upload where col1 is initial.
    delete i_upload where col1 cs 'ITEM'.
    read table i_upload into wa_upload with key col1 = 'FINISHED GOOD:'.
    if sy-subrc = 0.
    v_matnr = wa_upload-col2.
    if v_matnr <> p_matnr.
    message e001(zl) with p_matnr.
    endif.
    else.
    message e000(zl).
    endif.
    ENDFORM. " f_get_bom_data
    *& Form f_get_bom_data1
    text
    --> p1 text
    <-- p2 text
    FORM f_get_bom_data1.
    loop at i_upload into wa_upload where col1 CS 'FINISHED GOOD'.
    v_start = sy-tabix + 1.
    loop at i_upload into wa_upload1 from v_start .
    if wa_upload1-col1 cs 'FINISHED GOOD'.
    exit.
    else.
    perform f_split_upload_data.
    endif.
    endloop.
    endloop.
    ENDFORM. " f_get_bom_data1
    *& Form f_split_upload_data
    text
    --> p1 text
    <-- p2 text
    FORM f_split_upload_data.
    if not wa_upload1-col5 is initial.
    if wa_upload1-col5 cs c_comma.
    split wa_upload1-col5 at c_comma into table i_split.
    loop at i_split into wa_split.
    v_count = v_count + 1.
    endloop.
    if wa_upload1-col4 <> v_count.
    wa_upload1-col4 = v_count.
    endif.
    clear wa_upload1-col5.
    clear wa_split.
    loop at i_split into wa_split.
    wa_upload1-col5 = wa_split-location.
    append wa_upload1 to i_upload1.
    endloop.
    else.
    append wa_upload1 to i_upload1.
    endif.
    else.
    append wa_upload1 to i_upload1.
    endif.
    ENDFORM. " f_split_upload_data
    *& Form f_call_bapi
    text
    --> p1 text
    <-- p2 text
    FORM f_call_bapi.
    clear wa_upload1.
    wa_header-material = p_matnr.
    wa_header-plant = p_werks.
    wa_header-bom_usage = p_stlan.
    append wa_header to i_header.
    wa_bomgroup-bom_usage = p_stlan.
    wa_bomgroup-created_in_plant = p_werks.
    append wa_bomgroup to i_bomgroup.
    wa_variant-alternative_bom = 1.
    wa_variant-base_qty = 1.
    wa_variant-valid_from_date = sy-datum.
    append wa_variant to i_variant.
    loop at i_upload1 into wa_upload1.
    wa_item-item_no = wa_upload1-col1.
    wa_item-item_cat = wa_upload1-col2.
    wa_item-component = wa_upload1-col3.
    wa_item-comp_qty = wa_upload1-col4.
    append wa_item to i_item.
    wa_subitem-subitem_qty = '1'.
    wa_subitem-installation_point = wa_upload1-col5.
    append wa_subitem to i_subitem.
    endloop.
    CALL FUNCTION 'BAPI_MATERIAL_BOM_GROUP_CREATE'
    EXPORTING
    TESTRUN = ' '
    ALL_ERROR = ' '
    TABLES
    BOMGROUP = i_bomgroup
    VARIANTS = i_variant
    ITEMS = i_item
    SUBITEMS = i_subitem
    MATERIALRELATIONS = i_header
    ITEMASSIGNMENTS =
    SUBITEMASSIGNMENTS =
    TEXTS =
    RETURN = i_return.
    if i_return[] is initial.
    CALL FUNCTION 'BAPI_TRANSACTION_COMMIT'.
    *write: /'BOM created:', stpo-stlnr.
    else.
    *if not i_return[] is initial.
    loop at i_return.
    IF i_return-TYPE = 'E'.
    errmsg-type = i_return-type.
    errmsg-line = i_return-message.
    append errmsg.
    ULINE /1(108).
    write:/ icon_led_RED as icon, i_return-MESSAGE.
    ULINE /1(108).
    ENDIF.
    IF i_return-TYPE = 'W'.
    errmsg-type = i_return-type.
    errmsg-line = i_return-message.
    append errmsg.
    ULINE /1(108).
    write:/ icon_led_YELLOW as icon, i_return-MESSAGE.
    ULINE /1(108).
    ENDIF.
    ENDLOOP.
    *write: / i_return-id, i_return-number, i_return-message(80).
    *endloop.
    *write: /'Error'.
    endif.
    ENDFORM. " f_call_bapi

    Hi shashi,
    Thanks for ur help.i tried after passing the group but it is giving same error.
    i am getting the error
    "Error/warning when checking the structure of the BOM group with ID= test"
    i am gettig the above error when i put bomgroup-bom_group_identification = 'TEST'.
    whatever i am putting in this field, the same error is comming having different value.
    if i put--- bomgroup-bom_group_identification = ' '. then i will get error
    "Error/warning when checking the structure of the BOM group with ID=
    if i omit that field, then also , i am getting same error.
    plz suggest what r the fields i need to pass for BOMGROUP structure for that bapi?
    regards
    pabitra

  • Top 'n' using rank () function

    Hi...
    I'm using BO XI 3.0. In my report I need  a user to enter TOP 'n' (n=5,10,20,50,100).
    For example:
    Caller No           No of Calls
    23467891              10
    67698089              35
    22377868              17
    76378467              10
    76374678              20
    89978978               6
    87786777              11
    I already create dimension object for Caller No and measure object for No of Calls in universe.
    So I use a rank filter in edit query but it doesn't work.
    I also create another measure object in universe name =ranking
    rank(No_of_Calls) over(partition by (Caller No) order by (No_of_Calls)).. but it's not work...
    So can anybody help me....thanks

    Hi,
    Following information might be helpful in resolving the issue.
    General Syntax of Ranking :
    Rank( measure; (dimensions); [Top|Bottom])
    Here is the work flow with an example :- (use efashion universe )
    1) Create a webi report selecting objects quarter, year, sales revenue and create a cross tab
    2) While creating a cross tab, use the Object Year in columns and object Quarter for rows.
    3)Define a variable Var1 = Rank ([Sales Revenue] ; [Quarter]; [Year]) ForEach ([Year])
    4) Insert a blank column next to year in the cross tab.
    5) Drag and drop the variable Var1 in the new blank column inserted next to Object Year..
    You will now find that you have ranking for the years 2001, 2002, 2003 being reflected
    independently.
    Regards,
    Sarbhjeet Kaur

  • Error while calling BI Publisher from Forms 10g using Webservice - Urgent !

    Hi,
    I am calling a BI Publisher(10.1.3.4.1) webservice from the Forms 10g (10.1.2.0.2). I developed a jar file which works fine when I run from the Jdeveloper. I have successfully attached jar file to the Forms 10g but when I am calling from the when-button-pressed trigger I am getting beow error
    Exception: java.lang.Exception: java.lang.NoSuchMethodError: oracle.j2ee.ws.saaj.client.p2p.HttpSOAPConnection.setPreemptiveBasicAuth(Z)V
    Thanks in advance

    What steps did you follow to successfully attached jar file to the Forms 10g? To me, it sounds like you don't have your .jar file configured with Forms Builder and/or your App Server. Your .jar file needs to be added to the FORMS_CLASS_PATH in the default.env and the FORMS_CLASS_PATH registry entry. You will likely need to modify the formsweb.cfg also to include your .jar in the archive= or archive_jini= variables (depending on your JRE [Jinitiator or Sun JRE respectively]).
    It could also be a dependency on an additional Java library. Is "setPreemptiveBasicAuth" a method that you created or it is a dependent method from an additional library?
    Let us know this; as well as which Java version you're using.
    By the way, with respects to your "Urgent!" request. You have to understand that forum contributers are purely voluntary - this is not our full-time job. If your issue is truely urgent, it is always best to open a Service Request (SR) with Oracle Support than to rely on the forum for an urgent reply! ;-)
    Hope this helps,
    Craig B-)
    If someone's response is helpful or correct, please mark it accordingly.
    Edited by: CraigB on Sep 20, 2010 2:48 PM

  • Creating EJB 3.0 project using Eclipse - Urgent

    Hi,
    Im new to EJB 3.0 and i need a urgent help please. I have created a EJB Project that uses JPA to Fetch data from Oracle 10g DB. But the problem is how to i get this project connect to DB? where do i need to do the Datasource maping and what would be the params? an example would be of real help? (On Deployment i get jta-datasource not found error)
    I have also created a Enterprise Application Project. Do i have to do the Datasource mapping here?
    I also want to create a Axis Webservice for a class that i have in my EJB Project. Can i create it in Eclipse. If so how can I?
    Please share any helpful link or tutorial or Example.
    I have tried google search and tried many blogs but no luck.
    [EJB 3.0 + Axis Web Services + Eclipse + Jboss ]
    Regards
    Prateek

    Start by getting the Java EE tutorial at least v5 (it's free) and reading the sections that you are unclear about.
    Basically you need to create a persistence.xml file that names a JDBC resuource. This is usually just the JNDI name of a resource that is configured on a server.
    You then configure a datasource on your server that contains the actual DB connection settings and name it the same as the name in the persistence.xml.
    The Java EE tutorial has sections that explain all of this.
    Also, if you are starting out, I would not advise using tools to autogenerate projects/artifacts.
    Doing it manually helps you understand how things work better.

Maybe you are looking for

  • Cannot save PDF due to program error

    Just documenting this in case anyone else ever has the same problem. Running Photoshop CS3 under Windows Vista I could not save as PDF due to a "program error" (whatever that is). Looked in C:\Users\admin\AppData\Roaming\Adobe\Adobe Photoshop CS3\Ado

  • How to know onhand quantity at a selected date

    Hi, is there a concurrent ( or a PLSQL package ) which could give the onhand quantity of an item in storage at a given date . thanks.

  • How do i deauthorize a computer if i dont have that computer anymore.

    I have 5 computers authorized; I don't have 2 of them anymore. My laptop crashed and burned and I just replace my PC. How do I find out what ones are authorizes and how do I de-authorize them. – Thanks

  • Controlling Release status on Internal Orders

    I'm creating a new Internal Order type, and I want to ensure the settlement rule has been maintained (or it has system status SETC) before it can be released. The settlement rule is not an option you can set in the field maintenance screen, and I can

  • Role , Menu and Display Priority

    I have a Role A with a menu sequence, Sort Priority 100 and a Role B with another menu sequence Priority 50 User is having role A and B But B is displayed in the navigation before A. How can I influence the display sequence?