Sum without using 2 selects

How can I get this result without using 2 queries to sum buys and sells?
BANK  TOTAL_SHARES
BANK1           30
BANK2           25
BANK4           20
BANK5           20
BANK3           15
Script to test
create table test (BUYER varchar2(5), SELLER varchar2(5), shares numeric(10));
insert into test values ('BANK1','BANK1',10);
insert into test values ('BANK1','BANK2',10);
insert into test values ('BANK3','BANK2',15);
insert into test values ('BANK4','BANK5',20);
commit;
select bank, sum(shares) total_shares from
select buyer bank, sum(shares) shares from test group by buyer
union
select seller bank, sum(shares) shares from test group by seller
group by bank
order by total_shares desc, bank;

So .. you have 2 records for BANK1:
insert into test values ('BANK1','BANK1',10);
insert into test values ('BANK1','BANK2',10);
You want to add that first 10 , twice .. and the 2nd 10 once?
BANK1           30
So you want to double add some of those?

Similar Messages

  • Select criteria without using SELECTION SCREENs

    Hi everybody,
    I have a report with a single screen, 4 fields for search criteria and 2 alv grids for the output.
    I search db tables with a select statement.
    Is it possible to define a select statement that searches for 3 out of 4 criteria, if the fourth input field isn't filled it?
    Because right now the select statement doesn't return any data if I leave one parameter blank.
    And how can I provide the possibility to define more than one search criteria of one kind withour adding several input fields on the screen?
    For example: Data created on 20070101 and 20070105.
    I know that most of this can be done with selection screens, but is there a possibility to do this without a selection screen?
    Best regards
    Tobias

    You should use SELECT-OPTIONS on your selection screen.  This allows the user to enter all kinds of possiblities, including leaving something blank.  Then in your SELECT statement, you use the IN operator.
    select-options: s_datum for sy-datum.
    select * into table itab
               from ztable
                      where datum IN s_datum.
    If you truly do not want to use a Selection-screen, you could hard code values in the SELECT statement or create a range using the RANGE statement.  The RANGE statement works exactly like SELECT-OPTION statement but without the selection-screen.
    Regards,
    Rich Heilman

  • XML in PLSQL without using SELECT statements

    It maybe crazy but I cannot find a book or an example to differentiate between these two ones, if it is english or french based on XML below.
    set serveroutput on size 1000000
    DECLARE
    l_doc VARCHAR2(2000);
    l_domdoc dbms_xmldom.DOMDocument;
    l_nodelist dbms_xmldom.DOMNodeList;
    l_node dbms_xmldom.DOMNode;
    l_value VARCHAR2(30);
    l_xmltype XMLTYPE;
    l_empx XMLTYPE;
    l_index PLS_INTEGER;
    l_col_ind PLS_INTEGER;
    v_namespace_prfx varchar2(20):= 'ns0:';
    v_namespace varchar2(200):= 'xmlns="http://www.rona.ca/SharedResources/SchemaDefinitions/Canonical"';
    l_nsmap varchar2(200);
    BEGIN
    l_doc := '<?xml version = "1.0" encoding = "UTF-8"?>          
    <ns0:Product type = "DEPAS" xmlns:ns0 = "http://www.rona.ca/SharedResources/SchemaDefinitions/Canonical">          
         <ns0:ProductIDs>     
              <ns0:ID type = "RONCD">48535003</ns0:ID>
         </ns0:ProductIDs>     
         <ns0:ProductUom Usage = "PURCU">     
              <ns0:Quantity uomCode = "EA">1</ns0:Quantity>
         </ns0:ProductUom>     
         <ns0:ProductUom Usage = "SALEU">     
              <ns0:Quantity uomCode = "EA">1</ns0:Quantity>
         </ns0:ProductUom>     
         <ns0:CreateDateTime>2003-02-16T00:00:00-04:00</ns0:CreateDateTime>     
         <ns0:Status>     
              <ns0:Code>ACTV</ns0:Code>
         </ns0:Status>     
         <ns0:Description languageCode = "fra" type = "REGID">DEPOT BOUTEILLE</ns0:Description>     
         <ns0:Description languageCode = "eng" type = "REGID">BOTTLE DEPOSIT</ns0:Description>          
         <ns0:Description languageCode = "fra" type = "LONGD">DEPOT BOUTEILLE D''EAU</ns0:Description>          
         <ns0:Description languageCode = "eng" type = "LONGD">DEPOSIT WATER BOTTLE</ns0:Description>          
         <ns0:Description languageCode = "fra" type = "REGI4">DEPOT BOUTEILLE</ns0:Description>          
         <ns0:Description languageCode = "eng" type = "REGI4">BOTTLE DEPOSIT</ns0:Description>          
         <ns0:Description languageCode = "fra" type = "CLEI4">DEPOT</ns0:Description>          
         <ns0:Description languageCode = "eng" type = "CLEI4">DEPOSIT</ns0:Description>          
         <ns0:Description languageCode = "eng" type = "LONG4">DEPOSIT WATER BOTTLE</ns0:Description>          
         <ns0:Description languageCode = "fra" type = "LONG4">DEPOT BOUTEILLE D''EAU</ns0:Description>          
    </ns0:Product>';
    l_xmltype := XMLTYPE(l_doc);
    -- Method 3
    dbms_output.new_line;
    dbms_output.put_line('Method 3');
    l_index := 1;
    l_nsmap:=v_namespace;
    --dbms_output.put_line('ID type = ' || l_xmltype.extract('/GetRequest/ProductIDs/ID[2]/@type', l_nsmap).getStringVal());
    WHILE l_xmltype.Existsnode('/Product/'||'Description[' || To_Char(l_index) || ']',v_namespace) > 0
    LOOP
    dbms_output.put_line('I am here');
    -- dbms_output.put_line('ID = ' || l_xmltype.extract('/GetRequest/ProductIDs/ID/text()', l_nsmap).getStringVal());
    dbms_output.put_line('ID type = ' || l_xmltype.extract('/Product/'||'Description[' || To_Char(l_index) || ']/@type', l_nsmap).getStringVal());
    dbms_output.put_line('ID type = ' || l_xmltype.extract('/Product/'||'Description[' || To_Char(l_index) || ']/text()', l_nsmap).getStringVal());
    -- is it english or french ? how can I capture the difference ? my example does not work
    dbms_output.put_line('ID type = ' || l_xmltype.extract('/Product/'||'Description[' || To_Char(l_index) || '][languageCode = "eng"]/text()', l_nsmap).getStringVal());
    --dbms_output.put_line('Emp Name: '||l_value);
    l_index := l_index + 1;
    END LOOP;
    END;

    I think you already know this since you extract the "type" attribute too.
    As well, languageCode is an attribute so you must access it with the "@" notation (or the attribute:: axis).
    Now, it depends on what you want to do :
    1- extract only Descriptions in a given language ?
    2- extract all Descriptions along with their language ?
    For 1) the current iteration method is not appropriate and you can't just add the corresponding predicate in the existsNode test because there's no correlation between the node position and the languageCode.
    You have to count how many nodes of the given language there are and then loop from 1 to this count.
    Or, fall back to case 2) and test the language within the loop after having extracted it.
    For 2) add another extract call that targets the attribute :
    WHILE l_xmltype.Existsnode('/Product/'||'Description[' || To_Char(l_index) || ']',v_namespace) > 0
    LOOP
      dbms_output.put_line('type = ' || l_xmltype.extract('/Product/'||'Description[' || To_Char(l_index) || ']/@type', l_nsmap).getStringVal());
      dbms_output.put_line('languageCode = ' || l_xmltype.extract('/Product/'||'Description[' || To_Char(l_index) || ']/@languageCode', l_nsmap).getStringVal());
      dbms_output.put_line('Description = ' || l_xmltype.extract('/Product/'||'Description[' || To_Char(l_index) || ']/text()', l_nsmap).getStringVal());
      l_index := l_index + 1;
    END LOOP;XMLTable is so much simpler to use in any case.

  • Upload data from Excel to internal table without using Screen

    Hi,
    My reqirment is to read the excel input data and then upload it to internal table for further proceeing but without using selection input screen. I mean can I mention the fixed file name and the path in the function module iself for the input file.

    1.First create one internal table as u have created ur EXCEL file.
    e.g: if ur EXCEL file contains 3 fields col1 col2 and col3.
           data: begin of wa,
                     col1(10),
                     col2(10),
                     col3(10),
                   end of wa,
                   itab like standard table of wa.
    data: filename type string 'C:\FOLDER\DATA.XLS'
    If u dont want to use the screen, then pass the file name directly to the GUI_UPLOAD FM.
    CALL FUNCTION 'GUI_UPLOAD'
      EXPORTING
        filename                      = filename
       FILETYPE                      = '.XLS'
      tables
        data_tab                      = itab
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_READ_ERROR               = 2
       NO_BATCH                      = 3
       GUI_REFUSE_FILETRANSFER       = 4
      INVALID_TYPE                  = 5
       NO_AUTHORITY                  = 6
       UNKNOWN_ERROR                 = 7
       BAD_DATA_FORMAT               = 8
      HEADER_NOT_ALLOWED            = 9
       SEPARATOR_NOT_ALLOWED         = 10
       HEADER_TOO_LONG               = 11
       UNKNOWN_DP_ERROR              = 12
      ACCESS_DENIED                 = 13
       DP_OUT_OF_MEMORY              = 14
       DISK_FULL                     = 15
      DP_TIMEOUT                    = 16
      OTHERS                        = 17
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    This will serve ur puspose.
    loop at itab into wa.
    write: / wa-col1,wa-col2,wa-col3.
    endloop.
    Thanks & Regards
    Santhosh

  • How can I fix this select without using subquery?

    Hi guys is there any way to do the where below (in bold) without using an aggregate query before?
    select
    SUM(NET_AMOUNT)
    as net,
    SUM(TAX_AMOUNT)
    as tax,
    SUM(NET_AMOUNT)+
    SUM(TAX_AMOUNT)
    as total from ledger left join alloc on ledger.trxid=alloc.trxid where
     (SUM(NET_AMOUNT)+
    SUM(TAX_AMOUNT))
    > allocated
    net and tax are in the ledger and allocated is in the alloc table. Sometimes the total of the amount (net+tax) is greater than the allocated so I need to retrieve all the rows where allocated is null or  tot is greater than allocated.
    It's possible without CTE?
    Thanks

    Resolved.
    SUM(NET_AMOUNT)
    as net,
    SUM(TAX_AMOUNT)
    as tax,
    SUM(NET_AMOUNT)+
    SUM(TAX_AMOUNT)
    as total from ledger left join alloc on ledger.trxid=alloc.trxid ....group by....
    having ((SUM(NET_AMOUNT)+
    SUM(TAX_AMOUNT))
    > allocated)
    Sometimes I need to post the issue in the forum just to remember how do the things.
    Thanks and sorry

  • SUM THE AMOUNT WITHOUT USING THE OVER COMMAND

    hi 2 everybody......
    the table contains:
    uid billno amount
    1 101 100
    2 102 200
    3 103 300
    the o/p shuld be:
    uid billno amount total
    1 101 100
    2 102 200 300
    3 103 300 600
    i need the query for this pblm without using the over command... please advice... can anyone send immed... thanks in advance...

    So you still don't bother to write in proper understandable English or probably your keyboard is broken.
    Any way you can do this
    SQL> WITH t AS (
      2  SELECT 1 col_uid, 101 billno, 100 amount FROM DUAL UNION ALL
      3  SELECT 2, 102, 200 FROM DUAL UNION ALL
      4  SELECT 3, 103, 300 FROM DUAL)
      5  -- end test data
      6  select col_uid, billno, amount, decode(amount, amount_cum, null, amount_cum) amount_cum
      7    from (
      8  select t.*, (select sum(amount) from t t1 where t1.col_uid <= t.col_uid) amount_cum
      9    from t)
    10  /
       COL_UID     BILLNO     AMOUNT AMOUNT_CUM
             1        101        100
             2        102        200 300
             3        103        300 600

  • How to delete the record in the table without using lead selection?

    hi,
    I have added the separate column "delete" to the table uielement and so for each record or row of the table the appropriate "delete" link to action will be there................the code below works when the particular row is selected through lead selection only.......
    help me how to delete without using lead selection.....
      DATA:
      NODE_MODULE                         TYPE REF TO IF_WD_CONTEXT_NODE,
      ELEM_MODULE                         TYPE REF TO IF_WD_CONTEXT_ELEMENT,
      STRU_MODULE                         TYPE IF_V_MODULE=>ELEMENT_MODULE .
       data itab TYPE TABLE OF zac_modules.
      navigate from <CONTEXT> to <MODULE> via lead selection
      NODE_MODULE = WD_CONTEXT->GET_CHILD_NODE( NAME = `MODULE` ).
      get element via lead selection
      ELEM_MODULE = NODE_MODULE->GET_ELEMENT(  ).
      get all declared attributes
      ELEM_MODULE->GET_STATIC_ATTRIBUTES(
        IMPORTING
          STATIC_ATTRIBUTES = STRU_MODULE ).
    NODE_MODULE->GET_STATIC_ATTRIBUTES_TABLE(
        IMPORTING
         TABLE  = itab )
    DELETE itab WHERE zmodule_id = STRU_MODULE-zmodule_id.
    CALL METHOD NODE_MODULE->BIND_TABLE
        EXPORTING
          NEW_ITEMS            = itab
       SET_INITIAL_ELEMENTS = ABAP_TRUE
       INDEX                =
    ENDMETHOD.

    Hi  ,
    The onclick event provides you with a standard paramater "CONTEXT_ELEMENT" which has the element from which the event is triggered.
    so you can declare this in the handler(if it is not there) and use it as follows.
    CONTEXT_ELEMENT  TYPE REF TO IF_WD_CONTEXT_ELEMENT  an importing paramater.
    DATA:
    NODE_MODULE TYPE REF TO IF_WD_CONTEXT_NODE,
    ELEM_MODULE TYPE REF TO IF_WD_CONTEXT_ELEMENT,
    STRU_MODULE TYPE IF_V_MODULE=>ELEMENT_MODULE .
    data itab TYPE TABLE OF zac_modules.
    CONTEXT_ELEMENT->GET_STATIC_ATTRIBUTES(
    IMPORTING
    STATIC_ATTRIBUTES = STRU_MODULE ). "Using the context_element paramater to get the static attributes.
    NODE_MODULE->GET_STATIC_ATTRIBUTES_TABLE(
    IMPORTING
    TABLE = itab )   "getting all the data.
    DELETE itab WHERE zmodule_id = STRU_MODULE-zmodule_id. "deleting the particular row from the table and binding it.
    CALL METHOD NODE_MODULE->BIND_TABLE
    EXPORTING
    NEW_ITEMS = itab
    * SET_INITIAL_ELEMENTS = ABAP_TRUE
    * INDEX =
    thanks,
    Aditya.

  • Select a To Do calendar without using mouse

    Hi there,
    How can I choose a calendar for a particular To Do item without using the mouse?
    For example, if I hit apple+K to create a new To Do, it lets me type the To Do name, but I can't find any way to then choose a calendar for the To Do using the keyboard alone. I know I can manually click the mouse into the Info drawer and then tab to the "calendar" field, or control-click on the To Do to bring up a menu that lets me set the calendar. But I can't find a way of doing this task without having to resort to the mouse. I couldn't find this in the iCal keyboard shortcuts list either. There must be a way!
    Thanks,
    Matt

    Ooh, nice bit of lateral thinking Austin. I like it!
    The main snag for me is I tend to have only 1 calendar active at any one time (by the way I discovered that you can do this really easily by command-option-clicking on the checkbox to the left of the calendar name in the Calendars list, something I don't think is documented in the iCal Help).
    However by pressing random keys I found a rather obscure way to activate and/or select calendars with the keyboard (if the To Do list currently has focus):
    1. Hit shift-control-tab (nothing appears to happen)
    2. Hit tab.
    Voila, you now have focus on the Calendars list, and can now activate the calendar you want with the up/down arrow keys and space! So you can now activate all calendars and then do your "command-K and scroll up/down" trick, or for that matter you can move to the calendar you want in the Calendars list then hit command-K to create a new To Do in that calendar.
    Again - pretty yucky! And I can't find any way to shift focus to the Calendars list like this if you're currently focused on the day/week/month view.
    I must say, iCal generally seems to behave pretty poorly with the keyboard. I'll send Apple some feedback as you suggest.
    Thanks,
    Matt

  • Is there a way to use 'GET PERNR' without the selection screens?

    I would like to use the GET PERNR event in a batch program without using the default selection screens.  I would like to be able to use my own selection screen and parameters, but only get them along with the default selection options for payroll period.  I've tried removing the screen number from the attributes screen, but still get these options.  Is this possible?

    hi Kiran,
    report Category is a Pushbutton on the Attributes popup, it only appears if you use PNP logical DB.
    this is from SAPHelp: "Report Category
    Category used for HR reports that use the PNP logical database. It controls the type and number of fields that appear on the selection screen of an evaluation report."
    hope this helps
    ec

  • Needs  help to retrive the last row in a  select query without using rownum

    Hi ,
    i need to retrive the last row from the select sub query without using rownum.
    is there any other way to retrive the last row other than the below query.
    is that the ROWNUM=1 will always retrive the 1 row of the select query ?
    select from*
    *(select ename from employee where dept_id=5 order by desc) where rownum=1;*
    Please advise.
    thanks for your help advance,
    regards,
    Senthur

    957595 wrote:
    Actually my problem is ithat while selecting the parents hiearchy of the child data using
    CONNECT BY PRIOIR query
    I need the immediate parent of my child data.
    For example my connect BY query returns
    AAA --- ROOT
    BBB --PARENT -2
    CCC --PARENT-1
    DDD IS my input child to the connect by query
    Immediate parent of my child data "DDD" ---> CCC(parent -1)
    i want the data "CCC" from the select query,for that i am taking the last row of the query with rownum.
    I got to hear that using ROWNUM to retrive the data will leads to some problem.It is a like a magic number.I am not sure what the problem will be.
    So confusing with using this rownum in my query.
    Please advice!!!It's not quite clear what you're wanting, but perhaps this may help?
    you can select the PRIOR values to get the parent details if you want...
    SQL> ed
    Wrote file afiedt.buf
      1  select empno, lpad(' ',(level-1)*2,' ')||ename as ename, prior empno as mgr
      2  from emp
      3  connect by mgr = prior empno
      4* start with mgr is null
    SQL> /
         EMPNO ENAME                                 MGR
          7839 KING
          7566   JONES                              7839
          7788     SCOTT                            7566
          7876       ADAMS                          7788
          7902     FORD                             7566
          7369       SMITH                          7902
          7698   BLAKE                              7839
          7499     ALLEN                            7698
          7521     WARD                             7698
          7654     MARTIN                           7698
          7844     TURNER                           7698
          7900     JAMES                            7698
          7782   CLARK                              7839
          7934     MILLER                           7782
    14 rows selected.(ok, not the best of examples as the mgr is already known for a row, but it demonstrates you can select prior data)

  • How to read personal no's on selection in LDB without using GET PERNR

    Hi to all
    I am using Logical data base PNP and selection screen 900.
    Now my requirement is to retrieve personal no's which are entered at selection seperately without using GET PERNR.
    Ineed all the pernrwhich are entered in selection.
    How to do that.
    Please guide.
    Regards
    Anubhav

    Hi,
    You can do as SUJIT said or use GET PERNR and assign PERN-PERNR to Workarea and then append that to internal table.
    DATA:
       ITAB_PERNR like standard table of PA0000-pernr,
       wa_pernr like line of ITAB_PERNR.
    GET PERNR.
    wa_pernr-pernr  = pernr-pernr.
    append wa_pernr to ITAB_PERNR
    Hope this would help you.
    Regards
    Narin Nandivada.

  • How can i use SUM aggregate in select query?

    HI,
    GURUS,
    How can i use SUM function in Select Query and i want to store that value into itab.
    for ex:
    TABLES: vbap.
    types: begin of ty_vbap,
           incluse type vbap,
           sum type string,
          end of ty_vbap.
    data: i_vbap type TABLE OF ty_vbap,
          w_vbap type ty_vbap.
    SELECT sum(posnr) FROM vbap into table i_vbap up to 5 rows.
                            (or)
    SELECT sum(posnr) FROM vbap into table i_vbap group by vbeln.
      loop at i_vbap into w_vbap
    " which variable have to use to display summed value.
      endloop.
    if above code is not understandable pleas give ome sample code on  above query.
    Thank u,
    shabeer ahmed.

    Hi,
    Check this sample code.
    TABLES SBOOK.
    DATA:  COUNT TYPE I, SUM TYPE P DECIMALS 2, AVG TYPE F.
    DATA:  CONNID LIKE SBOOK-CONNID.
    SELECT CONNID COUNT( * ) SUM( LUGGWEIGHT ) AVG( LUGGWEIGHT )
           INTO (CONNID, COUNT, SUM, AVG)
           FROM SBOOK
           WHERE
             CARRID   = 'LH '      AND
             FLDATE   = '19950228'
           GROUP BY CONNID.
      WRITE: / CONNID, COUNT, SUM, AVG.
    ENDSELECT.
    Regards,
    Sravanthi

  • How to display icons on selection screen ,without using classes.

    Hi Experts,
    How can we display icons on the selection-screen ..?
    one of the methods i heard frm my frnds was to use                   ->cl_gui_picture_viewer
    but as a begginer i am not tht comfortable with classes .So is there a way around to display icons on my selection screen without using classes .
    Thanx in Advance,
    Regards ,
    Rajesh .

    Hi,
    here a short example:
    REPORT Z_TEST2.
    TABLES: SSCRFIELDS.   "Felder auf Selektionsbildern
    INCLUDE .
    SELECTION-SCREEN: BEGIN OF BLOCK A01 WITH FRAME TITLE MELDUNG1.
    SELECTION-SCREEN: SKIP 2.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN: COMMENT 10(04) T_ICON.
    SELECTION-SCREEN: END   OF LINE.
    SELECTION-SCREEN: SKIP.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN: COMMENT 01(34) T_AUFSD.
    PARAMETERS:       P_AUFSD  AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN: END   OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN: COMMENT 01(34) T_AUFCO.
    PARAMETERS:       P_AUFCO  AS CHECKBOX DEFAULT ' '.
    SELECTION-SCREEN: PUSHBUTTON 45(04) PB01 USER-COMMAND SALL.
    SELECTION-SCREEN: PUSHBUTTON 50(04) PB02 USER-COMMAND DALL.
    SELECTION-SCREEN: END   OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN: COMMENT 01(34) T_AUFCS.
    PARAMETERS:       P_AUFCS  AS CHECKBOX DEFAULT ' '.
    SELECTION-SCREEN: END   OF LINE.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN: COMMENT 01(34) T_AUFPP.
    PARAMETERS:       P_AUFPP  AS CHECKBOX DEFAULT 'X'.
    SELECTION-SCREEN: PUSHBUTTON 45(15) PB03 USER-COMMAND INIT.
    SELECTION-SCREEN: END   OF LINE.
    SELECTION-SCREEN: SKIP 2.
    SELECTION-SCREEN: BEGIN OF LINE.
    SELECTION-SCREEN: PUSHBUTTON 45(15) PB04 USER-COMMAND ONLI.
    SELECTION-SCREEN: END   OF LINE.
    SELECTION-SCREEN: SKIP 2.
    SELECTION-SCREEN: END   OF BLOCK A01.
    AT SELECTION-SCREEN.
      IF SSCRFIELDS-UCOMM = 'SALL'. "alle selektieren
        P_AUFSD = 'X'.
        P_AUFCO = 'X'.
        P_AUFCS = 'X'.
        P_AUFPP = 'X'.
      ENDIF.
      IF SSCRFIELDS-UCOMM = 'DALL'. "alle deselektieren
        P_AUFSD = ' '.
        P_AUFCO = ' '.
        P_AUFCS = ' '.
        P_AUFPP = ' '.
      ENDIF.
      IF SSCRFIELDS-UCOMM = 'INIT'. "initialisiern
        P_AUFSD = 'X'.
        P_AUFCO = ' '.
        P_AUFCS = ' '.
        P_AUFPP = 'X'.
      ENDIF.
    INITIALIZATION.
      MELDUNG1 = 'Datenbankselektion'.
      T_ICON   = ICON_PRINT.
      T_AUFSD  = 'Kundenauftrag'.
      T_AUFCO  = 'Innenauftrag'.
      T_AUFCS  = 'Serviceauftrag'.
      T_AUFPP  = 'Fertingungsauftrag'.
      PB01     = ICON_SELECT_ALL.
      PB02     = ICON_DESELECT_ALL.
      CONCATENATE ICON_REFRESH 'Initial' INTO PB03.
      CONCATENATE ICON_EXECUTE_OBJECT 'Ausführen' INTO PB04.
    START-OF-SELECTION.
    write: / 'Test'.
    END-OF-SELECTION.
    Regards, Dieter

  • Select extra row without using UNION ALL in pl/sql

    Hi,
    Can anyone tell me how to select extra row without using UNION or UNION ALL in pl/sql. Actually I want to have my o/p of query as partitioned by designation and ordered by salary and than one extra row which will contain the highest salary in a particular salary. My table has first_name,emp_id,designation and salary column. And I wnt the o/p as.
    Mohinish,12212,SI,46000
    Ram,11212,SSI,47000
    Shyam,12133,SI,48000
    Rick,9898,SI,46000
    Rocky,12312,SSI,56000
    Sariq,23948,SI,43000
    Suman,12789,HR,49000
    Sampy,12780,SI,46000
    Parna,11111,HR,50000
    Now the o/p should be.
    Mohinish,12212,SI,46000
    Rick,9898,SI,46000
    Sariq,23948,SI,43000
    Shyam,12133,SI,48000
    Shyam,12133,SI,48000
    Ram,11212,SSI,47000
    Rocky,12312,SSI,56000
    Rocky,12312,SSI,56000
    Suman,12789,HR,49000
    Parna,11111,HR,50000
    Parna,11111,HR,50000
    Thanks in Advance

    You don't have to do a UNION or UNION ALL in PL/SQL but you would need to in SQL to get the desired output:
    with data_recs
    as (select 'Mohinish' first_name,12212 emp_id,'SI' designation,46000 salary from dual union
         select 'Ram',11212,'SSI',47000 from dual union
         select 'Shyam',12133,'SI',48000 from dual union
         select 'Rick',9898,'SI',46000 from dual union
         select 'Rocky',12312,'SSI',56000 from dual union
         select 'Sariq',23948,'SI',43000 from dual union
         select 'Suman',12789,'HR',49000 from dual union
         select 'Sampy',12780,'SI',46000 from dual union
         select 'Parna',11111,'HR',50000 from dual)
    select first_name, emp_id, designation, salary from data_recs union all
    select s.first_name, s.emp_id, s.designation, s.salary
      from (select first_name,
                   emp_id,
                   designation,
                   salary,
                   row_number() over (partition by designation order by salary desc) high_salary
              from data_recs
             order by designation, salary) s
    where s.high_salary = 1
    order by designation, salary;
    FIRST_NAME  EMP_ID DESIGNATION   SALARY
    Suman        12789 HR             49000
    Parna        11111 HR             50000
    Parna        11111 HR             50000
    Sariq        23948 SI             43000
    Rick          9898 SI             46000
    Mohinish     12212 SI             46000
    Sampy        12780 SI             46000
    Shyam        12133 SI             48000
    Shyam        12133 SI             48000
    Ram          11212 SSI            47000
    Rocky        12312 SSI            56000
    Rocky        12312 SSI            56000

  • ABAP WD, Multiple Row selection in table control without using Crtl key

    Hi all,
    I am displaying the records using the table control, i have to select the multiple records in the list <b>without using Crtl key</b>.
    How do i solve this?
    Thanks

    Hi,
    you should set the table parameter selectionMode to multi or multinolead
    than you can select multiple records,
    these you can retrieve: lt_selected_elements = node->get_selected_elements( ).
    also see this <a href="https://forums.sdn.sap.com/click.jspa?searchID=4209200&messageID=3544158">thread</a> for info
    grtz,
    Koen

Maybe you are looking for