How to print the rows vertically

Hi
how to print the results vertically, like this
SELECT eno, ename, deptid FROM emp_asign
WHERE ROWNUM<3
ENO     104
ENAME     Bruce Ernst
DEPTID     60
ENO     106
ENAME     Maximus
DEPTID     60

well, let's start from the inside and work our way out, shall we?
the "WITH" clause is just to alias a subquery that he used as an example. I'll assume you know that, and just put it inside the main query (and I'll use all the columns)
select rpad(t.column_value.getrootelement(),20) || ': ' || t.column_value.extract('//text()') out
from table(xmlsequence(xmltype(cursor(select * from emp where rownum<4)).extract('ROWSET/ROW/*'))) t
SQL> select cursor(select * from emp where rownum<4) from dual;
CURSOR(SELECT*FROMEM
CURSOR STATEMENT : 1
CURSOR STATEMENT : 1
     EMPNO ENAME      JOB              MGR HIREDATE         SAL       COMM     DEPTNO
      7369 SMITH      CLERK           7902 17-DEC-80        800                    20
      7499 ALLEN      SALESMAN        7698 20-FEB-81       1600        300         30
      7521 WARD       SALESMAN        7698 22-FEB-81       1250        500         30
3 rows selected.
1 row selected.
SQL> select xmltype(cursor(select * from emp where rownum<4)) from dual;
XMLTYPE(CURSOR(SELECT*FROMEMPWHEREROWNUM<4))
<?xml version="1.0"?>
<ROWSET>
<ROW>
  <EMPNO>7369</EMPNO>
  <ENAME>SMITH</ENAME>
  <JOB>CLERK</JOB>
  <MGR>7902</MGR>
  <HIREDATE>17-DEC-80</HIREDATE>
  <SAL>800</SAL>
  <DEPTNO>20</DEPTNO>
</ROW>
<ROW>
  <EMPNO>7499</EMPNO>
  <ENAME>ALLEN</ENAME>
  <JOB>SALESMAN</JOB>
  <MGR>7698</MGR>
  <HIREDATE>20-FEB-81</HIREDATE>
  <SAL>1600</SAL>
  <COMM>300</COMM>
  <DEPTNO>30</DEPTNO>
</ROW>
<ROW>
  <EMPNO>7521</EMPNO>
  <ENAME>WARD</ENAME>
  <JOB>SALESMAN</JOB>
  <MGR>7698</MGR>
  <HIREDATE>22-FEB-81</HIREDATE>
  <SAL>1250</SAL>
  <COMM>500</COMM>
  <DEPTNO>30</DEPTNO>
</ROW>
</ROWSET>
1 row selected.
SQL> select xmltype(cursor(select * from emp where rownum<4)).extract('ROWSET/ROW/*') from dual;
XMLTYPE(CURSOR(SELECT*FROMEMPWHEREROWNUM<4)).EXTRACT('ROWSET/ROW/*')
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<MGR>7902</MGR>
<HIREDATE>17-DEC-80</HIREDATE>
<SAL>800</SAL>
<DEPTNO>20</DEPTNO>
<EMPNO>7499</EMPNO>
<ENAME>ALLEN</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>20-FEB-81</HIREDATE>
<SAL>1600</SAL>
<COMM>300</COMM>
<DEPTNO>30</DEPTNO>
<EMPNO>7521</EMPNO>
<ENAME>WARD</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>22-FEB-81</HIREDATE>
<SAL>1250</SAL>
<COMM>500</COMM>
<DEPTNO>30</DEPTNO>
1 row selected.
SQL> select xmlsequence(xmltype(cursor(select * from emp where rownum<4)).extract('ROWSET/ROW/*')) from dual;
XMLSEQUENCE(XMLTYPE(CURSOR(SELECT*FROMEMPWHEREROWNUM<4)).EXTRACT('ROWSET/ROW/*'))
XMLSEQUENCETYPE(XMLTYPE(<EMPNO>7369</EMPNO>
), XMLTYPE(<ENAME>SMITH</ENAME>
), XMLTYPE(<JOB>CLERK</JOB>
), XMLTYPE(<MGR>7902</MGR>
), XMLTYPE(<HIREDATE>17-DEC-80</HIREDATE>
), XMLTYPE(<SAL>800</SAL>
), XMLTYPE(<DEPTNO>20</DEPTNO>
), XMLTYPE(<EMPNO>7499</EMPNO>
), XMLTYPE(<ENAME>ALLEN</ENAME>
), XMLTYPE(<JOB>SALESMAN</JOB>
), XMLTYPE(<MGR>7698</MGR>
), XMLTYPE(<HIREDATE>20-FEB-81</HIREDATE>
), XMLTYPE(<SAL>1600</SAL>
), XMLTYPE(<COMM>300</COMM>
), XMLTYPE(<DEPTNO>30</DEPTNO>
), XMLTYPE(<EMPNO>7521</EMPNO>
), XMLTYPE(<ENAME>WARD</ENAME>
), XMLTYPE(<JOB>SALESMAN</JOB>
), XMLTYPE(<MGR>7698</MGR>
), XMLTYPE(<HIREDATE>22-FEB-81</HIREDATE>
), XMLTYPE(<SAL>1250</SAL>
), XMLTYPE(<COMM>500</COMM>
), XMLTYPE(<DEPTNO>30</DEPTNO>
1 row selected.
now that we know what that looks like, we can put it in the TABLE() and make it the FROM clause
SQL> select * from table(xmlsequence(xmltype(cursor(select * from emp where rownum<4)).extract('ROWSET/ROW/*')));
COLUMN_VALUE
<EMPNO>7369</EMPNO>
<ENAME>SMITH</ENAME>
<JOB>CLERK</JOB>
<MGR>7902</MGR>
<HIREDATE>17-DEC-80</HIREDATE>
<SAL>800</SAL>
<DEPTNO>20</DEPTNO>
<EMPNO>7499</EMPNO>
<ENAME>ALLEN</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>20-FEB-81</HIREDATE>
<SAL>1600</SAL>
<COMM>300</COMM>
<DEPTNO>30</DEPTNO>
<EMPNO>7521</EMPNO>
<ENAME>WARD</ENAME>
<JOB>SALESMAN</JOB>
<MGR>7698</MGR>
<HIREDATE>22-FEB-81</HIREDATE>
<SAL>1250</SAL>
<COMM>500</COMM>
<DEPTNO>30</DEPTNO>
23 rows selected.I'm getting bored. I'm sure you can break down the remaining parts of the statement to see what they return, and how it all comes together.

Similar Messages

  • How to print the row  ,column,and particular cell in separate color

    how to print the row  ,column,and particular cell in separate color IN ALV GRID

    HI,
    Here you go good program links
    <a href="http://www.sapfans.com/forums/viewtopic.php?t=52107">How to Set Color to a Cell in AVL</a>
    <a href="http://www.sapdevelopment.co.uk/reporting/alv/alvgrid_color.htm">ALV Grid Coloring</a>
    Thanks
    Mahesh

  • Printing Table data: How to print the row data in 'Western Text' ?

    Hi,
    Scenario:
    I have a table containing, say 5 records. The table is placed in a sub form (Properties: Content - Flowed, Flow direction - Western Text) which is adjusted in a manner to occupy only half of the page (vertically).
    I need the records to be printed adjacent to each other i.e. after printing the first row of the table , the next record should be placed in the other half of the page and so on.
    Issue:
    The problem is that even though I have set the property (flow direction) to Western text, the data is printed one below the other as in the Top to bottom property.
    Am I missing something?
    Kindly advice how to resolve this issue.
    Please let me know if the question is anyway unclear.
    Regards
    s@k

    Hi Otto,
    Thanks a lot for your prompt response.
    yes there is plenty of space.
    I am trying to display the records of a table. I used sub forms to behave like table and body row.
    The body row sub form occupies left half the page (to make it clear, say you divide the page vertically). The other half (i.e. right half ) is blank. I have checked the box to repeat itself for each data item.
    Now after printing the first record on the left hand side, I want the second record to be printed on the right hand side and if there is a 3rd record in the table, it should be printed just below the 1st record.
    Please do let me know if still the issue is not clear.
    Kindly suggest.
    Regards
    s@k

  • How to print the file name in sap

    Hi All,
    I have requirment like,
    there is a folder in my local system, inside that folder there are 10 Excel file like file1.xls,file2.xls..............file10.xls
    how to print the file name of all these file in SAp like
    file1.xls
    file2.xls
    file3.xls
    file4.xls
    file10.xls
    Appropriate points will be rewarded.
    Thanks in Advance
    Arun kumar

    Hi,
    Still you are facing any problem with this code expalin the problem with details , otherwise close this thread.
    Use Method <b>cl_gui_frontend_services=>directory_list_files</b> to read file names for a given directory
    after reading the files then Use FM : <b>RSPO_SX_OUTPUT_TEXTDATA</b> to create spool from internal table data and print the data.
    <b>sample code :</b>
    data: desktop_dir type string.
    data: ifiles type table of string.
    data: xfiles type string.
    data: count type i.
    data: filepath type string.
    call method cl_gui_frontend_services=>get_desktop_directory
      changing
        desktop_directory    = desktop_dir .
    call method cl_gui_cfw=>flush.
    call method cl_gui_frontend_services=>directory_list_files
      exporting
        directory                   = desktop_dir
    *    filter                      = '*.xls'
         files_only                  = 'X'
    *        DIRECTORIES_ONLY            =
      changing
        file_table                  = ifiles
        count                       = count.
      DATA : x_name       LIKE tsp03d-name,
             x_dest       LIKE tsp03d-padest VALUE 'LOCL',
             x_rows       LIKE sxpcklsti1-body_num VALUE 0,
             x_startrow   LIKE sxpcklsti1-body_start VALUE 1,
             x_pages      LIKE rspotype-pages VALUE 1,
             x_pages_1    TYPE p DECIMALS 2,
             x_rqtitle    LIKE sxpcklsti1-obj_descr,
             x_rqcopies   TYPE i VALUE 1,
             x_rqowner    LIKE trdyse01cm-username,
             x_immediate  LIKE pri_params-primm VALUE ' ',
             x_rqid       LIKE tsp01-rqident,
             i_contents    LIKE  solisti1 OCCURS 0 WITH HEADER LINE,
          x_pages   = 1.
          x_rqowner = sy-uname.
          x_dest     = 'LOCL'.
          x_startrow = 1.
          x_rqcopies = 1.
          x_immediate = 'X' .
          CALL FUNCTION 'RSPO_SX_OUTPUT_TEXTDATA'
           EXPORTING
    *       name                 =   x_name
             dest                 =  x_dest
             rows                 =  x_rows
             startrow             =  x_startrow
             pages                =  x_pages
             rqtitle              =  x_rqtitle
             rqcopies             =  x_rqcopies
             rqowner              =  x_rqowner
             immediately          =  x_immediate
           IMPORTING
             rqid                 =  x_rqid
           TABLES
             text_data            = i_contents
           EXCEPTIONS
             name_missing         = 1
             name_twice           = 2
             not_found            = 3
             illegal_layout       = 4
             internal_error       = 5
             size_mismatch        = 6
             OTHERS               = 7.
          IF sy-subrc <> 0.
    ** MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    **         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    Regards
    Appana
    *Reward Points for helpful answers
    Message was edited by: L Appana

  • How to print the components in scrollpane

    hi there,
    can anyone tell me how to print the scrollpane components, i mean the headers & the main view of the component. i've a scrollpane with the following code and i want to print the components:
    JScrollPane pane = new JScrollPane(aTextPane);
    pane.setRowHeaderView(aLineNumberComponent);my requirement is i've a editor & lineno component as textpanes and added to scrollpane & when asked to print it should print the lineno component which resides in scrollpane's row header & the editor textpane which is the main view in the scrollpane. how can i achieve this?
    i'd would appreciate any suggestions & codes given.
    thanx in advance.

    After adding/removing components to/from a panel try:
    panel.revalidate();
    panel.repaint() // sometimes this is also needed, I'm
    not sure whyI'm not certain, but I think that panel.revalidate() implicitly calls repaint() only if something actually changed in the layout. If nothing changed, it sees no reason to repaint; hence, if something changed in appearance but not in layout, you have to repaint it yourself.
    Or something like that. I'm no expert. ;)

  • How to Fix the row in sap script, its urgent......

    Hi Experts,
    first i explain my sap script, i have print void check in my script client give readymade format means box are there, lines are there. i have to fix in box and line data form database table. everthing is working fine. i got all data. i have total 6 window in my script .but i have one issue  In my sap script in header window total five rows... like below
    Check voucher no:8888
    check No: 1234
    Date:1/28/2007
    Bank:xyz
    Batch no: 5678
    now sometime check voucher is balnk....
    Check voucher no: BLANK/NULL
    check No: 1234
    Date:1/28/2007
    Bank:xyz
    Batch no: 5678
    because of that all rows are move up side and all window also move up side and so script not fix to the box and line all data are seen not perfectly... so guru`s how to fix the row and window in script....
    its urgent...
    Waiting for ur reply
    Thanks & regards
    Jigar

    Hi,
    Follow the below steps . Definately your issue will bve resolved.
    Let us suppose you are printing following fields
    PH &v_text&
    PH &v_text1&
    PH &v_text2&
    you will get the output as you expected.
    and if you have any conditions  for these fileds
    /: if v_text is not initial.
    PH &v_text&
    /: endif
    PH &v_text1&
    PH &v_text2&
    if you have data in each field then you will get output as expected .
    But when v_text is initial.
    the data will be moved up wnhich is happening in your case.
    so what you need to do is?
    /: if v_text is not initial.
    PH &v_text&
    /: else
    PH  (Here you need to mention empty line with same paragraph format
    /: endif.
    PH &v_text1&
    PH &v_text2&
    Reward points if useful
    Regards,
    Nageswar

  • How to print the superscript in smartform

    Hi gurus,
    Please tell me the procedure how to print the superscript in middle of the text displaying?
    when we are displaying the smartform its converted to some special character like & .
    please let me know procedure at the earliest
    Regards
    Raj

    Hi thanks for ur patience.
    see my requirment was to print TM as superscript for HLL ,already smartstyle is there, and also a character format with superscript is also defined.
    then aftet HLL how it prints as superscript.
    for HLL we are using another character format and for superscript we are using the another character format.
    If posiible send me the code to write in smartforms
    Regards
    RAj
    Points are awarded for useful answers.

  • How to print the script in condensed mode

    Hi to all,
    Pls help me.
    How to print the script in condensed mode and particular window only print in the condensed mode.

    Hi,
    Hi
    It will remove the blank spaces in front of the variable
    and if you use the extension NO-GAPS
    It will remove all the blank spaces in the variable field.
    DATA: ws_val1 type char12.
    ws_val1 = ' 100 123'.
    Condense ws_val1.
    Write / ws_val1.
    Condense ws_val1 no-gaps.
    write / ws_val1.
    It will give output as
    100 123
    100123
    The CONDENSE statement deletes redundant spaces from a string:
    CONDENSE c NO-GAPS.
    This statement removes any leading blanks in the field c and replaces other sequences of blanks by exactly one blank. The result is a left-justified sequence of words, each separated by one blank. If the addition NO-GAPS is specified, all blanks are removed.
    Please check this link for sample code.
    http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb33e6358411d1829f0000e829fbfe/content.htm
    Regards,
    Raj.

  • How to print the text in points wise in sap script

    hi friends,
    how to print the text in points wise in sap script.
    ex: if suppose paragraph consists of 15 lines. then according to one sentence or one fullstop (.) it should give point 1. like that...
    1. hai how ru.
    2. what r  u doing.
    3.where r u.
    like this i want numbering.. waiting for ur replys.
    thanks,
    kiran

    declare a counter
    data : cnt type char 4.
    print :
    cnt = cnt + 1.
    &cnt& &text&
    cnt = cnt + 1. and so on.
    or.
    if the data is in an internal table
    loop at internal_table.
    cnt = cnt + 1.
    write form.
    in script -&cnt& &text&
    endloop.
    Edited by: NIKHILKUMAR POOJARI on Nov 17, 2008 11:18 AM

  • How to print the text in only last but one page in sapscripts

    hiiiiiiiiiii,
             explian how to print the text in only last but one page in sapscripts? wher to write the code? plz if possible explain in detail with an example?

    Hello,
    The total no pages is given by &SAPSCRIPT-FORMPAGES& command.
    So u can handle the situation in ur form like this
    /: if &PAGE&  = &SAPSCRIPT-FORMPAGES&
    p1 TEXT
    /: endif
    Try in this way it may help u.
    Regards

  • How to print the message in 2 lines?

    How to print the message in 2 lines?
    Here i am having it like this... MESSAGE i000(zm) WITH lv_uname.
    here I want to print lv_uname in 2 lines because it lengthy one.
    Thanks,
    Sridhar.

    No man, itas not comming..I am using the below logic to print my message:
        CONCATENATE text-I01 lv_printdate1 text-I02 INTO lv_printname
    SEPARATED BY space.
        MESSAGE i002(zm) WITH lv_printname.
    its printing in a single line...

  • Delivery document how to print the BOM Parent and Child items

    Hi,
    I have a production BOM. In Delivery document how to print the Parent and Child items Item Code and Qty.At the time
    of add a delivery document Inventory stock redused only in Parent Item not child item because child item stock already reduced in issue for production.

    If you need to print both the BOM Parent and Child items, you have to create your own report. BOM is only for production if it is not Sales type.
    Thanks,
    Gordon

  • How to increase the row height of the table in the smartform

    Hi,
    Can any one say,
    How to increase the row height of the table in the smartform.
    It is presently show the row width very small, i want to increase the row with of the table in the smartform.
    Plase say how can we increase the row height in the smartform.

    Hi Ravi,
         In Smartforms , Select the Table and you can adjust the cell hieghts in OUTPUT OPTIONs TAB.
        Reward points if that Helps.
    Manish

  • How to print the Cheques in Oracle Payroll in R12

    After Running the Cheque Writer Process in Oracle Payroll how can one print the Cheque Leaves in the Payroll module for each employee that is to be paid through cheque.
    Please give the Navigation for the same.
    Regards,
    Chetan

    Please if there is any one who has tried out some customisation on how to print the cheques after running the cheque writer process kindly share it with me as i am in big trouble here....

  • How to print the HEX values of non-displayable characters!

    I am trying to tokenize a string that contains non-displayable characters i.e. EBCDIC or ASCII. How can I print the HEX values of the non-displayable characters. e.g.
    "StartTEST1TEST2TEST3TEST4TEST5TEST6TEST7TEST812END"
    How can print the HEX values of in the above string. Any help is appreciated.
    Thanks

        char ch = 28; // or whatever character you want to look at.
        String hexString = Integer.toHexString(ch);
        System.out.println(hexString);

Maybe you are looking for