Append a line to a dynamic table in a dynamic structure
Hello,
i've created a dynamic structure <ls_itab> TYPE ANY.
This structure contains a deep structure name 'CELLSTYLES' of type lvc_t_styl.
Now i want to add a line to the deep structure CELLSTYLES.
I'll tried something like this:
data: <ld_fld> TYPE ANY,
<ls_itab> TYPE ANY.
ASSIGN COMPONENT 'CELLSTYLES' OF STRUCTURE <ls_itab> TO <ld_fld>.
But i can't append line to <ld_fld> because it's no internaltable.
Please help.
Best regards,
TomSd
Hi Thomas,
Put this code at declaration.
FIELD-SYMBOLS: <L_TABLE> TYPE STANDARD TABLE.
Here Append will not work; after the code you have written use.
INSERT <ls_itab> INTO TABLE <L_TABLE>.
Hope it will solve ur problem.
Regards
Krishnendu
Similar Messages
-
Here's how to use DYNAMIC tables for almost any structure (4.6C onwards)
Hi guys
I'm describing a feature here that has been around since 4.6C that is not really well known but can really simplfy programming where you need to get data into some sort of internal table and then display it either as a classical list or as al ALV grid.
This feature is RTTI which allows you to retrieve your structure, build a dynamic FCAT (Field catalog) and a Dynamic table.
Here's a really quick little program which reads 200 entries from VAPMA into a dynamic table. Any structure will work if you use the code sample shown.
To pass it to an ALV GRID is then really simple as you've already got the Field Catalog, Table and Data.
The method I'm showing below will work for almost ANY structure you care to name whether or not the fields are in the data dictionary.
I create a dynamic FCAT and dynamic table based on the FCAT and then populate it.
You can create field catalogs dynamically quite simply by using the new RTTI facility available from 4.6C onwards.
(From here it's only a small step to dynamic tables and EASY ALV grid displays)
Example to create dynamic FCAT and table and populate it with 200 entries from VAPMA
PROGRAM ZZ_BUILD_FLDCATALOG.
tables: vapma.
Define any structure
types: begin of s_elements,
vbeln type vapma-vbeln,
posnr type vapma-posnr,
matnr type vapma-matnr,
kunnr type vapma-kunnr,
werks type vapma-werks,
vkorg type vapma-vkorg,
vkbur type vapma-vkbur,
status type c,
end of s_elements.
end of your structure
data lr_rtti_struc type ref to cl_abap_structdescr .
data:
zog like line of lr_rtti_struc->components .
data:
zogt like table of zog,
wa_it_fldcat type lvc_s_fcat,
it_fldcat type lvc_t_fcat ,
dy_line type ref to data,
dy_table type ref to data.
data: dref type ref to data.
field-symbols: <fs> type any,
<dyn_table> type standard table,
<dyn_wa>.
*now I want to build a field catalog
*First get your data structure into a field symbol
create data dref type s_elements.
assign dref->* to <fs>.
lr_rtti_struc ?= cl_abap_structdescr=>describe_by_data( <fs> ).
zogt[] = lr_rtti_struc->components.
Now build the field catalog. zogt has the structure in it from RTTI.
loop at zogt into zog.
clear wa_it_fldcat.
wa_it_fldcat-fieldname = zog-name .
wa_it_fldcat-datatype = zog-type_kind.
wa_it_fldcat-inttype = zog-type_kind.
wa_it_fldcat-intlen = zog-length.
wa_it_fldcat-decimals = zog-decimals.
wa_it_fldcat-coltext = zog-name.
wa_it_fldcat-lowercase = 'X'.
append wa_it_fldcat to it_fldcat .
endloop.
Let's create a dynamic table and populate it
call method cl_alv_table_create=>create_dynamic_table
exporting
it_fieldcatalog = it_fldcat
importing
ep_table = dy_table.
assign dy_table->* to <dyn_table>.
create data dy_line like line of <dyn_table>.
assign dy_line->* to <dyn_wa>.
select vbeln posnr matnr kunnr werks vkorg vkbur
up to 200 rows
from vapma
into corresponding fields of table <dyn_table>.
from here you can pass your table to a GRID for display etc etc.
Cheers
JimboThanks for the info.
I went to their web site and also Googled.
I found a great review on their photographer's books on nikonians.org
They use an HP/Indigo Ultrastream 3000 digital offset press for all hardcover books, which is GREAT!
I did sign up and requested the 45 day trial "photographer" account.
I am curious if Shared Ink offers a size that matches the ONLY current book size from Aperture, the odd 8.5x11.
In the above review, I saw that Shared Ink offers a 12x12 book.. very nice! Except you will need to design that one in CS2
So then, all that Apple really needs to do is simply add the ability to select/create custom book sizes. Then we don't need a printing service from Apple, as there are plenty of options out there, and more arriving on the market each month! -
Issues in populating dynamic table with other dynamic table records
Hi Experts,
I have a Problem here ,i need to move the records of one table into other.
Through the following code..am able to append the records ,
but there are no values in it.
FIELD-SYMBOLS:<lt_data> TYPE ANY TABLE.
FIELD-SYMBOLS:<itab_wa2> TYPE ANY.
LOOP AT <lt_data> ASSIGNING <itab_wa>.
DO lv_count TIMES.
ASSIGN COMPONENT sy-index OF STRUCTURE <itab_wa> TO <itab_wa1>.
ENDDO.
APPEND <itab_wa1> to <itab>.
help is appreciated>
Vadnalav wrote:
> Yeah the structures of both the tables are same.. referred to TYPE ANY
TYPE ANY is not a structure mate!
Anyway let me rephrase my question: Are the "run-time" structures of the 2 dynamic tables similar?
BR,
Suhas -
How to create a dynamic table region with dynamic VO
Hi All,
I have a requirement to create a dynamic table region with a dynamic VO.
I need this because at runtime only the user will select the table name. So based on that table name, i have to create a table region to display the records.
I already created a dynamic VO. Could anyone share the code for dynamic table region creation.
Thanks in Advance.
Thanks and Regards,
MyvizhiHi All,
I have a requirement to create a dynamic table region with a dynamic VO.
I need this because at runtime only the user will select the table name. So based on that table name, i have to create a table region to display the records.
I already created a dynamic VO. Could anyone share the code for dynamic table region creation.
Thanks in Advance.
Thanks and Regards,
Myvizhi -
How to create a dynamic table region with dynamic VO in processFormRequest
Hi All,
I have a requirement to create a dynamic table region with a dynamic VO.
I need this because at runtime only the user will select the table name. So based on that table name, i have to create a table region to display the records.
I already created a dynamic VO. Could anyone share the code for dynamic table region creation.
Thanks in Advance.
Thanks and Regards,
Myvizhi
Edited by: Myvizhi Selvi on May 20, 2013 6:21 PMHi,
You can use following sample code to create advance table columns dynamically with colum groups as well.
It assumes that you have already created advance table with ID EmpTblRN.
Below code returns column heading dynamically and if you keep your VO column names and attributes
same in all the cases (COL1, COL2.....) then you can easily use a loop to create advance table columns.
It is attaching VO attributes to OAMessageStyledText bean in the last.
Hope it helps.
OAAdvancedTableBean advTable = (OAAdvancedTableBean)webBean.findChildRecursive("EmpTblRN");
Serializable [] param = {currentWindowSeq.toString()};
Datum[] colHeadingArray = (Datum[])am.invokeMethod("getColumnHeading", param);
String oldGrpName = null;
String newGrpName = null;
OAColumnGroupBean columnGroup = null;
DictionaryData columnFormat = new DictionaryData();
columnFormat.put(WIDTH_KEY, "4%");
for (int i = 0; i < colHeadingArray.length; i++)
try
oracle.sql.STRUCT os = (oracle.sql.STRUCT)colHeadingArray;
Object[] colHeadAttr = os.getAttributes();
newGrpName = (String)colHeadAttr[0];
if(newGrpName!=null)
if(!newGrpName.equals(oldGrpName))
// Create a column group, create the set the column header,
// and add the column group under the advanced table
columnGroup = (OAColumnGroupBean)createWebBean(pageContext, COLUMN_GROUP_BEAN, null, "ColGroup"+i);
OASortableHeaderBean columnGroupHeader = (OASortableHeaderBean)createWebBean(pageContext, SORTABLE_HEADER_BEAN, null, "ColGroupHeader"+i);
columnGroupHeader.setText(newGrpName);
// Retrieve from message dictionary
columnGroup.setColumnHeader(columnGroupHeader);
advTable.addIndexedChild(columnGroup);
oldGrpName = newGrpName;
// Create a column, create the set the column header, and add the column
// under the column group
OAColumnBean column1 = (OAColumnBean)createWebBean(pageContext, COLUMN_BEAN, null, "Column"+i);
OASortableHeaderBean column1Header = (OASortableHeaderBean)createWebBean(pageContext, SORTABLE_HEADER_BEAN, null, "Column1Header"+i);
column1Header.setText(colHeadAttr[1].toString());
column1.setColumnHeader(column1Header);
column1.setColumnFormat(columnFormat);
columnGroup.addIndexedChild(column1);
// Create the actual leaf item under the first column
OAMessageStyledTextBean leaf1 = (OAMessageStyledTextBean)createWebBean(pageContext, MESSAGE_STYLED_TEXT_BEAN, null, "Leaf"+i);
//OARawTextBean leaf1 = (OARawTextBean)createWebBean(pageContext, RAW_TEXT_BEAN, null, "Leaf"+i);
leaf1.setViewAttributeName("Week"+(i+1));
String destination = "OA.jsp?page=/xxqc/oracle/apps/per/leaveadvance/webui/EmployeeLeaveDetailPG&personId={@PersonId}";
destination = destination + "&startDate="+colHeadAttr[1].toString()+"-"+(String)colHeadAttr[0];
destination = destination + "&addBreadCrumb=Y&retainAM=Y";
leaf1.setDestination(destination);
OADataBoundValueViewObject cssjob = new OADataBoundValueViewObject(leaf1,"Color"+(i+1));
//leaf1.setAttributeValue(oracle.cabo.ui.UIConstants.STYLE_CLASS_ATTR, cssjob);
leaf1.setAttributeValue(UIConstants.RENDERED_ATTR, cssjob);
column1.addIndexedChild(leaf1);
catch(Exception e)
System.out.println("e"+e); -
Alternatives to dynamic tables for displaying dynamic data
What methods are available for displaying data from MySQL
with PHP on a web page? Is there any alternative to a dynamic table
when the the quantity of data will vary? anything CSS based?
Many ThanksOn 27 May 2006 in macromedia.dreamweaver, Pingus mum wrote:
> so i could just output to a div for example?
Or a paragraph, or an <h4>, or an unordered list, or
any other container
tag, or the src attribute on an <img> tag, or any
combination of the
above. Consider the case where the database consists of press
releases -
date, headline, body. You could, say, make the repeat region
like this:
<h1>Press Releases</h1>
<!-- start of repeat region -->
<h2><& headlineFromDatabase &></h2>
<p><& dateFromDatabase &> - <&
bodyFromDatabase &></p>
<!-- end of repeat region -->
<address>Contact Information</address>
Joe Makowiec
http://makowiec.net/
Email:
http://makowiec.net/email.php -
Dynamic table names without dynamic sql?
I am trying to figure out a way to use table names as variables without using dynamic sql.
So for instance, I have...
execute immediate 'INSERT INTO '||vTABLE||' VALUES ('test')';
and
execute immediate 'INSERT INTO TABLE1 SELECT * FROM '||vTable;
Is there any other way to do these without the dynamic sql in Oracle 10.2g?I am trying to figure out a way to use table names as variables without using dynamic sql. Well I guess it makes a change from perpetual motion machines or cold fusion.
Are you doing this as a purely academic exercise or do you have something against dynamic SQL?
Cheers, APC
blog: http://radiofreetooting.blogspot.com -
Hello experts,
is it possible to call an ALV via ( class cl_salv or fm REUSE_ALV_GRID_DISPLAY) with a dynamic table?
This dynamic table has for example one fix column for the material number and dynamic colums for additional data.
One material has 1 additional column, the other material has two additional columns.
So i need an ALV with 3 columns material add_data1 add_data2 (add_data2 of material one is empty this is ok).
To build an itab which can handle this is possible i know.Hello Benjamin,
Maybe you already found a solution for this, but if not (or for others looking for a solution), here is a sample program that creates, fills, and displays a dynamic table:
report ztpar_dynamic_salv.
parameters: p_colnr type i default 3.
start-of-selection.
perform execute.
form execute.
data t_table type ref to data.
** create dynamic table
perform create_dynamic_table using p_colnr
changing t_table.
** fill dynamic table
perform fill_dynamic_table changing t_table.
** display dynamic table
perform display_table using t_table.
endform.
form create_dynamic_table using colnr type i
changing table type ref to data.
data: lo_field type ref to cl_abap_typedescr,
lo_struct type ref to cl_abap_structdescr,
lo_table type ref to cl_abap_tabledescr.
data: t_comp type cl_abap_structdescr=>component_table,
l_comp like line of t_comp.
lo_field ?= cl_abap_typedescr=>describe_by_name( 'CHAR10' ).
do p_colnr times.
move sy-index to l_comp-name.
concatenate 'COLUMN' l_comp-name into l_comp-name.
condense l_comp-name no-gaps.
l_comp-type ?= lo_field.
append l_comp to t_comp.
enddo.
lo_struct = cl_abap_structdescr=>create( p_components = t_comp p_strict = space ).
lo_table = cl_abap_tabledescr=>create( lo_struct ).
create data table type handle lo_table.
endform.
form fill_dynamic_table changing table type ref to data.
field-symbols: <fs_table> type standard table,
<fs_line> type any,
<fs_field> type any.
assign table->* to <fs_table>.
do 5 times.
append initial line to <fs_table> assigning <fs_line>.
do.
assign component sy-index of structure <fs_line> to <fs_field>.
if sy-subrc ne 0.
exit.
endif.
<fs_field> = sy-index.
enddo.
enddo.
endform.
form display_table using i_table type ref to data.
data lo_alv type ref to cl_salv_table.
field-symbols <fs_tab> type any table.
assign i_table->* to <fs_tab>.
try.
cl_salv_table=>factory(
importing
r_salv_table = lo_alv
changing
t_table = <fs_tab> ).
catch cx_salv_msg.
message 'Cannot display result!' type 'E'.
endtry.
lo_alv->display( ).
endform.
Best regards,
Tanguy -
Need to create a dynamic caption(column name) in a dynamic table
Hi All,
I have created dynamic table .But the dynamic column is not showing.I have created two column name that is name and empId .I have tried with following code
IWDCaption nameCap=(IWDCaption)view.createElement(IWDCaption.class,"nameCap");
nameCap.setText("Name");
tabColumn1.setHeader((IWDCaption)nameCap);
IWDCaption addCap=(IWDCaption)view.createElement(IWDCaption.class,"addCap");
addCap.setText("Address");
tabColumn2.setHeader((IWDCaption)addCap);
I m getting internal server error...But When i m comented the above code i can able to see tha dynamic table withput column name..Can anyone help me
SumanHi
IWDTableColumn tabColumn1 = (IWDTableColumn)view.createElement(IWDTableColumn.class,"N_Co");
IWDTableColumn tabColumn2 = (IWDTableColumn)view.createElement(IWDTableColumn.class,"A_Co");
IWDInputField nameText = (IWDInputField)view.createElement(IWDInputField.class,"N_Text");
nameText.bindValue(attrib1);
tabColumn1.setTableCellEditor((IWDTableCellEditor)nameText);
IWDInputField addText = (IWDInputField)view.createElement(IWDInputField.class,"A_Text");
addText.bindValue(attrib2);
tabColumn2.setTableCellEditor((IWDTableCellEditor)addText);
<b>I need to see the column name.....</b>
for that i have written the following code...
while writting the following code i m getting internal server error
IWDCaption nameCap = (IWDCaption)view.createElement(IWDCaption.class,"nameCap");
nameCap.setText("contribution_area");
tabColumn1.setHeader((IWDCaption)nameCap);
IWDCaption addCap=(IWDCaption)view.createElement(IWDCaption.class,"addCap");
addCap.setText("SUM");
tabColumn2.setHeader((IWDCaption)addCap); -
Create graph based on dynamic table data
Hi experts ;
i have JDeve Version 11.1.2.2.0 , i'm create dynamic table based on dynamic SQL query this query return by function in database by based on passing parameter .
My question :-
1- How create graph based on dynamic table and contral it at run time ?
Thanks & Best RegardsHi Mostafa,
You can retrieve the data from your sql query in a backing bean and pass it on to Graph using the setTabularData method.
Here is the javadoc for the setTabulardata method:
http://docs.oracle.com/cd/E16162_01/apirefs.1112/e17492/oracle/dss/dataView/CommonDataview.html#setTabularData%28java.util.List%29
Hope this helps
Katia -
Dynamic tables with data driven visibility of columns (XML).
Hi
I am trying to make a template in LiveCycle Designer (XDP) with a dynamic table, and with dynamic visibility of columns.
I want the column visibility to be driven by the xml input.
(There is no user input.)
I want the columns to visible in the table only if one or more of the rows has a data cell with value in a spesific column. If not the entire column should dissappear from the generated pdf.
If that is not possible, my alternative is so set a value in th XML file to hide a tables column. But how?
I have no problems of making dynamic tables, that is solved.
I only want to hide unused columns in a table, defined in the xml source file.
Can anyone help?
BorgeHi,
The link is not working..
Please provide a valid link. -
Hi to all,
I am using studio creator and mysql.
I created a Dynamic table for Emp Names and Emp Skills, in that table for Emp Skills i put Text Feild.I am getting text feild in my table.
here is my doubt
I am trying to implement the functionality of editing table cells when clicked/doubleclicked on it. I am trying to make the cells editable(textboxes) only after clicking/double clicking them. It should display static text otherwise.
I am trying to do this one in Javascript onClick event.
Any sample code I can refer to.Any help is highly appreciated.
help me
joHi friend,
Thanks for your kind reply.
what you have send is useful for static table, in static table we can bind any row.
But in my Module i am using Dynamic table, in that dynamic table for all the rows i need TextFeild.
when we open the page it has to show static text for all the cells and when we are clicking particular cell that Text feild has to open.
I dont no how to get Induival id for each and every cell, then only we can bind in dynamic table.
Any suggestions are welcome.
Jo -
I have searched for a bit in the forums and documentation for something like this, and have found nothing.
I would like to be able to have Dynamic table columns, with dynamic content in the table.
I would like the ability to add non-dynamic rows to the table, placed where I like them.
Does anyone know how to do this?I am creating a report that counts a number of events per hour, each day.
the layout will look like this:
0 1 2 3 4 5 6 7 total
day1 3 3 4 5 4 3 2 3 230
day2 4 3 2 3 4 2 3 4 235
day3 3 2 2 2 2 3 2 1 310
total 9 9 9 9 9 9 9 9 1393
The user must be able to select the range of days they can see (might be a week, might be a month, might be a year).
Also, the user can select the range of hours that they want visibile.
becaus they can select the number of hours, I need to be able to dynamically create the columns to the table, according to the user's selection.
The report is a very processor consuming report, as there are thousands of events per hour, so I want to trim the atcual data crunching to a minimum.
can anyone help with dynamic tables? -
Read dynamic field symbol Work Area before append to dynamic table
Hi experts:
I have a dynamic work area but before doing an append to the dynamic table, I need to do some validation on some fields of the work area in order to decide to append it or not, but I don't know how...
More or less this is the example
loop at so_kschl.
field = so_kschl-low.
if <t_dyntable>-field = 0. "if the value of this field in dinamic table is 0.
don't append
else.
APPEND <fs_dyntable> TO <t_dyntable>.
endif.
endloop.
Thank you very much for your help.
MiriamCheck this example, you read the component of the dynamic work area and assign it to a field-symbols. In this case, I validate that the entry is always 'a'.
DATA: i_lvc TYPE lvc_t_fcat WITH HEADER LINE,
i_table TYPE REF TO data,
l_style TYPE lvc_fname,
l_warea TYPE REF TO data,
l_name(7) VALUE 'VARCHAR'..
FIELD-SYMBOLS: <fs> TYPE table,
<fs2> TYPE ANY,
<fs3> TYPE ANY.
PARAMETERS p_char TYPE c LOWER CASE.
START-OF-SELECTION.
i_lvc-fieldname = 'Varchar'.
i_lvc-inttype = 'C'.
i_lvc-intlen = 1.
APPEND i_lvc.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = i_lvc[]
IMPORTING
ep_table = i_table
e_style_fname = l_style.
ASSIGN i_table->* TO <fs>.
CREATE DATA l_warea LIKE LINE OF <fs>.
ASSIGN l_warea->* TO <fs2>.
<fs2> = p_char.
ASSIGN COMPONENT l_name OF STRUCTURE <fs2> TO <fs3>.
IF <fs3> = 'a'.
WRITE: 'Component VARCHAR is a'.
* APPEND <fs2> TO <fs>.
ELSE.
WRITE: 'Component VARCHAR is not a'.
ENDIF. -
How to append to dynamic table
hi, everyone
I want to append some data to a dynamic internal table.
I have some code like following:
form dyna using itab.
DATA: NEW_LINE type ref to data.
FIELD-SYMBOLS: <FS_1> type any table,
<FS_2>,
<FS_3>.
assign itab to <FS_1>.
create data NEW_LINE like line of <FS_1>.
assign NEW_LINE->* to <FS_2>.
assign component 1 of structure <FS_2> to <FS_3>.
<FS_3> = 'I'.
assign component 2 of structure <FS_2> to <FS_3>.
<FS_3> = 'ABC'.
then <FS_2> is the entry I want to append now
append ???
endform.
What I want to know is how to append the <FS_2> to the dynamic table. I require the entry can be append, and return out of this form.
Any suggestion and answer is welcome
Hope your reply, thanks a lotHi,
try out like this.
data: begin of itab occurs 0,
val1 type c,
val2(3) type c,
end of itab.
data ws_itab like itab.
DATA: NEW_LINE type ref to data.
FIELD-SYMBOLS: <FS_1> type standard table,
<FS_2>,
<FS_3>.
assign itab[] to <FS_1>.
create data NEW_LINE like line of <FS_1>.
assign NEW_LINE->* to <FS_2>.
assign component 1 of structure <FS_2> to <FS_3>.
<FS_3> = 'I'.
assign component 2 of structure <FS_2> to <FS_3>.
<FS_3> = 'ABC'.
append <FS_2> to <FS_1>.
Regards,
Jagath
Maybe you are looking for
-
Need help - session and lost attribute...
Hi, We store some attributes in the session. In the web.xml we have session-timeout 20. (it's in minutes). If user use IE 5.5, and is inactive more than 1 minute, and then he send new request from browser (IE 5.5 or 5.0) to application running under
-
STILL can't burn DVDs on Mac OS 10.6.5 after trying everything
Hi there. Ever since I've updated to 10.6.5, I can't burn DVDs, doesn't matter which brand or what software I use. however, I am able to burn CDs. I went to my local Apple Store and they booted OS 10.6.3 on my computer via firewire and what d'you kno
-
Poor image quality from Interactive PDF
HELP! A logo that is placed in InDesign and exported as an Interactive PDF isn't displaying correctly. The client says it's corrupted when viewed on a laptop. Certain letters in the logo seem longer than others and some appear thicker. It's an RGB ve
-
When printing a PDF file online on all of our Officejet 100 Mobile L411 USB printers, we encounter an undocumented error light sequence. The error light sequence we encounter is Power light blinks in conjuction with the Bluetooth light then those 2 l
-
Make customized XML default for UWL iView
Hello, We are using Portal 7.0. I went to system adminstration > System configuration > Universal Worklist & Workflow > Universal worklist - Administration > Universal Worklist Content Configuration. I've created & uploaded my own XML succesfully! Th