Table with varying number of columns
Hello experts,
my issue:
I need to print a table with varying number of columns. Depending on if all cells of a certain column are initial the
whole column should disappear. Hiding is not enough.
If this columns is in the middle of the table the following columns should move left to fill the gap.
my approach: (maybe there is an easier one)
There are 4 different possible situations. My approach was to create 4 different tables with different amount of
columns. In the interface I fill the table that is really needed from the source table data and fill a flag that characteristics
the situation, possible values (1,2,3,4).
In the form I'd like to print the appropriate table depending on the situations.
my problem:
How to place all 4 possible tables lying upon each other in the form and print only the needed one depending on the flag value?
my question:
Is my approach ok? Or is there an easier one?
If it is ok. How can I solve the problem regarding printing the right table.
Thanks in advance!
Heinz
Hi Heinz,
You can handle it with FormCalc Script at initialization.
Suppose you have a table with name TABLE having a header HEADER and data row DATA:
TABLE-->HEADER(Cell1...Cell2...Cell3...Cell4)
--->DATA(Cell1...Cell2...Cell3...Cell4)
Suppose you want to hide Cell3 for null values, then write below code at initialization of DATA:
if(DATA[*].Cell3.rawValue eq null)
then
DATA[*].Cell3.presence = "hidden"
HEADER.Cell3.presence = "hidden"
else
DATA[*].Cell3.presence = "visible"
HEADER.Cell3.presence = "visible"
endif
Hope it would help.
Regards,
Vaibhav
Similar Messages
-
How to create a table with varied number of columns?
I am trying to create a balance table. The colunms should include years between the start year and end year the user will input at run time. The rows will be the customers with outstanding balance in those years.
If the user input years 2000 and 2002, the table should have columns 2000, 2001, 2002. But if the user input 2000 and 2001, the table will only have columns 2000 and 2001.
Can I do it? How? Thanka a lot.Why did you create a new thread for this?
How to create a table with varied number of columns? -
Can we create JTable with multiple rows with varying number of columns ?
Hi All,
I came across a very typical problem related to JTable. My requirement is that cells should be added dynamically to the JTable. I create a JTable with initial size of 1,7 (row, columns) size. Once the 7 columns are filled with data, a new row should be created. But the requirement is, the new row i.e. second row should have only one cell in it initially. The number of cells should increase dynamically as the data is entered. The table is automatically taking the size of its previous row when new row is added. I tried by using setColumnCount() to change the number of columns to '1' for the second row but the same is getting applied to the first row also.
So can you please help me out in this regard ? Is it possible to create a JTable of uneven size i.e. multiple rows with varying number of columns in each row ?
Thanks in Advance.Well a JTable is always going to paint the same number of columns for each row. Anything is possible if you want to rewrite the JTable UI to do this, but I wouldn't recommend it. (I certainly don't know how to do it).
A simpler solution might be to override the isCellEditable(...) method of JTable and prevent editing of column 2 until data in column 1 has been entered etc., etc. You may also want to provide a custom renderer that renderers the empty column differently, maybe with a grey color instead of a white color. -
Hi everyone, again landed up with a problem.
After trying a lot to do it myself, finally decided to post here..
I have created a form in form builder 6i, in which on clicking a button the data gets exported to excel sheet.
It is working fine with a single table. The problem now is that i am unable to do the same with 2 tables.
Because both the tables have same number of columns & column names.
Below are 2 tables with column names:
Table-1 (MONTHLY_PART_1)
Table-2 (MONTHLY_PART_2)
SL_NO
SL_NO
COMP
COMP
DUE_DATE
DUE_DATE
U-1
U-1
U-2
U-2
U-4
U-4
U-20
U-20
U-25
U-25
Since both the tables have same column names, I'm getting the following error :
Error 402 at line 103, column 4
alias required in SELECT list of cursor to avoid duplicate column names.
So How can i export the data to excel which has 2 tables with same number of columns & column names?
Should i paste the code? Should i post this query in 'SQL and PL/SQL' Forum?
Help me with this please.
Thank You.You'll have to *alias* your columns, not prefix it with the table names:
$[CHE_TEST@asterix1_impl] r
1 declare
2 cursor cData is
3 with data as (
4 select 1 id, 'test1' val1, 'a' val2 from dual
5 union all
6 select 1 id, '1test' val1, 'b' val2 from dual
7 union all
8 select 2 id, 'test2' val1, 'a' val2 from dual
9 union all
10 select 2 id, '2test' val1, 'b' val2 from dual
11 )
12 select a.id, b.id, a.val1, b.val1, a.val2, b.val2
13 from data a, data b
14 where a.id = b.id
15 and a.val2 = 'a'
16 and b.val2 = 'b';
17 begin
18 for rData in cData loop
19 null;
20 end loop;
21* end;
for rData in cData loop
ERROR at line 18:
ORA-06550: line 18, column 3:
PLS-00402: alias required in SELECT list of cursor to avoid duplicate column names
ORA-06550: line 18, column 3:
PL/SQL: Statement ignored
$[CHE_TEST@asterix1_impl] r
1 declare
2 cursor cData is
3 with data as (
4 select 1 id, 'test1' val1, 'a' val2 from dual
5 union all
6 select 1 id, '1test' val1, 'b' val2 from dual
7 union all
8 select 2 id, 'test2' val1, 'a' val2 from dual
9 union all
10 select 2 id, '2test' val1, 'b' val2 from dual
11 )
12 select a.id a_id, b.id b_id, a.val1 a_val1, b.val1 b_val1, a.val2 a_val2, b.val2 b_val2
13 from data a, data b
14 where a.id = b.id
15 and a.val2 = 'a'
16 and b.val2 = 'b';
17 begin
18 for rData in cData loop
19 null;
20 end loop;
21* end;
PL/SQL procedure successfully completed.
cheers -
Displaying tables with dynamic number of columns
Hello,
I'm pretty new to JSF. Currently I'm working on a project where I have to select a table from a list, and then make it browsable/editable. The problem I have is that the different tables also have a different number of columns.
I have no problem displaying different tables if the number of coulumns stays the same (using h:datatable) but when it's dynamic, I don't know how I can have my JSP to adjust to support the varying number of columns.
Has anyone got an example of dynamic datatable or maybe someone can point me in the right direction.
BrimborianHi daniel,
1. There is an INDEPENDENT FORM
whose inputs are FIELD LIST
and from those, it consructs dynamic table.
2. Here is the program.
the dynamic table name will be
<DYNTABLE>.
3. U can use this program (FORM in this program)
to generate any kind of internal table
by specifying some inputs (ie. field list)
4.
REPORT abc.
COMPULSORY
FIELD-SYMBOLS: <dyntable> TYPE ANY TABLE.
FIELD-SYMBOLS: <dynline> TYPE ANY.
DATA: lt TYPE lvc_t_fcat.
DATA: ls TYPE lvc_s_fcat.
FIELD-SYMBOLS: <fld> TYPE ANY.
DATA : fldname(50) TYPE c.
PARAMETERS : infty(4) TYPE c OBLIGATORY.
DATA : iname LIKE dd02l-tabname.
START-OF-SELECTION.
GET INFO
CONCATENATE 'P' infty INTO iname.
DATA : ddfields LIKE ddfield OCCURS 0 WITH HEADER LINE.
CALL FUNCTION 'DD_NAMETAB_TO_DDFIELDS'
EXPORTING
tabname = iname
TABLES
ddfields = ddfields.
CONSTRUCT FIELD LIST
LOOP AT ddfields.
ls-fieldname = ddfields-fieldname.
APPEND ls TO lt.
ENDLOOP.
PERFORM
PERFORM mydyntable USING lt.
BREAK-POINT.
INDEPENDENT FORM
FORM mydyntable USING lt TYPE lvc_t_fcat .
Create Dyn Table From FC
FIELD-SYMBOLS: <fs_data> TYPE REF TO data.
FIELD-SYMBOLS: <fs_1>.
FIELD-SYMBOLS: <fs_2> TYPE ANY TABLE.
DATA: lt_data TYPE REF TO data.
ASSIGN lt_data TO <fs_data>.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = lt
IMPORTING
ep_table = <fs_data>
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
Assign Dyn Table To Field Sumbol
ASSIGN <fs_data>->* TO <fs_1>.
ASSIGN <fs_1> TO <fs_2>.
ASSIGN <fs_1> TO <dyntable>.
ENDFORM. "MYDYNTABLE
regards,
amit m. -
BI Layout/Template | Table with dynamic number of columns
hi!
i have a problem concerning the creation of a dynamic report with the BI publisher.
in my BI template i need a table with a dynamic number of columns. i have searched the
forums but havent really found a solution for this type of problem.
first of all this is A dummy-structure of my dataset:
<ROWSET>
<ROW>
<FIELD1>1</FIELD2>
<FIELD2>2</FIELD2>
<FIELD3>3</FIELD3>
<FIELD4>4</FIELD4>
</ROW>
<ROW>
<FIELD1>a</FIELD2>
<FIELD2>b</FIELD2>
<FIELD3>c</FIELD3>
<FIELD4>d</FIELD4>
</ROW>
</ROWSET>
in the report the fields represent the columns i need in the table.
the problem is, that the number of the fields vary. in this example i have 4 fields/columns
but another time i may have 6 or 10 etc..
my dataset is always different because i am loading my dataset via a http request which is
returning the needed data in XML.
is there a nativ possibility within the publisher to generate the columns dynamically?
i read about <?split-column-header:group element name?> etc. but this is only for cross-tables.
can anybody give me a hint how to approach this problem?
would be very glad for some advice.
thanks a lot in advance!Specific answer is here
http://winrichman.blogspot.com/2008/09/dynamic-column.html
but these link let you know, how to do
http://winrichman.blogspot.com/search/label/Dynamic%20column
http://winrichman.blogspot.com/search/label/Cross-tab
http://winrichman.blogspot.com/search/label/cross%20tab -
Display table with variable number of columns
Hello Forum,
I'm trying to build an export view of User Management Engine data. I would like to output a table with one row for every user with yes / no fields indicating membership in each of the available groups. Because the number of available groups might change in the future, I can't hardcode the column names for the groups.
That is, I call a webservice to compute a table, and I get back a table with a variable number of columns.
When I try to insert the webservice into my VC model, it complains:
"Port 'Response' was omitted because it includes nested tables, which are not presently supported by Visual Composer"
You might be interested to know that the business method of my webservice (for testing purposes) looks as follows:
public String[][] getVariableSizeArray() {
String[][] ret = new String[10][];
for (int i = 1; i <= 10; i++) {
ret<i> = new String[10];
for (int j = 1; j <= 10; j++) {
ret<i>[j] = Integer.toString(i * j);
return ret;
Any help is appreciated, and points will be awarded for helpful answers,
Sincerely,
Florian
Message was edited by:
Florian SomethingHi Florian,
dynamic data structures are not supported. You can do this with a workaround. If you know the maximum count of your columns then you can add them to the table and hide/unhide them dynamicly via a formula in the hidden condition. Of course in your WS you als need a fix structure of your columns.
This is not the best solution, I know so far, but it works. This is just one limit of VC.
Best Regards,
Marcel -
How create table with variable number of columns?
I am creating table data in Java. Number of columns is variable. How I can write <table> in UIX.
Here is code of one of my unsuccessful attempt:
<provider>
<!- get table data like DataObjectList-->
<data name="ReportTableData">
<method class="app.ReportTableData" method="getTableData"/>
</data>
<!- get names of columns like DataObjectList-->
<data name="ColumnNames">
<method class="app.ReportTableData" method="getColumnNames"/>
</data>
</provider>
<table data:tableData="@ReportTableData">
<contents data:childData="@ColumnNames">
<text data:text="nameColumn"/>
</contents>
</table>
I hoped that I can get cell data by key, where key is name of column. But cells of table contain only names of columns.
Please help me, where I mistaken?
Thank you.Hi Sergey,
The UIX table implementation relies on a childData like mechanism internally to iterate over the rows. For instance, when you databind the text attribute of the UINode used to stamp out each column, you are relying on the uix:table iterating over the table data using the data object for the current row when evaluating your column stamp.
Setting the data:childData attribute on the table's contents element conflicts with UIX's internal iteration over the tableData. For this reason, we don't support specifying a dynamic number of table columns in UIX XML.
This doesn't mean that you can't do it, there are different strategies. If you've got a finite and known set of columns, you can specify each possible column and then databind the rendered attribute of each one to hide and show it as appropriate. Another, often cleaner approach, is to build this subtree of UINodes in Java code. -
Generating table with large number of columns (256)
Hi,
I don't know if this is right place for posting this:
for data mining purposes I need a table which column names needs to be size N, where N is 2, 3 or 4. Column name is build upon alphabet of nucleotids A,C,T,G and all variations with repetition. For N=2, columns are: AA, AC, AT, AG, CA, CC, CT, CG, TA, TC, TT, TG, GA, GC, GT, GG (4^2 = 16). For N=3, 4^3 = 64, and for N=4 4^4 = 256.
Primary key in table is array of nucleotids, and values in previously mentioned columns for each nucleotid array are 1 or 0, based on that if such nucleotid of size N exists in that chain or not.
My questions are:
1) is there any tool (in Oracle Data Miner or whatever) which can generate such table from array of nucleotids (one array of nucleotids is ordinary string)?
2) It's not a problem to generate this table myself but is it "normal" to have database table with 257 columns (when N = 4)?
I hope that my problem is clear (because of my English).
Thanks in advance.
Regards.Without knowing the reason for doing so, I would guess, this kind of design is quite poor.
How are you planning to specify your queries? (I do know dynamic SQL would be a possibility ...).
Another point of view:
What if someone decides to have column names built using 5 nucleotids? This would exceed the maximum number of columns of a table which currently (10g, 11g) is 1000? -
Alv report with varying number of columns
hi all,
I am new to abap. I am writing this to get a brief idea of what i wanted to do in system.
I have to do a report using alv. The format of the report looks like this.
acc no acc. name amt_sum_april amt_sum_may amt_sum_june. ............. total_months
the colum amt_sum_ depends on user input period(month interval).
if the user selects 4 to 6 = 3 columns ,if the user selects 4 to 10 = 7 columns
so on.......
Anyone have idea how to do it, because in the
initial structure or itab, the number of columns depends on the user input.. i am stucking here ...
pls help.
thanks and regards
joseHi friend,
It's very complicated to do that, I'm sure there's a way to do it but I really don't know it. Once I had a similar requirement and I did something else that solved my problem without making a fussy complicated code. I added a colum MONTH or PERIOD (depending on your requirement) and then I make a subtotal by that column. So you need:
acc no acc. name amt_sum_april amt_sum_may amt_sum_june. ............. total_months
Now you would have:
acc no acc. name month amount
In the SORT table, in the sorting condition by MONTH you specify SUBTOTAL = 'X'. So the output will be:
acc no acc. name month amount
123123 John 2 100.00
123124 Paul 2 200.00
Month 2 300.00
123123 John 3 300.00
123124 Paul 3 400.00
123125 Jane 3 100.00
Month 3 800.00
123123 John 4 123.54
Month 4 123.54
Total 1223.54
You can change the subtotal text for a more adequate one (if you want). Also if you only need the subtotals you can specify in the layout that only those lines are to be output.
I hope I've helped, I you have any question let me know!
Regards,
Pablo -
Tables with varying columns imported from XML
Hi,
I have an XML file for a product catalog. Each product has Name, SKU, Image, Description and a Table with some data in it. Each table is different is size, varying number of columns and rows.
I have anchored objects for some of the elements like Image or SKU in my template.
When I load the XML I check 'Clone repeating elements' upon import so I can maintain the various anchored frames for my elements. However it breaks the tables. It appears that each new table is trying to copy the previous table's exact number of rows and columns. If I uncheck this option then I get the tables in right but I lose the rest of the formatting.
Any idea how I can handle this?
Thanks,
LukeLuke,
We had the same problem doing a table of data that had varying columns and rows. For us, this was handled by adding table information such as cell width and cellstyle on the incoming XML (generated through a backend system that was also gathering the data into XML files, through using xml templates). We found that placeholder tables were not an option if you wanted the columns to be flexible, so instead the tables were being built by the XML.
If you are not using a backend system or don't have a way to customize the incoming data, I think you may be able to use XSLT as an intermediate way to apply more information to the XML (cell widths, etc) I am copying dummy tables below to show how the XML we used looked coming into the Indesign document. This code would all be contained within opening and closing "Root" tags in the XML. There are 3 separate tables (one called Summary, one actually called Table and one called Legend), each with its own cell widths and number of rows. The data container holds all tables, and a table growing in length will push the next table down on the page (or to the next page).
Note that each table has a different tag (name), but is described as a table through the information contained in its opening tag's attributes. We also used both namespaces (4.0 and 5.0) to take advantage of cellstyle as well as pstyle tags in the table body, allowing each cell and copy block to be styled differently when needed.
<data>
<Summary xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="2">
<Cell aid:table="cell" aid:ccolwidth="200" aid:theader="" aid:ccols="1" aid:crows="1" aid5:cellstyle="myHighlightCellstyle" aid:pstyle="myBoldParagraphStyle">A brand<superScript>®</superScript> statement</Cell>
<Cell aid:table="cell" aid:ccolwidth="130" aid:ccols="1" aid:crows="1" aid5:cellstyle="myHighlightCellstyle" aid:pstyle="myTextParagraphStyle">More info beside the brand</Cell>
</Summary>
<Table xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="3" aid:tcols="4">
<Cell aid:table="cell" aid:ccolwidth="95" aid:theader="" aid:crows="1" aid:ccols="1" aid5:cellstyle="headerCell" aid:pstyle="headerCellP">Brand</Cell>
<Cell aid:table="cell" aid:ccolwidth="95" aid:theader="" aid:crows="1" aid:ccols="1" aid5:cellstyle="headerCell" aid:pstyle="headerCellP">Product Name</Cell>
<Cell aid:table="cell" aid:ccolwidth="70" aid:theader="" aid:crows="1" aid:ccols="1" aid5:cellstyle="headerCell" aid:pstyle="headerCellP">Price</Cell>
<Cell aid:table="cell" aid:ccolwidth="70" aid:theader="" aid:crows="1" aid:ccols="1" aid5:cellstyle="headerCell" aid:pstyle="headerCellP">Details</Cell>
<Cell aid:table="cell" aid:ccolwidth="95" aid:crows="1" aid:ccols="1" aid5:cellstyle="regularCell" aid:pstyle="regularCellP">Acme</Cell>
<Cell aid:table="cell" aid:ccolwidth="95" aid:crows="1" aid:ccols="1" aid5:cellstyle="regularCell" aid:pstyle="regularCellP">Widget</Cell>
<Cell aid:table="cell" aid:ccolwidth="70" aid:crows="1" aid:ccols="1" aid5:cellstyle="regularCell" aid:pstyle="regularCellP">$9.99</Cell>
<Cell aid:table="cell" aid:ccolwidth="70" aid:crows="1" aid:ccols="1" aid5:cellstyle="regularCell" aid:pstyle="regularCellP"><Image href="file:///Users/administrator/Desktop/images/widget.tif"></Image></Cell>
<Cell aid:table="cell" aid:ccolwidth="95" aid:crows="1" aid:ccols="1" aid5:cellstyle="accentCell" aid:pstyle="accentCellP">Smiles Inc</Cell>
<Cell aid:table="cell" aid:ccolwidth="95" aid:crows="1" aid:ccols="1" aid5:cellstyle="accentCell" aid:pstyle="accentCellP">Happy Widget</Cell>
<Cell aid:table="cell" aid:ccolwidth="70" aid:crows="1" aid:ccols="1" aid5:cellstyle="accentCell" aid:pstyle="accentCellP">$11.99</Cell>
<Cell aid:table="cell" aid:ccolwidth="70" aid:crows="1" aid:ccols="1" aid5:cellstyle="accentCell" aid:pstyle="accentCellP"><Image href="file:///Users/administrator/Desktop/images/widget.tif"></Cell>
</Table>
<Legend xmlns:aid="http://ns.adobe.com/AdobeInDesign/4.0/" xmlns:aid5="http://ns.adobe.com/AdobeInDesign/5.0/" aid:table="table" aid:trows="1" aid:tcols="1">
<Cell aid:table="cell" aid:ccolwidth="330.0" aid:crows="1" aid:ccols="1" aid5:cellstyle="legendCell" aid:pstyle="legendCellP">Table legend, or other instruction/info below the table go here.</Cell>
</Legend>
</data> -
Table with more than 35 columns
Hello All.
How can one work with a table with more than 35 columns
on JDev 9.0.3.3?
My other question is related to this.
Setting Entities's Beans properties from a Session Bean
bought up the error, but when setting from inside the EJB,
the bug stays clear.
Is this right?
Thank youThank you all for reply.
Here's my problem:
I have an AS400/DB2 Database, a huge and an old one.
There is many COBOL Programs used to communicate with this DB.
My project is to transfer the database with the same structure and the same contents to a Linux/ORACLE System.
I will not remake the COBOL Programs. I will use the existing one on the Linux System.
So the tables of the new DB should be the same as the old one.
That’s why I can not make a relational DB. I have to make an exact migration.
Unfortunately I have some tables with more than 5000 COLUMNS.
Now my question is:
can I modify the parameters of the ORACE DB to make it accept Tables and Views with more than 1000 columns, If not, is it possible to make a PL/SQL Function that simulate a table, this function will insert/update/select data from many other small tables (<1000 columns). I want to say a method that make the ORACLE DB acting like if it has a table with a huge number of columns;
I know it's crazy but any idea please. -
Internal table with variable no of columns
Hi All,
I have to create an internal table with some fixed columns and rest of the table should be dynamic. The total no of columns depends on a field of some other table. hence, the number of columns of the table are unknown. How to create such a table.
Thanks,
NehaExecute this program .. we will get a fair idea about how the dyanmic column are populated in the table. Based on that u can write ur sceond table with 92 columns
*& Report ZTEST009
REPORT ztest009 NO STANDARD PAGE HEADING LINE-SIZE 60 LINE-COUNT 2(1).
TYPE-POOLS : slis.
TYPES : BEGIN OF internal,
matnr(18),
werks(4),
qtyn(20),
desc(20) TYPE c,
qty TYPE i,
END OF internal.
DATA : it TYPE TABLE OF internal,
wa TYPE internal.
DATA : fieldcat TYPE lvc_t_fcat,
lcat TYPE lvc_s_fcat,
final_cat TYPE slis_t_fieldcat_alv,
fcat TYPE slis_fieldcat_alv,
top TYPE slis_t_listheader,
events TYPE slis_t_event,
layout TYPE slis_layout_alv.
DATA : newfield TYPE REF TO data,
newdata TYPE REF TO data.
FIELD-SYMBOLS : <fs1>,
<dynamic_value>,
<dynamic_cat> TYPE STANDARD TABLE.
START-OF-SELECTION.
PERFORM popudate.
PERFORM buildcat.
PERFORM loadata.
PERFORM events USING events.
PERFORM header USING top.
PERFORM layout.
END-OF-SELECTION.
PERFORM display.
*& Form popudate
text
--> p1 text
<-- p2 text
FORM popudate .
DEFINE popu.
wa-matnr = &1.
wa-werks = &2.
wa-qtyn = &3.
wa-desc = &4.
wa-qty = &5.
append wa to it.
clear wa.
END-OF-DEFINITION.
popu 'material1' 'pla1' 'QTY1' 'quantity1' 100.
popu 'material1' 'pla1' 'QTY2' 'quantity2' 200.
popu 'material1' 'pla1' 'QTY3' 'quantity3' 300.
popu 'material2' 'pla2' 'QTY1' 'quantity1' 400.
popu 'material2' 'pla2' 'QTY2' 'quantity2' 500.
popu 'material2' 'pla2' 'QTY3' 'quantity3' 600.
popu 'material3' 'pla3' 'QTY1' 'quantity1' 700.
popu 'material3' 'pla3' 'QTY2' 'quantity2' 400.
SORT it BY matnr.
ENDFORM. " popudate
*& Form buildcat
text
--> p1 text
<-- p2 text
FORM buildcat .
lcat-fieldname = 'MATNR'.
lcat-datatype = 'CHAR'.
lcat-seltext = 'Material'.
lcat-intlen = 18.
APPEND lcat TO fieldcat.
CLEAR lcat.
lcat-fieldname = 'WERKS'.
lcat-datatype = 'CHAR'.
lcat-seltext = 'Plant'.
lcat-intlen = 4.
APPEND lcat TO fieldcat.
CLEAR lcat.
LOOP AT it INTO wa.
READ TABLE fieldcat INTO lcat WITH KEY fieldname = wa-qtyn.
IF sy-subrc <> 0.
lcat-fieldname = wa-qtyn.
lcat-datatype = 'CHAR'.
lcat-seltext = wa-desc.
lcat-intlen = 10.
APPEND lcat TO fieldcat.
CLEAR lcat.
ENDIF.
ENDLOOP.
CLEAR lcat.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
i_style_table =
it_fieldcatalog = fieldcat
i_length_in_byte =
IMPORTING
ep_table = newfield
e_style_fname =
EXCEPTIONS
generate_subpool_dir_full = 1
others = 2
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ASSIGN newfield->* TO <dynamic_cat>.
CREATE DATA newdata LIKE LINE OF <dynamic_cat>.
ASSIGN newdata->* TO <dynamic_value>.
ENDFORM. " buildcat
*& Form loadata
text
--> p1 text
<-- p2 text
FORM loadata .
DATA flag TYPE i.
LOOP AT it INTO wa.
flag = 0.
ASSIGN COMPONENT 'MATNR' OF STRUCTURE <dynamic_value> TO <fs1>.
<fs1> = wa-matnr.
ASSIGN COMPONENT 'WERKS' OF STRUCTURE <dynamic_value> TO <fs1>.
<fs1> = wa-werks.
CALL FUNCTION 'AIPC_CONVERT_TO_UPPERCASE'
EXPORTING
i_input = wa-qtyn
i_langu = sy-langu
IMPORTING
e_output = wa-qtyn.
ASSIGN COMPONENT wa-qtyn OF STRUCTURE <dynamic_value> TO <fs1>.
<fs1> = wa-qty.
AT END OF matnr.
APPEND <dynamic_value> TO <dynamic_cat>.
CLEAR : <dynamic_value>.
ENDAT.
CLEAR : wa.
ENDLOOP.
ENDFORM. " loadata
**& Form display
text
--> p1 text
<-- p2 text
FORM display .
LOOP AT fieldcat INTO lcat.
fcat-fieldname = lcat-fieldname.
fcat-outputlen = lcat-intlen.
fcat-seltext_l = lcat-seltext.
APPEND fcat TO final_cat.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
I_CALLBACK_PF_STATUS_SET = ' '
I_CALLBACK_USER_COMMAND = ' '
is_layout = layout
it_fieldcat = final_cat
IT_SORT =
I_SAVE = ' '
IS_VARIANT =
it_events = events
TABLES
t_outtab = <dynamic_cat>
ENDFORM. " display
Regards,
Aswin. -
Row chaining in table with more than 255 columns
Hi,
I have a table with 1000 columns.
I saw the following citation: "Any table with more then 255 columns will have chained
rows (we break really wide tables up)."
If I insert a row populated with only the first 3 columns (the others are null), is a row chaining occurred?
I tried to insert a row described above and no row chaining occurred.
As I understand, a row chaining occurs in a table with 1000 columns only when the populated data increases
the block size OR when more than 255 columns are populated. Am I right?
Thanks
dyahavuser10952094 wrote:
Hi,
I have a table with 1000 columns.
I saw the following citation: "Any table with more then 255 columns will have chained
rows (we break really wide tables up)."
If I insert a row populated with only the first 3 columns (the others are null), is a row chaining occurred?
I tried to insert a row described above and no row chaining occurred.
As I understand, a row chaining occurs in a table with 1000 columns only when the populated data increases
the block size OR when more than 255 columns are populated. Am I right?
Thanks
dyahavYesterday, I stated this on the forum "Tables with more than 255 columns will always have chained rows." My statement needs clarification. It was based on the following:
http://download.oracle.com/docs/cd/B28359_01/server.111/b28318/schema.htm#i4383
"Oracle Database can only store 255 columns in a row piece. Thus, if you insert a row into a table that has 1000 columns, then the database creates 4 row pieces, typically chained over multiple blocks."
And this paraphrase from "Practical Oracle 8i":
V$SYSSTAT will show increasing values for CONTINUED ROW FETCH as table rows are read for tables containing more than 255 columns.
Related information may also be found here:
http://download.oracle.com/docs/cd/B10501_01/server.920/a96524/c11schem.htm
"When a table has more than 255 columns, rows that have data after the 255th column are likely to be chained within the same block. This is called intra-block chaining. A chained row's pieces are chained together using the rowids of the pieces. With intra-block chaining, users receive all the data in the same block. If the row fits in the block, users do not see an effect in I/O performance, because no extra I/O operation is required to retrieve the rest of the row."
http://download.oracle.com/docs/html/B14340_01/data.htm
"For a table with several columns, the key question to consider is the (average) row length, not the number of columns. Having more than 255 columns in a table built with a smaller block size typically results in intrablock chaining.
Oracle stores multiple row pieces in the same block, but the overhead to maintain the column information is minimal as long as all row pieces fit in a single data block. If the rows don't fit in a single data block, you may consider using a larger database block size (or use multiple block sizes in the same database). "
Why not a test case?
Create a test table named T4 with 1000 columns.
With the table created, insert 1,000 rows into the table, populating the first 257 columns each with a random 3 byte string which should result in an average row length of about 771 bytes.
SPOOL C:\TESTME.TXT
SELECT
SN.NAME,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
INSERT INTO T4 (
COL1,
COL2,
COL3,
COL255,
COL256,
COL257)
SELECT
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3)
FROM
DUAL
CONNECT BY
LEVEL<=1000;
SELECT
SN.NAME,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
SET AUTOTRACE TRACEONLY STATISTICS
SELECT
FROM
T4;
SET AUTOTRACE OFF
SELECT
SN.NAME,
SN.STATISTIC#,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
SPOOL OFFWhat are the results of the above?
Before the insert:
NAME VALUE
table fetch continue 166
After the insert:
NAME VALUE
table fetch continue 166
After the select:
NAME STATISTIC# VALUE
table fetch continue 252 332 Another test, this time with an average row length of about 12 bytes:
DELETE FROM T4;
COMMIT;
SPOOL C:\TESTME2.TXT
SELECT
SN.NAME,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
INSERT INTO T4 (
COL1,
COL256,
COL257,
COL999)
SELECT
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3)
FROM
DUAL
CONNECT BY
LEVEL<=100000;
SELECT
SN.NAME,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
SET AUTOTRACE TRACEONLY STATISTICS
SELECT
FROM
T4;
SET AUTOTRACE OFF
SELECT
SN.NAME,
SN.STATISTIC#,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
SPOOL OFFWith 100,000 rows each containing about 12 bytes, what should the 'table fetch continued row' statistic show?
Before the insert:
NAME VALUE
table fetch continue 332
After the insert:
NAME VALUE
table fetch continue 332
After the select:
NAME STATISTIC# VALUE
table fetch continue 252 33695The final test only inserts data into the first 4 columns:
DELETE FROM T4;
COMMIT;
SPOOL C:\TESTME3.TXT
SELECT
SN.NAME,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
INSERT INTO T4 (
COL1,
COL2,
COL3,
COL4)
SELECT
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3),
DBMS_RANDOM.STRING('A',3)
FROM
DUAL
CONNECT BY
LEVEL<=100000;
SELECT
SN.NAME,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
SET AUTOTRACE TRACEONLY STATISTICS
SELECT
FROM
T4;
SET AUTOTRACE OFF
SELECT
SN.NAME,
SN.STATISTIC#,
MS.VALUE
FROM
V$MYSTAT MS,
V$STATNAME SN
WHERE
SN.NAME = 'table fetch continued row'
AND SN.STATISTIC#=MS.STATISTIC#;
SPOOL OFFWhat should the 'table fetch continued row' show?
Before the insert:
NAME VALUE
table fetch continue 33695
After the insert:
NAME VALUE
table fetch continue 33695
After the select:
NAME STATISTIC# VALUE
table fetch continue 252 33695 My statement "Tables with more than 255 columns will always have chained rows." needs to be clarified:
"Tables with more than 255 columns will always have chained rows +(row pieces)+ if a column beyond column 255 is used, but the 'table fetch continued row' statistic +may+ only increase in value if the remaining row pieces are found in a different block."
Charles Hooper
IT Manager/Oracle DBA
K&M Machine-Fabricating, Inc.
Edited by: Charles Hooper on Aug 5, 2009 9:52 AM
Paraphrase misspelled the view name "V$SYSSTAT", corrected a couple minor typos, and changed "will" to "may" in the closing paragraph as this appears to be the behavior based on the test case. -
Can I create a table with more than 40 columns ?
Hello,
I need to organize my work with a table and need about 66 columns. I am not very good with Numbers but I know a little bit of Pages. I cannot find a way to create a table with more than 40 columns... Is it hopeless ? (Pages '08 v. 3.0.3)
Thank you allIt's never too late to try to teach users that the Search feature is not only for helpers.
The number of columns allowed in Numbers is not a relevant value when the question is about Pages '08 tables.
I tried to copy a 256 columns Numbers table into a Pages '09 document.
I didn't got a table but values separated by TABs.
I tried to convert this text range in a table and got this clear message :
If I remember well, in Pages '08, the limit is 40 columns.
It seems that you are a specialist of inaccurate responses, but I'm not a moderator so I'm not allowed to urtge you to double check what you wrote before posting.
Yvan KOENIG (VALLAURIS, France) vendredi 29 avril 2011 14:57:58
Please :
Search for questions similar to your own before submitting them to the community
Maybe you are looking for
-
Search Help for Vendor Feild not getting populated in the Screen Element
Hi Everyone, In transaction Miro, I get a POP-UP for Invoicing Party i.e. Vendor and Users required a custom search help. The Search help for Vendor(LIFNR) is KRED_C and i appended a Z search help under this. Now that the search help exists and I can
-
Reception problems with iPhone 3GS after upgrading to iOS 4.2.1
AFter upgrading to 4.2.1, my 3GS iPhone is experiencing bad signal, bad quality and frequent disconnections. This was repeated even after my provider replaced my device to a different 3GS device, running 4.2.1. inserting my SIM card to a NOKIA phone,
-
"iTunes has stopped working" blue Vista error screen.
have had iTunes for years, recently tried to open it and was told that iTunes has stopped working despite not having been open. i've tried: searching online for a problem, sending the info to windows, uninstalling and then reinstalling it, "repairing
-
I am running 10.8.4 with contacts 7.1 (1170). I find I can't drag cards from one (any) group to another group. When I restart it shows the card and indicates that it should accept it as it isn't in that group. But doesn't move cards. Then it no l
-
Two problems with displaying images in JPanel
Hi, I need to display some small rectangular images inside a JPanel. These images also need to be componenents as they will have listeners associated with them. I have never had any experience with images, so I might totally be down the wrong path. I