Rows to be displayed as columns
DB : 10.2.0.4.0
Os : solaris 5.10
I have a table with the below rows and columns
EARNINGS EARNINGS_VALUE
Allowance 97.28
Salary 3,404.80
Allowance_1 875.52
Allowance_2 194.56
Allowance_3 291.84
{code}
I want to display this as follows :
{code}
Allowance Salary Allowance_1 Allowance_2 Allowance_3
97.28 3,404.80 875.52 194.56 291.84
{code}
Please suggest
Kai
Hello, try:
WITH your_table AS (SELECT 'Allowance' EARNINGS, 97.28 EARNINGS_VALUE FROM DUAL UNION ALL
SELECT 'Salary', 3404.80 FROM DUAL UNION ALL
SELECT 'Allowance_1', 875.52 FROM DUAL UNION ALL
SELECT 'Allowance_2', 194.56 FROM DUAL UNION ALL
SELECT 'Allowance_3', 291.84 FROM DUAL)
-- end test data
SELECT Allowance, Salary, Allowance_1, Allowance_2, Allowance_3
FROM (
SELECT MAX(CASE EARNINGS WHEN 'Allowance' THEN EARNINGS_VALUE ELSE NULL END) Allowance,
MAX(CASE EARNINGS WHEN 'Salary' THEN EARNINGS_VALUE ELSE NULL END) Salary,
MAX(CASE EARNINGS WHEN 'Allowance_1' THEN EARNINGS_VALUE ELSE NULL END) Allowance_1,
MAX(CASE EARNINGS WHEN 'Allowance_2' THEN EARNINGS_VALUE ELSE NULL END) Allowance_2,
MAX(CASE EARNINGS WHEN 'Allowance_3' THEN EARNINGS_VALUE ELSE NULL END) Allowance_3
FROM your_table
ALLOWANCE SALARY ALLOWANCE_1 ALLOWANCE_2 ALLOWANCE_3
97.28 3404.8 875.52 194.56 291.84
Similar Messages
-
Rows to be displayed as Columns with SQL
I have a select statment
SQL> SELECT T.CODE,T.DESCRIPTION from tmp t;
CODE DESCRIPTION
1 1-1
1 1-2
1 1-3
1 1-4
I want with SQL not SQL*PLUS nor Cursors to see the output of my SQL statment as
1 1-1 1-2 1-3 1-4
Please HelpYou could try something like that :
SQL> with tbl as
2 (select 1 code, '1-1' descr from dual union all
3 select 1 code, '1-2' descr from dual union all
4 select 1 code, '1-3' descr from dual union all
5 select 1 code, '1-4' descr from dual) -- end of data sample
6 select code, max(sys_connect_by_path(descr,' ')) keep (dense_rank last order by length(sys_connect_by_path(descr,' '))) descr
7 from tbl
8 connect by code = prior code and descr > prior descr
9 group by code
10 /
CODE
DESCR
1
1-1 1-2 1-3 1-4Nicolas. -
How to display the column header in two rows?
Hi Experts,
I am using ALV_LIST_DISPLAY i neeed to display the column header in two rows.. How can i do that?
Ex: purchase order i need to display "purchase" in one row and "order" in second row.
Thanks in advance,
Sarath.jREPORT zpwtest .
TYPE-POOLS slis .
DATA : layout TYPE slis_layout_alv .
CONSTANTS : c_len TYPE i VALUE 20 .
TYPES : BEGIN OF ty_t100 ,
sprsl TYPE t100-sprsl ,
arbgb TYPE t100-arbgb ,
msgnr TYPE t100-msgnr ,
text TYPE t100-text ,
fline TYPE t100-text ,
END OF ty_t100 .
TYPES : BEGIN OF ty_wrd ,
text TYPE char20 ,
END OF ty_wrd .
DATA : it_t100 TYPE TABLE OF ty_t100 ,
it_sentence TYPE TABLE OF ty_wrd ,
wa_t100 TYPE ty_t100 ,
wa_word TYPE ty_wrd ,
v_repid TYPE syst-repid ,
v_tabix TYPE syst-tabix .
DATA : it_fld TYPE slis_t_fieldcat_alv ,
it_evt TYPE slis_t_event ,
wa_fld TYPE slis_fieldcat_alv ,
wa_evt TYPE slis_alv_event .
INITIALIZATION .
v_repid = sy-repid .
START-OF-SELECTION .
* Get data
SELECT *
INTO TABLE it_t100
FROM t100
WHERE sprsl = 'EN'
AND arbgb = '00' .
LOOP AT it_t100 INTO wa_t100 .
v_tabix = sy-tabix .
CLEAR : it_sentence .
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
textline = wa_t100-text
outputlen = c_len
TABLES
out_lines = it_sentence.
IF NOT it_sentence IS INITIAL .
READ TABLE it_sentence INTO wa_word INDEX 1 .
wa_t100-fline = wa_word-text .
MODIFY it_t100 FROM wa_t100 INDEX v_tabix .
ENDIF.
ENDLOOP.
* Prepare fieldcatelog
CLEAR wa_fld .
wa_fld-fieldname = 'SPRSL' .
wa_fld-ref_tabname = 'T100' .
wa_fld-ref_fieldname = 'SPRSL' .
APPEND wa_fld TO it_fld .
CLEAR wa_fld .
wa_fld-fieldname = 'ARBGB' .
wa_fld-ref_tabname = 'T100' .
wa_fld-ref_fieldname = 'ARBGB' .
APPEND wa_fld TO it_fld .
CLEAR wa_fld .
wa_fld-fieldname = 'MSGNR' .
wa_fld-ref_tabname = 'T100' .
wa_fld-ref_fieldname = 'MSGNR' .
APPEND wa_fld TO it_fld .
CLEAR wa_fld .
wa_fld-fieldname = 'FLINE' .
wa_fld-inttype = 'CHAR' .
wa_fld-outputlen = 20 .
wa_fld-intlen = 20.
wa_fld-seltext_l = 'Text' .
wa_fld-ddictxt = 'L' .
APPEND wa_fld TO it_fld .
* Get event.. we will handle BOFORE and AFTER line output
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
IMPORTING
et_events = it_evt.
READ TABLE it_evt INTO wa_evt
WITH KEY name = slis_ev_after_line_output .
wa_evt-form = slis_ev_after_line_output .
MODIFY it_evt FROM wa_evt INDEX sy-tabix .
READ TABLE it_evt INTO wa_evt
WITH KEY name = slis_ev_top_of_page .
wa_evt-form = slis_ev_top_of_page .
MODIFY it_evt FROM wa_evt INDEX sy-tabix .
layout-no_colhead = 'X' .
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = v_repid
it_fieldcat = it_fld
is_layout = layout
it_events = it_evt
TABLES
t_outtab = it_t100.
* FORM top_of_page *
FORM top_of_page .
uline .
WRITE: / sy-vline ,
10 sy-vline ,
11 'line1' ,
31 sy-vline ,
37 sy-vline ,
58 sy-vline .
WRITE: / sy-vline ,
10 sy-vline ,
11 'line2' ,
31 sy-vline ,
37 sy-vline ,
58 sy-vline .
WRITE: / sy-vline ,
10 sy-vline ,
11 'line3' ,
31 sy-vline ,
37 sy-vline ,
58 sy-vline .
ENDFORM.
* FORM AFTER_LINE_OUTPUT *
FORM after_line_output USING rs_lineinfo TYPE slis_lineinfo .
CLEAR : it_sentence ,
wa_t100 .
READ TABLE it_t100 INTO wa_t100 INDEX rs_lineinfo-tabindex .
CHECK sy-subrc = 0 .
CALL FUNCTION 'RKD_WORD_WRAP'
EXPORTING
textline = wa_t100-text
outputlen = c_len
TABLES
out_lines = it_sentence.
DESCRIBE TABLE it_sentence LINES v_tabix .
CHECK v_tabix > 1 .
LOOP AT it_sentence INTO wa_word FROM 2 .
WRITE: / sy-vline ,
10 sy-vline ,
31 sy-vline ,
37 sy-vline ,
38 wa_word-text ,
58 sy-vline .
ENDLOOP.
ENDFORM . -
How to display rows of data into different columns?
I'm new to SQL and currently this is what I'm trying to do:
Display multiple rows of data into different columns within the same row
I have a table like this:
CREATE TABLE TRIPLEG(
T# NUMBER(10) NOT NULL,
LEG# NUMBER(2) NOT NULL,
DEPARTURE VARCHAR(30) NOT NULL,
DESTINATION VARCHAR(30) NOT NULL,
CONSTRAINT TRIPLEG_PKEY PRIMARY KEY (T#, LEG#),
CONSTRAINT TRIPLEG_UNIQUE UNIQUE(T#, DEPARTURE, DESTINATION),
CONSTRAINT TRIPLEG_FKEY1 FOREIGN KEY (T#) REFERENCES TRIP(T#) );
INSERT INTO TRIPLEG VALUES( 1, 1, 'Sydney', 'Melbourne');
INSERT INTO TRIPLEG VALUES( 1, 2, 'Melbourne', 'Adelaide');
The result should be something like this:
> T# | ORIGIN | DESTINATION1 | DESTINATION2
> 1 | SYDNEY | MELBORUNE | ADELAIDE
The query should include the `COUNT(T#) < 3` since I only need to display the records less than 3. How can I achieve the results that I want using relational views???
Thanks!!!T#
LEG#
DEPARTURE
DESTINATION
1
1
Sydney
Melbourne
1
2
Melbourne
Adelaide
1
3
Adelaide
India
1
4
India
Dubai
2
1
India
UAE
2
2
UAE
Germany
2
3
Germany
USA
On 11gr2, you may use this :
SELECT t#,
REGEXP_REPLACE (
LISTAGG (departure || '->' || destination, ' ')
WITHIN GROUP (ORDER BY t#, leg#),
'([^ ]+) \1+',
'\1')
FROM tripleg
where leg#<=3
GROUP BY t#;
Output:
1 Sydney->Melbourne->Adelaide->India
2 India->UAE->Germany->USA
Cheers,
Manik. -
In the af:table selected row need to display in the next page?
Hi,
I am using jdev 11.1.2.3.0.
I tried one sample application, in that jspx page, I am having the af:table and button in my view activity. In that table select one row and click on the button that time, the navigation page always show the first row. Suppose I select the 5th ro and navigate the page also displaying the first row only. So I don't know how to proceed this? Kindly suggest me.
Regards,
RaguHi Timo,
I used the selectionListener tag also.
Anyway Here I posted my jspx page.
<?xml version='1.0' encoding='UTF-8'?>
<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1" xmlns:f="http://java.sun.com/jsf/core"
xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
<jsp:directive.page contentType="text/html;charset=UTF-8"/>
<f:view>
<af:document title="EmployeesView.jspx" id="d1">
<af:messages id="m1"/>
<af:form id="f1">
<af:panelCollection id="pc1">
<f:facet name="menus"/>
<f:facet name="toolbar">
<af:toolbar id="t2">
<af:commandButton text="Edit Employee" id="cb1" action="Edit" />
</af:toolbar>
</f:facet>
<f:facet name="statusbar"/>
<af:table value="#{bindings.EmployeesVO.collectionModel}" var="row" rows="#{bindings.EmployeesVO.rangeSize}"
emptyText="#{bindings.EmployeesVO.viewable ? 'No data to display.' : 'Access Denied.'}"
fetchSize="#{bindings.EmployeesVO.rangeSize}" rowBandingInterval="0"
filterModel="#{bindings.EmployeesVOQuery.queryDescriptor}"
queryListener="#{bindings.EmployeesVOQuery.processQuery}" filterVisible="true" varStatus="vs"
selectedRowKeys="#{bindings.EmployeesVO.collectionModel.selectedRow}"
selectionListener="#{bindings.EmployeesVO.collectionModel.makeCurrent}" rowSelection="single"
id="t1">
<af:column sortProperty="#{bindings.EmployeesVO.hints.EmployeeId.name}" filterable="true" sortable="true"
headerText="#{bindings.EmployeesVO.hints.EmployeeId.label}" id="c1">
<af:outputText value="#{row.EmployeeId}" id="ot1">
<af:convertNumber groupingUsed="false" pattern="#{bindings.EmployeesVO.hints.EmployeeId.format}"/>
</af:outputText>
</af:column>
<af:column sortProperty="#{bindings.EmployeesVO.hints.FirstName.name}" filterable="true" sortable="true"
headerText="#{bindings.EmployeesVO.hints.FirstName.label}" id="c2">
<af:outputText value="#{row.FirstName}" id="ot2"/>
</af:column>
<af:column sortProperty="#{bindings.EmployeesVO.hints.LastName.name}" filterable="true" sortable="true"
headerText="#{bindings.EmployeesVO.hints.LastName.label}" id="c3">
<af:outputText value="#{row.LastName}" id="ot3"/>
</af:column>
<af:column sortProperty="#{bindings.EmployeesVO.hints.Email.name}" filterable="true" sortable="true"
headerText="#{bindings.EmployeesVO.hints.Email.label}" id="c4">
<af:outputText value="#{row.Email}" id="ot4"/>
</af:column>
<af:column sortProperty="#{bindings.EmployeesVO.hints.PhoneNumber.name}" filterable="true" sortable="true"
headerText="#{bindings.EmployeesVO.hints.PhoneNumber.label}" id="c5">
<af:outputText value="#{row.PhoneNumber}" id="ot5"/>
</af:column>
<af:column sortProperty="#{bindings.EmployeesVO.hints.HireDate.name}" filterable="true" sortable="true"
headerText="#{bindings.EmployeesVO.hints.HireDate.label}" id="c6">
<f:facet name="filter">
<af:inputDate value="#{vs.filterCriteria.HireDate}" id="id1">
<af:convertDateTime pattern="#{bindings.EmployeesVO.hints.HireDate.format}"/>
</af:inputDate>
</f:facet>
<af:outputText value="#{row.HireDate}" id="ot6">
<af:convertDateTime pattern="#{bindings.EmployeesVO.hints.HireDate.format}"/>
</af:outputText>
</af:column>
<af:column sortProperty="#{bindings.EmployeesVO.hints.JobId.name}" filterable="true" sortable="true"
headerText="#{bindings.EmployeesVO.hints.JobId.label}" id="c7">
<af:outputText value="#{row.JobId}" id="ot7"/>
</af:column>
<af:column sortProperty="#{bindings.EmployeesVO.hints.Salary.name}" filterable="true" sortable="true"
headerText="#{bindings.EmployeesVO.hints.Salary.label}" id="c8">
<af:outputText value="#{row.Salary}" id="ot8"/>
</af:column>
<af:column sortProperty="#{bindings.EmployeesVO.hints.CommissionPct.name}" filterable="true" sortable="true"
headerText="#{bindings.EmployeesVO.hints.CommissionPct.label}" id="c9">
<af:outputText value="#{row.CommissionPct}" id="ot9"/>
</af:column>
<af:column sortProperty="#{bindings.EmployeesVO.hints.ManagerId.name}" filterable="true" sortable="true"
headerText="#{bindings.EmployeesVO.hints.ManagerId.label}" id="c10">
<af:outputText value="#{row.ManagerId}" id="ot10">
<af:convertNumber groupingUsed="false" pattern="#{bindings.EmployeesVO.hints.ManagerId.format}"/>
</af:outputText>
</af:column>
<af:column sortProperty="#{bindings.EmployeesVO.hints.DepartmentId.name}" filterable="true" sortable="true"
headerText="#{bindings.EmployeesVO.hints.DepartmentId.label}" id="c11">
<af:outputText value="#{row.DepartmentId}" id="ot11">
<af:convertNumber groupingUsed="false" pattern="#{bindings.EmployeesVO.hints.DepartmentId.format}"/>
</af:outputText>
</af:column>
</af:table>
</af:panelCollection>
</af:form>
</af:document>
</f:view>
</jsp:root>
After click the Edit Employee button it should navigate the another page and which record I choose. -
Interactive report: How to display "count" column on total data set?
Hi,
I'm a relative newbie to APEX and would appreciate some help with the following:
I have an interactive report that will usually contain around 8000 rows.
I need to report the total number of distinct values in one of the columns - but I need to get around the limitation of APEX where it only counts the number of rows displayed on the screen.
I thought to create a separate region and use a separate SQL query to show the full total regardless of the number of rows displayed - however, I've now got the problem of not being able to access the interactive report "query", so, for example, if someone running the report adds a filter, I need the total to report with this new filter applied.
Does anyone know if I can:
a) get around the the limitation of only counting the number of rows displayed?
or, if not,
b) how to access the interactive report "query" that is being run?
or
c) any other way of doing this!?
I do hope this makes sense. Thanks in advance for any help....
HelenHi all,
Thanks for your responses. They really are much appreciated.
I had hoped to spend some time on this over the weekend - but haven't got round to it. I'll work on it again tomorrow and will certainly look at the thread you mentioned Tony.
Sorry I'm not being very clear about what I want. Why are these things always so hard to explain in words :o)
I'll have another go....
I have an interactive report that would report around, say, 8000 rows. Obviously I don't want to display all 8000 on the screen so I'll probably display them in chunks of 15 rows. If I use the aggregation function on the report, I can add a count of the distinct account numbers to the bottom of the display, but it will only count the ones displayed on the screen. I need the count to be of all the rows - so 8000 instead of 15 - but still displaying only 15 rows. When a user then applies a filter to the report, I need the count to change in accordance with the filter - so if the number of rows returned as a result of the filter is now 4000 instead of 8000, I need the count to now say 4000 instead of 8000 even though still only 15 rows are actually displayed on the screen.
I'll try and pre-empt the questions...
1) There will always be duplicate account numbers in there so the count will never be the actual number of rows - but I'm simplifying above to help explain the problem better
2) Why would they want 8000 rows? Don't ask. I'm sure it's something to do with exporting the lot into an excel spreadsheet but they'll never admit it :o)
I hope this makes more sense......
Thanks again!!
Helen
P.S. Almost forgot again... I'm using Apex 4.1 on the Oracle hosted environment which I assume is 11g. -
How could I display some columns in a JTable?
Help, please:
I got a Table data(using AbstractedTableModel), and I can display all rows and columns. How can I just display several columns and all rows? Should I delete some columns from table and fireChanges or what? but I need these columns later. Make sense? any ideas?
Thanks for any helps.
Royanthis worked for me,
import java.util.*;
import java.io.*;
import java.net.URL;
import java.sql.*;
import javax.swing.table.*;
import javax.swing.*;
public class HideTableColumns
public HideTableColumns()
private void initialize()
DefaultTableModel m = new DefaultTableModel();
try {
java.util.Vector data = new java.util.Vector();
java.util.Vector headers = new java.util.Vector();
String s = "";
headers.addElement( "OrderID" );
headers.addElement( "CustomerID" );
java.util.Vector datum = null;
datum = new java.util.Vector();
s = "OrderID";
datum.addElement( s );
s = "CustomerID";
datum.addElement( s );
data.addElement( datum );
m.setDataVector( data, headers );
for( int r = 0; r < m.getRowCount(); r++ )
for( int c = 0; c < m.getColumnCount(); c++ )
s = ( m.getValueAt( r, c ) ).toString();
System.out.println( s );
} catch( Exception e ) {
System.out.println(e.getMessage());
e.printStackTrace();
JFrame f = new JFrame();
JPanel p = (JPanel) f.getContentPane();
JTable tb = new JTable( m );
TableColumn col = tb.getColumnModel().getColumn(1);
col.setPreferredWidth(0);
col.setMinWidth(0);
col.setMaxWidth(0);
p.add( tb );
f.pack();
f.show();
public static void main( String[] args )
HideTableColumns d1 = new HideTableColumns();
d1.initialize();
} -
Displaying 2 columns in a single column using HTML section of reports.
Hi Team,
I have a requirement in which we need to display 2 columns in the same column of OBIEE report. At present we have 2 columns as 2 different columns.
For example if i have a column A which is used as @A in html section i need the new column to have @A + @B where B is another column in database.
Can i concatenate 2 columns in a single column ?
Thanks,
Riteshfirst select column 1 and column 2 in criteria.
go to reaults are add narrater view.
in narrater view type.
@1@2[br/]
set number of rows
this should work in narrator.
Edited by: user10615659 on May 20, 2013 4:30 PM -
Is it possible to change the number of rows to be displayed in adf query ?
Hello,
is it possible to change the number of rows that are displayed in an adf query similar to an adf form ?
I need to display approx 5 rows per column instead of displaying all the fields in a single column ? Thanks.Thanks , how do you add in the code ,is it something like follows :
<af:query id="qryId1" headerText="Search" disclosed="true"
value="#{bindings.ImplicitViewCriteriaQuery.queryDescriptor}"
model="#{bindings.ImplicitViewCriteriaQuery.queryModel}"
queryListener="#{bindings.ImplicitViewCriteriaQuery.processQuery}"
queryOperationListener="#{bindings.ImplicitViewCriteriaQuery.processQueryOperation}">
<af:inputText value="#{bindings.PrtDesc.inputValue}" label="Desc"
required="#{bindings.PrtDesc.hints.mandatory}"
columns="#{bindings.PrtDesc.hints.displayWidth}"
maximumLength="#{bindings.PrtDesc.hints.precision}"
shortDesc="#{bindings.PrtDesc.hints.tooltip}" id="it3">
<f:validator binding="#{bindings.PrtDesc.validator}"/>
</af:inputText>
<af:column>
<af:outputtext/>
<af:outputtext/>
</af:column>
</af:query> -
How can I display multiple column results of a sql query?
I'm wanting to display the results of a query selecting from multiple columns, but I can't seem to find an item type that will allow this. I've tried LOV, multiselect, display as text and others. Any ideas on how to do this. Here is my basic query:
Select ul.meaning,
rqa.submission_date,
rqa.location_num
from
cfa_rqa_doc_submit_dates rqa,
cfa_user_lookups ul
where
rqa.location_num in (Select location_num from cfa_current_locations_mv
where operator_person_id = :P1_PERSON_ID and substr(location_num,1,1) = '8')
and
ul.lookup_type_id='1269'
and
to_char(rqa.submission_date, 'month') = to_char(sysdate, 'month')
and
rqa.submission_date >= (SYSDATE-365)
and ul.lookup_ID= rqa.document_type_id
;Hi,
Do you just wish to display the result of the query? If so, you can simply parse it out in HTML.
You can then choose if you want to use tables or css.
Multiple column layout in tables are based on <tr> and <td>.
<tr> is a table row, where <td> is a column.
All tags should be closed.
Example:
<table>
<tr>
<td>col1</td><td>col2</td>
</tr>
<tr>
<td colspan="2">spans over 2 cols</td>
</tr>
</table>If you want to do the same in css:
(Seems this forum removes the styles!):
float:left; width:50; << first div and 2 div (col 1 and col 2 style)
float:left;clear:both; width:100%; << clear both, double width (spans over 2)
<div>
<div style="float:left; width:50;">col1</div><div style="float:left;width:50%;">col2</div>
<div style="float:left;clear:both; width=100%;">Spans over 2 cols</div>
</div>The div might look more complicated, but if you refrain from styling in the tags them selves, you can define different styles in the .css file.
You need the clear:both to start a new line with the divs that float.
I usually run a dedicated "new line" div, without content.. (exception beeing the html-entities version of ' ' (& nbsp ; << without the spaces)).
eg.:
<div style="cls"> </div>Parsing out the values from the PL SQL you do like so:
begin
declare
cursor c_search is
Select ul.meaning,
rqa.submission_date,
rqa.location_num
from
cfa_rqa_doc_submit_dates rqa,
cfa_user_lookups ul
where
rqa.location_num in (Select location_num from cfa_current_locations_mv
where operator_person_id = :P1_PERSON_ID and substr(location_num,1,1) = '8')
and
ul.lookup_type_id='1269'
and
to_char(rqa.submission_date, 'month') = to_char(sysdate, 'month')
and
rqa.submission_date >= (SYSDATE-365)
and ul.lookup_ID= rqa.document_type_id
begin
htp.p('<div style="width:80%;">');
for v_search in c_search loop
htp.p('<div style="float:left;clear:none;">'||v_search.location_num||'</div>');
htp.p('<div style="float:left;clear:none;">'||v_search.submission_date||'</div>');
end loop;
htp.p('</div>');
end;
end;Ps. hope I understood you correctly, also this code is untested.. but I hope it can still help.
Edited by: Olav Alexander Mjelde on May 12, 2010 9:36 AM -
Display query columns in horizontal
Hi all
I'm creating a report using sql commands only(no report builder). I'd like to have my columns to be displayed in horizontal followed by its value. So far I've made it, however I can't get them to be displayed well where all the columns are in the same position as well as the results.
HECS:Higher Education Cafetaria Service
Restaurant and Bar
Membership Report
Date:DateVar
Member ID: 11
Member Name:Donald Anatidae Position:Senior Lecturer
Institution Name:UVan Department:Department of Computers
Phone:03-6355-9876 Employment:Tenured
Annual Fee: $225.25 Monthly Fee: $1.88
GST: $22.53 GST: $20.65
Annual Fee|(including GST): $247.Monthly Fee|(including GST): $20.65
-- Declaring variables
COLUMN Date NOPRINT NEW_VALUE DateVar
COLUMN ID NOPRINT NEW_VALUE IDVar
COLUMN Name NOPRINT NEW_VALUE NameVar
COLUMN Department NOPRINT NEW_VALUE DepartVar
COLUMN Phone NOPRINT NEW_VALUE PhoneVar
COLUMN Institution NOPRINT NEW_VALUE InstiVar
COLUMN Position NOPRINT NEW_VALUE PosVar
COLUMN Employment NOPRINT NEW_VALUE EmployVar
COLUMN Annual_Fee NOPRINT NEW_VALUE AnnualVar
COLUMN GST NOPRINT NEW_VALUE AGSTVar
COLUMN Annual_GST NOPRINT NEW_VALUE AnnuaGSTVar
COLUMN M_GST NOPRINT NEW_VALUE MgstVar
COLUMN Month_Fee NOPRINT NEW_VALUE MonthFeeVar
COLUMN Monthy_Gst NOPRINT NEW_VALUE MonthGstVar
BREAK ON ID SKIP Page
TTITLE CENTER 'HECS:Higher Education Cafetaria Service' SKIP 1 -
CENTER 'Restaurant and Bar' SKIP 2 -
LEFT 'Membership Report' SKIP 2 -
LEFT 'Date:'DateVar SKIP 2 -
LEFT COL 6 'Member ID:'IDVar SKIP 1 -
LEFT ------------------------------------------------------------------------------ SKIP 1 -
LEFT COL 6 'Member Name:' NameVar RIGHT 'Position:' PosVar SKIP 1-
LEFT COL 6 'Institution Name:'InstiVar COL 15 RIGHT 'Department:'DepartVar SKIP 1 -
LEFT COL 6 'Phone:'PhoneVar COL 15 RIGHT 'Employment:' EmployVar SKIP 1 -
LEFT COL 6 'Annual Fee:'FORMAT $9,990.99 AnnualVar -
RIGHT 'Monthly Fee:'FORMAT $9,990.99 MonthFeeVar SKIP 1 -
LEFT COL 6 'GST:'FORMAT $9,990.99 AGSTVar -
RIGHT 'GST:'FORMAT $9,990.99 MonthGstVar SKIP 1 -
LEFT ------------------------------------------------------------------------------ SKIP 1 -
LEFT COL 6 'Annual Fee|(including GST):'FORMAT $9,990.99 AnnuaGSTVar -
RIGHT 'Monthly Fee|(including GST):'FORMAT $9,990.99 MonthGstVar SKIP 1 -
LEFT -------------------------------------------------------------------------------
[\pre]
I'd like to know is whether there is another way to display the columns in horizontal.
ThanxHe gave you the general idea. The following takes it a step further.
scott@ORA92> CLEAR COLUMNS
scott@ORA92> TTITLE OFF
scott@ORA92> COLUMN today NEW_VALUE DateVar
scott@ORA92> SELECT SYSDATE AS today FROM DUAL
2 /
TODAY
17-APR-2006
scott@ORA92> TTITLE CENTER 'HECS: Higher Education Cafetaria Service' SKIP 1 -
CENTER 'Restaurant and Bar' SKIP 2scott@ORA92> COLUMN membership_report HEADING 'Membership Report||Date: &DateVar|'
scott@ORA92> SELECT 'Member ID: ' || e.empno
2 || CHR(10)
3 || '-------------------------------------------------------------'
4 || CHR(10)
5 || 'Member Name: ' || RPAD (e.ename, 20) || 'Position: ' || e.job
6 || CHR(10)
7 || 'Institution: ' || RPAD (d.deptno, 20) || 'Department: ' || d.dname
8 || CHR(10)
9 || 'Salary: ' || RPAD (TO_CHAR (e.sal, '$9,990.99'), 20)
10 || 'Commission: ' || TO_CHAR (e.comm, '$9,990.99')
11 || CHR(10)
12 || '-------------------------------------------------------------'
13 || CHR(10)
14 || 'Annual Fee: ' || RPAD (TO_CHAR (e.sal, '$9,990.99'), 20)
15 || 'Monthly Fee: ' || (TO_CHAR (e.sal/12, '$9,990.99'))
16 || CHR(10)
17 || '-------------------------------------------------------------'
18 || CHR(10)
19 || CHR(10)
20 AS membership_report
21 FROM emp e, dept d
22 WHERE e.deptno = d.deptno
23 /
HECS: Higher Education Cafetaria Service
Restaurant and Bar
Membership Report
Date: 17-APR-2006
Member ID: 7369
Member Name: SMITH Position: CLERK
Institution: 20 Department: RESEARCH
Salary: $800.00 Commission:
Annual Fee: $800.00 Monthly Fee: $66.67
Member ID: 7499
Member Name: ALLEN Position: SALESMAN
Institution: 30 Department: SALES
Salary: $1,600.00 Commission: $300.00
Annual Fee: $1,600.00 Monthly Fee: $133.33
Member ID: 7521
Member Name: WARD Position: SALESMAN
Institution: 30 Department: SALES
Salary: $1,250.00 Commission: $500.00
Annual Fee: $1,250.00 Monthly Fee: $104.17
Member ID: 7566
Member Name: JONES Position: MANAGER
Institution: 20 Department: RESEARCH
Salary: $2,975.00 Commission:
Annual Fee: $2,975.00 Monthly Fee: $247.92
Member ID: 7654
Member Name: MARTIN Position: SALESMAN
Institution: 30 Department: SALES
Salary: $1,250.00 Commission: $1,400.00
Annual Fee: $1,250.00 Monthly Fee: $104.17
Member ID: 7698
Member Name: BLAKE Position: MANAGER
Institution: 30 Department: SALES
Salary: $2,850.00 Commission:
Annual Fee: $2,850.00 Monthly Fee: $237.50
Member ID: 7782
Member Name: CLARK Position: MANAGER
Institution: 10 Department: ACCOUNTING
Salary: $2,450.00 Commission:
Annual Fee: $2,450.00 Monthly Fee: $204.17
Member ID: 7788
Member Name: SCOTT Position: ANALYST
Institution: 20 Department: RESEARCH
Salary: $3,000.00 Commission:
Annual Fee: $3,000.00 Monthly Fee: $250.00
Member ID: 7839
Member Name: KING Position: PRESIDENT
Institution: 10 Department: ACCOUNTING
Salary: $5,000.00 Commission:
Annual Fee: $5,000.00 Monthly Fee: $416.67
Member ID: 7844
Member Name: TURNER Position: SALESMAN
Institution: 30 Department: SALES
Salary: $1,500.00 Commission: $0.00
Annual Fee: $1,500.00 Monthly Fee: $125.00
Member ID: 7876
Member Name: ADAMS Position: CLERK
Institution: 20 Department: RESEARCH
Salary: $1,100.00 Commission:
Annual Fee: $1,100.00 Monthly Fee: $91.67
Member ID: 7900
Member Name: JAMES Position: CLERK
Institution: 30 Department: SALES
Salary: $950.00 Commission:
Annual Fee: $950.00 Monthly Fee: $79.17
Member ID: 7902
Member Name: FORD Position: ANALYST
Institution: 20 Department: RESEARCH
Salary: $3,000.00 Commission:
Annual Fee: $3,000.00 Monthly Fee: $250.00
Member ID: 7934
Member Name: MILLER Position: CLERK
Institution: 10 Department: ACCOUNTING
Salary: $1,300.00 Commission:
Annual Fee: $1,300.00 Monthly Fee: $108.33
14 rows selected.null -
How to Display Sub-Columns using ALV Grid
Hi ,
Could someone tell me how to display sub-columns under a parent column using ALV Grid. Do we have any standard Program which has this scenario. Please let me know.
Thanks,
Abaper.
Message was edited by:
ABAP'eryou can check all with <b>BCALV* or RSDEMO*</b> in SE38 for all Std
check below
BCALV_DND_01 Drag ALV Row to Tree Folder
BCALV_DND_02 Drag Icons from Tree to Rows of the Grid
BCALV_GRID_DND_TREE ALV Grid: Drag and Drop with ALV Tree
BCALV_GRID_DND_TREE_SIMPLE ALV GRID: Drag and drop with ALV tree (simple)
BCALV_TEST_COLUMN_TREE Program BCALV_TEST_COLUMN_TREE
Rewards if useful............
Minal -
How to display dynamic column added by vo.addDynamicAttribute in jspx?
Hi,
I met problem when programmatically add cloumn and display it on screen. Here are my steps:
0. define a ViewObject using xml. Define a transient column Addtion2. later will add a dynamic column Addtion3, but not defined here.
1. Implement Application Module, adding a method init() and expose it to client.
2. In init() method, get target VO and use vo.addDynamicAttribute("Addition3"). Then iterate it use row.setAttribute("Addition3", Math.random()). Add init() to page binding and invoke it.( it's invoked )
3. In jspx, use dynamic table. But Addition3 never shows up.
This is my last question: Re: How to display dynamic column added by vo.addDynamicAttribute in jspx? People say I should use dynamic table.
please have a look at my code:
Application Module: when it runs, it will print 6 coulmns. vo.getAttributeCount() is <font color="red">6</font>.
<pre>
public void init() {
ViewObject vo = this.getCountryView1();
if (vo.getAttributeIndexOf("Addition3") == -1) {
vo.addDynamicAttribute("Addition3");
vo.executeQuery();
for (AttributeDef deft : vo.getAttributeDefs()) {
System.out.println(deft.getColumnName() + ": " + deft.getName());
RowSetIterator it = vo.createRowSetIterator("i1");
while (it.hasNext()) {
Row r = it.next();
r.setAttribute("Addition2", Math.random());
r.setAttribute("Addition3", Math.random());
it.closeRowSetIterator();
for (AttributeDef deft : vo.getAttributeDefs()) {
System.out.println(deft.getColumnName() + ": " + deft.getName());
System.out.println(vo.getAttributeCount()); //vo.getAttributeCount() is 6
</pre>
jspx: when it runs, only 5 columns are shown. Column Addition2's values are set as expected. but Column Addition3 never shows up. And #{bindings.CountryView1.attributeCount} shows <font color="red">5</font>.
<pre>
<af:table rows="#{bindings.CountryView1.rangeSize}"
fetchSize="#{bindings.CountryView1.rangeSize}"
emptyText="#{bindings.CountryView1.viewable ? 'No data to display.' : 'Access Denied.'}"
var="row" rowBandingInterval="0"
value="#{bindings.CountryView1.collectionModel}"
selectedRowKeys="#{bindings.CountryView1.collectionModel.selectedRow}"
selectionListener="#{bindings.CountryView1.collectionModel.makeCurrent}"
rowSelection="single" id="t1">
<af:forEach items="#{bindings.CountryView1.attributeDefs}" var="def">
<af:column headerText="#{def.name}"
sortable="true" sortProperty="#{def.name}" id="c1">
<af:outputText value="#{row[def.name]}" id="ot1"/>
</af:column>
</af:forEach>
</af:table>
<af:forEach items="#{bindings.CountryView1.attributeDefs}" var="def">
<af:outputText value="#{def.name}" id="ot2"/>
</af:forEach>
<af:outputText value="#{bindings.CountryView1.attributeCount}" id="ot3"/>
</pre>
it's quite weird for me. The vo.getAttributeCount() is 6, but #{bindings.CountryView1.attributeCount} shows 5. And column Addtion3 never shows up.
what's the matter? How can I show the dynamic added column Addtion3?
Edited by: simon li on 2012-9-10 下午7:31
Edited by: simon li on 2012-9-10 下午8:00Hi,
Can you check the tree binding (CountryView1 - in the pagedef) and see it has the 5 attributes hardcoded in it. If yes, try removing everything and then run the page to see if it works fine.
-Arun -
How to Display Sub-Columns using ALV
Hi experts,
Could someone tell me how to display sub-columns under a parent column using ALV. Do we have any standard Program which has this scenario. points are guaranteed for the right answer.
Thanks in advance
Sreenivasyou can check all with <b>BCALV* or RSDEMO*</b> in SE38 for all Std
check below
BCALV_DND_01 Drag ALV Row to Tree Folder
BCALV_DND_02 Drag Icons from Tree to Rows of the Grid
BCALV_GRID_DND_TREE ALV Grid: Drag and Drop with ALV Tree
BCALV_GRID_DND_TREE_SIMPLE ALV GRID: Drag and drop with ALV tree (simple)
BCALV_TEST_COLUMN_TREE Program BCALV_TEST_COLUMN_TREE
Rewards if useful............
Minal -
How to display the column names of a table in the output
Hi,
I want to display the name of the columns of the table without using literals in a abap report.
EX: Consider the table KNA1
KUNNR NAME ADDRESS
I want to display the column names in the above fashion without using hardcoded write statements.
Thanking in anticipationYou can use this FM <b>DDIF_FIELDINFO_GET</b> It gives you all the names related to fields in a table -:)
Greetings,
Blag.
Maybe you are looking for
-
Modify the Field Type of standard Table fields in a Query
Hello. I have a question. Is there a way to "modify" the field type for standard table fields that are included in a Query? I made a simple query out of a join of tables, but several fields have a lot of decimals, and I would like to present them in
-
I implemented the extended classic scenario. In the po print , I need to display if the po is or not approved. I have a customized approval workflow on 2 level. I need to understand if the po is or not approved on all 2 level. Thanks for the help
-
Internal order - restrict charges
How do I restrict the charges to an internal order ? I want to use a new order type but restrict its use by Responsible cost centers and or cost type ( ie only Investment management cost centers and non labor only ) Do not want the order open
-
Im using "transform again" after scaling. It scales but center point moves, why?
I have a bunch of stuff i need to enlarge 200%. I selected one and scaled it. I selected the second one and did CTRL+D for "transform again". It works but it moves it to the side, seems like its centerpoint is where the first object is that i scal
-
Progress (bar) in the program window instead of statusbar
Hello, I make use of a bapi that adds messages to the statusbar. I also want to use some kind of progress indication. When I use FM SAPGUI_PROGRESS_INDICATOR I cannot see the progress because the messages take the focus away from the little clock....