How to create dynamic DataTable with dynamic header/column in JSF?
Hello everyone,
I am having problem of programmatically create multiple DataTables which have different number of column? In my JSF page, I should implement a navigation table and a data table. The navigation table displays the links of all tables in the database so that the data table will load the data when the user click any link in navigation table. I have gone through [BalusC's post|http://balusc.blogspot.com/2006/06/using-datatables.html#PopulateDynamicDatatable] and I found that the section "populate dynamic datatable" does show me some hints. In his code,
// Iterate over columns.
for (int i = 0; i < dynamicList.get(0).size(); i++) {
// Create <h:column>.
HtmlColumn column = new HtmlColumn();
dynamicDataTable.getChildren().add(column);
// Create <h:outputText value="dynamicHeaders"> for <f:facet name="header"> of column.
HtmlOutputText header = new HtmlOutputText();
header.setValue(dynamicHeaders[i]);
column.setHeader(header);
// Create <h:outputText value="#{dynamicItem[" + i + "]}"> for the body of column.
HtmlOutputText output = new HtmlOutputText();
output.setValueExpression("value",
createValueExpression("#{dynamicItem[" + i + "]}", String.class));
column.getChildren().add(output);
public HtmlPanelGroup getDynamicDataTableGroup() {
// This will be called once in the first RESTORE VIEW phase.
if (dynamicDataTableGroup == null) {
loadDynamicList(); // Preload dynamic list.
populateDynamicDataTable(); // Populate editable datatable.
return dynamicDataTableGroup;
I suppose the Getter method is only called once when the JSF page is loaded for the first time. By calling this Getter, columns are dynamically added to the table. However in my particular case, the dynamic list is not known until the user choose to view a table. That means I can not call loadDynamicList() in the Getter method. Subsequently, I can not execute the for loop in method "populateDynamicDataTable()".
So, how can I implement a real dynamic datatable with dynamic columns, or in other words, a dynamic table that can load data from different data tables (different number of columns) in the database at run-time?
Many thanks for any help in advance.
flyeminent wrote:
However in my particular case, the dynamic list is not known until the user choose to view a table. Then move the call from the getter to the bean's action method.
Similar Messages
-
How to create a datatable with row headers and column headers
Hi,
I am trying to create a two dimensional datatable which has both column headers and row headers. using <h:datatable> i could create a datatable with only column headers.
Thanks in advanceAre you saying that you want a column with only th's? You could also just apply some CSS on that specific column that its rows look like headers.
-
In FR, how to create dynamical reference column
In FR, can we do something like below:
I have scenarios in the column header; while in column 1, scenario is selected from the current point of view, for example when I select Budget, I would like in column 2 to be the Actual; If I select Forecast in column 1, and I would like Budget in column 2, etc.
Any suggestion/advise is welcome.
ThanksThanks for the reply.
However, I was not able to find the conditional suppression based on the other column's member name (can only suppress based on its own column member name, data cell, or data cell values, etc).
Also my requirements is a bit complicated. I also have year as my column header. I have year 2007 to 2009, and scenarios: actual, budget, F1, F2, F3.
If I choose 2009 for example, Budget, I would like the 2nd column to be 2008 F3; If I choose 2008 F1, I would like the 2nd column to be 2008 Budget; if I choose 2008 F2, I would like the 2nd column to be 2008 F1, and so on.
Any suggestions/advices ? -
How to create dynamic connection string with variables using ssis.
Hello,
Can anyone let me know on how to create dynamic connection string with variables using ssis?
Any help would be appreciated.Hi vinay9738,
According to your description, you want to connect multiple database from multiple servers using dynamic connection.
If in this case, we can create a Table in our local database (whatever DB we want) and load all the connection strings. We can use Execute SQL Task to query all the connection strings and store the result-set in a variable of object type in SSIS package.
Then use ForEach Loop container to shred the content of the object variable and iterate through each of the connection strings. And then Place an Execute SQL task inside ForEach Loop container with the SQL statements we have to run in all the DB instances.
For more details, please refer to the following blog:
http://sql-developers.blogspot.kr/2010/07/dynamic-database-connection-using-ssis.html
If there are any other questions, please feel free to let me know.
Regards,
Katherine Xiong
Katherine Xiong
TechNet Community Support -
How to create dynamic context based on a structure defined in the program?
Hi Experts,
I need to create a dynamic context based on a structure wa_struc which i have define programatically.
When I pass wa_struc to structure_name parameter of create_nodeinfo_from_struc, i get a runtime error:
"Parameter STRUCTURE_NAME contains an invalid value wa_struc."
How to create dynamic context based on a structure defined in the program?
I have written the code like this:
TYPES: BEGIN OF t_type,
v_carrid TYPE sflight-carrid,
v_connid TYPE sflight-connid,
END OF t_type.
Data: i_struc type table of t_type,
wa_struc type t_type.
data: dyn_node type ref to if_wd_context_node.
data: rootnode_info type ref to if_wd_context_node_info.
rootnode_info = wd_context->get_node_info( ).
clear i_struc. refresh i_struc.
select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
cl_wd_dynamic_tool=>create_nodeinfo_from_struct(
parent_info = rootnode_info
node_name = 'dynflight'
structure_name = 'wa_struc'
is_multiple = abap_true ).
dyn_node = wd_context->get_child_node( name = 'dynflight' ).
dyn_node->bind_table( i_struc ).
Thanks
Gopal
Message was edited by: gopalkrishna baligaHi Michelle,
First of all Special thanks for your informative answers to my other forum questions. I really appreciate your help.
Coming back to this question I am still waiting for an answer. Please help. Note that my structure is not in a dictionary.
I am trying to create a new node. That is
CONTEXT
- DYNFLIGHT
CARRID
CONNID
As you see above I am trying to create 'DYNFLIGHT' along with the 2 attributes which are inside this node. The structure of the node that is, no.of attributes may vary based on some condition. Thats why I am trying to create a node dynamically.
Also I cannot define the structure in the ABAP dictionary because it changes based on condition
I have updated my code like the following and I am getting error:
TYPES: BEGIN OF t_type,
CARRID TYPE sflight-carrid,
CONNID TYPE sflight-connid,
END OF t_type.
Data: i_struc type table of t_type,
dyn_node type ref to if_wd_context_node,
rootnode_info type ref to if_wd_context_node_info,
i_node_att type wdr_context_attr_info_map,
wa_node_att type line of wdr_context_attr_info_map.
wa_node_att-name = 'CARRID'.
wa_node_att-TYPE_NAME = 'SFLIGHT-CARRID'.
insert wa_node_att into table i_node_att.
wa_node_att-name = 'CONNID'.
wa_node_att-TYPE_NAME = 'SFLIGHT-CONNID'.
insert wa_node_att into table i_node_att.
clear i_struc. refresh i_struc.
select carrid connid into corresponding fields of table i_struc from sflight where carrid = 'AA'.
rootnode_info = wd_context->get_node_info( ).
rootnode_info->add_new_child_node( name = 'DYNFLIGHT'
attributes = i_node_att
is_multiple = abap_true ).
dyn_node = wd_context->get_child_node( 'DYNFLIGHT' ).
dyn_node->bind_table( i_struc ).
l_ref_interfacecontroller->set_data( dyn_node ).
But now I am getting the following error :
The following error text was processed in the system PET : Line types of an internal table and a work area not compatible.
The error occurred on the application server FMSAP995_PET_02 and in the work process 0 .
The termination type was: RABAX_STATE
The ABAP call stack was:
Method: IF_WD_CONTEXT_NODE~GET_STATIC_ATTRIBUTES_TABLE of program CL_WDR_CONTEXT_NODE_VAL=======CP
Method: GET_REF_TO_TABLE of program CL_SALV_WD_DATA_TABLE=========CP
Method: EXECUTE of program CL_SALV_WD_SERVICE_MANAGER====CP
Method: APPLY_SERVICES of program CL_SALV_BS_RESULT_DATA_TABLE==CP
Method: REFRESH of program CL_SALV_BS_RESULT_DATA_TABLE==CP
Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE_DATA of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMP_TABLE_DATA~MAP_FROM_SOURCE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMP_TABLE_DATA~UPDATE of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_VIEW~MODIFY of program CL_SALV_WD_C_TABLE_V_TABLE====CP
Method: IF_SALV_WD_COMPONENT~VIEW_MODIFY of program CL_SALV_WD_A_COMPONENT========CP
-Gopal
Message was edited by: gopalkrishna baliga -
How to create dynamic variable in Java?
Hi,
I want to create dynamic varible , using ArrayList or Vector. The number of array i dont knwo, so how to create dynamic ArrayList or Vector.
for example:
ArrayList1,ArrayList2,ArrayList3.....n
or
Vector1,Vector2,Vector3 .....n, the n value i will get at run time, so how to create the dynamic ArrayList or Vector or i can use any other Object in java,
Pls provide your input.
Sridhar1. I have a HashMap with dataok ... fair enough.
2. depending on its size, i need to create variable
to store them.uhm ... why? If you have a variable number of elements in the map then you'd need to generate a variable number of variables (a number, that is not know at compile time, as it seems). Now if you could somehow create those variables, how would you access them? You'd have to generate the code handling them as well ...
Tell us what kind of data you've got and what you want to do with it. There's certainly a better solution to your problem.
how to generate variables as per content size of the
HashMapYou don't. -
How to create dynamic screen using module pool programming
Hi,
Could anybody help me how to create dynamic screens?
I am developing a screen with HR Person with assignment info. If PERNR have multiple assignments, i need to show all the details one by one. How to show the details on screen. I need to call one by one assignment information dynamically.
Please suggest me how to do, apart from using table controls.
Thanks,
KamalYou may have the below options:
1) Table Control
2) Individual fields
3) ALV
4) pop-up screen -
How to create dynamic window in smartform
<i>HI Floks</i>
my requirement is invoice smartform having few line items .i can print this line items with different categories with dynamically placed in smartfom. there how many items with in particular category print its self . how is it possible to printing .is it possible to print dynamic fields and window without changing driver program and structure .How to create dynamic window.
any body knows reply me fast
thanks in advance ,
sureshHi suresh,
You can create all the windows, but if you go to specific window you will see different tabs like general attributes, output options and conditions. In that conditions tab, you can give condition. so based on that condition, that window will be printed.
Dont forget to reward points if helpful.
regards,
Chandra. -
How to create dynamic variable in HANA
Hello experts,
Please help me on how to create dynamic variable in calculation view.
Ex: variable automatically should take YTD, or MTD values so that I can directly consume column in BW on hana or BO reporting.Hi ,
Not sure on what are looking for. Have a look on the below blog once, if this is what you are looking out for:
Applying YTD in SAP HANA with SAP BO Analysis Office
Regards,
Krishna Tangudu -
How to create dynamic strcture and accepting runtime value in work area
Hi,
I am using RFC_READ_TABLE for joining more than table and written select query but into clause work area value is passed but it is short dump is displaying with too few many fields in into clause .work area WA need some casting type conversion which accepts the some run time value and should have some structure for it.how to create dynamic structure?hi
good
go through this and use in your report accordingly.
If you are trying to read some information from SAP and you can't find the right BAPI then RFC_READ_TABLE can do the job for you.
RFC_READ_TABLE is powerful RFC it gives you the access to all tables and views in SAP. I basically used RFC_READ_TABLE for Material Master Search application on the Intranet.
Now you may say there are lots of BAPI for this functionality. You are right but I had to work around the BAPI to get Prices (Moving Average Price) and it just did not work very well. Because of the nature of the application I had to use RFC_READ_TABLE because then I can use powerful SQL expression for searching. RFC_READ_TABLE give you the ability to code the where clause which is quite enough.
I have included part of the code use in asp page to read ENT1027 for Mgroup and M description & number but without object creation. The other part of the code reads MBEW for price & quantity.
Code
lt;%
'#######################Diming the Structures
Call BAPIRFC.DimAs("Rfc_Read_Table", "FIELDS", MaterialSelection_RS)
Call BAPIRFC.DimAs("Rfc_Read_Table", "OPTIONS", Selection_RS)
'########################Search Type########################
' C contanis
' S Start with
' E Ends with
if searchtype = "C" then
FormatedSearch_Keyword = "%" & Search_Keyword & "%"
elseif searchtype = "S" then
FormatedSearch_Keyword = Search_Keyword & "%"
else searchtype = "E" then
FormatedSearch_Keyword = "%" & Search_Keyword
end if
'################# Flaged for deletion Materials #####################
if showdeleted = "No" then
Selection_RS.AddNew Array("TEXT"),Array("LVORM <> 'X' AND")
end if
'############## users can search three material group ################
'############## GROUPS: OFFICESUP TECOMHARD TECOMSOFT ###############
'##USER STILL CAN NAROW THEIR SEARCH BY SELECTING ON OF THREE#########
if MGroup = "ALL" then
Selection_RS.AddNew Array("TEXT"),Array("MATKL IN ('OFFICESUP','TECOMHARD','TECOMSOFT')")
else
Selection_RS.AddNew Array("TEXT"),Array("MATKL = '"& MGroup &"' and ")
end if
'#######################ADDING SEARCH KEYWORD TO STRUCTURE##############
if not Search_Keyword = "" then
Selection_RS.AddNew Array("TEXT"),Array(" MAKTG LIKE '" & FormatedSearch_Keyword & "'")
end if
Selection_RS.Update
'#######################ADD RETURNED FIELDS#########################
MaterialSelection_RS.AddNew array("FIELDNAME","OFFSET","LENGTH","TYPE","FIELDTEXT"),array("MATNR","000000","000000" ,"","")
MaterialSelection_RS.AddNew array("FIELDNAME","OFFSET","LENGTH","TYPE","FIELDTEXT"),array("MATKL","000000","000000" ,"","")
MaterialSelection_RS.AddNew array("FIELDNAME","OFFSET","LENGTH","TYPE","FIELDTEXT"),array("MAKTG","000000","000000" ,"","")
MaterialSelection_RS.Update
call BAPIRFC.Rfc_Read_Table("ENT1027", Material_RS, MaterialSelection_RS, Selection_RS, "~", "", "0", "0")
If Err.Number > 0 then
Response.Write "Error:" & "<BR>"
Response.Write " Err.number...... " & Err.Number & "<BR>"
Response.Write " Err.Description. " & Err.Description & "<BR>"
end if
'###########LOOP THROUGH RECORDSET
if not Material_RS is nothing then
do while not Material_RS.eof
loop
end if
%>
thanks
mrutyun^ -
Salmple at How to Create Dynamical Object for RTTC
Hi all, I need a sample at How to Create Dynamical Object for RTTC.
you can help me?.Hello Martinez,
I have attached a sample for structure types. With the Where-Used-List on the Create() Method of the various RTTC classes one may find more samples. If you meant with object on OO Type then it is to mention that this is not possible yet.
Regards
Klaus
PROGRAM sample.
DATA: sdescr1 TYPE REF TO cl_abap_structdescr,
sdescr2 TYPE REF TO cl_abap_structdescr,
tdescr1 TYPE REF TO cl_abap_tabledescr,
tdescr2 TYPE REF TO cl_abap_tabledescr,
tref1 TYPE REF TO data,
tref2 TYPE REF TO data,
comp TYPE abap_component_tab,
wa TYPE t100,
xbuf TYPE xstring.
FIELD-SYMBOLS: <tab1> TYPE table,
<tab2> TYPE table.
sdescr1 ?= cl_abap_typedescr=>describe_by_name( 'T100' ).
comp = sdescr1->get_components( ).
sdescr2 = cl_abap_structdescr=>create( comp ).
tdescr1 = cl_abap_tabledescr=>create( sdescr2 ).
tdescr2 = cl_abap_tabledescr=>create( sdescr2 ).
CREATE DATA: tref1 TYPE HANDLE tdescr1,
tref2 TYPE HANDLE tdescr2.
ASSIGN: tref1->* TO <tab1>,
tref2->* TO <tab2>.
wa-sprsl = 'E'. wa-arbgb = 'SY'. wa-msgnr = '123'. wa-text = 'first text'. INSERT wa INTO TABLE <tab1>.
wa-sprsl = 'D'. wa-arbgb = 'SY'. wa-msgnr = '456'. wa-text = 'second text'. INSERT wa INTO TABLE <tab1>.
wa-sprsl = 'D'. wa-arbgb = 'XY'. wa-msgnr = '001'. wa-text = 'third text'. INSERT wa INTO TABLE <tab1>.
wa-sprsl = 'D'. wa-arbgb = 'ZZ'. wa-msgnr = '123'. wa-text = 'fourth text'. INSERT wa INTO TABLE <tab1>.
wa-sprsl = 'E'. wa-arbgb = 'SY'. wa-msgnr = '123'. wa-text = 'ABAP is a miracle'. INSERT wa INTO TABLE <tab1>.
EXPORT tab = <tab1> TO DATA BUFFER xbuf.
IMPORT tab = <tab2> FROM DATA BUFFER xbuf.
LOOP AT <tab2> INTO wa.
WRITE: / wa-sprsl, wa-arbgb, wa-msgnr, wa-text.
ENDLOOP. -
How to create Dynamic Webi 3.1 filename in Publication
I have a webi 3.1 report that is being called from a publication used for bursting using the eFashion universe. I want the file name to be dynamic, based on the profile. Within the webi report I created a free standing cell that I set to "Western States" or "Eastern States" based on the states in the report at the time of the run (set by the profile). This works correctly. But there does not seem to be a way to get the report to use the free standing cell value as part of the report name. From the publication, properties, destinations, use specific name I can only pick title and document name. Neither of these is the free standing cell in the report. I saw that version 4.0 has this ability but I can't upgrade for another year and deski is not an option. Any suggestions? Thank you.
I figured out how to create dynamic report names with 2 fields within the Publication tool. I padded fullname and email in dynamic recipients to be the two fields I wanted from the report. Then in Destinations, File Name:, Use specific name I picked userfullname and email address to create the report name. But that would not work if I actually needed to use the email address to send the report to. We don't have Java programmers and may have to find other options. Thanks.
-
hi friends,
could u plz tell me how to create dynamic action?
with regards,
Priya.SHi
I u need to write the dynamic action as below
0002 ANZKD 06 3 P PSPAR-TCLAS<>'B'
0002 ANZKD 06 4 P T001P-MOLGA='12'
0002 ANZKD 06 5 P P0002-ANZKD>='1'
0002 ANZKD 06 6 I INS,0021,2,,(P0002-BEGDA),(P0001-ENDDA)
This should help you. rewards
Regards
Suresh -
How to create dynamic nested internal table
Hi Experts,
Pleae tell me or give sample code, how to create dynamic nested internal table ?
I have seen threads saying creation of dynamic internal tables using some table structure only. But now the requirement is to create dynamic nested internal table.
For example the internal table contains two fields viz., one is field1 of dynamic internal table and other is normal field2 and values as shown below:
Nested internal table:
field1 | field2 ...
<table content1> | value2..
<table content1> | value2..
Here the [table content] should also a dynamic internal table.
Let me know if you need any other info.
regards
Saravanan Rsee the complete code..i am currently working in ECC6.0 EHP4. just check which version you are using..
REPORT yst_test_000.
DATA:
lt_comptab TYPE cl_abap_structdescr=>component_table,
ls_comp LIKE LINE OF lt_comptab,
lref_newstr TYPE REF TO cl_abap_structdescr,
lref_tab_type TYPE REF TO cl_abap_tabledescr,
lt_fcat TYPE lvc_t_fcat,
ls_fcat TYPE lvc_s_fcat,
ls_dd03p TYPE dd03p,
lt_data type ref to data.
field-symbols: <fs_table> type standard table.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
i_structure_name = 'SCARR'
CHANGING
ct_fieldcat = lt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
LOOP AT lt_fcat INTO ls_fcat.
IF ls_fcat-ref_table IS NOT INITIAL.
CLEAR ls_dd03p.
CALL FUNCTION 'BUS_DDFIELD_GET'
EXPORTING
i_tabnm = ls_fcat-ref_table
i_fldnm = ls_fcat-fieldname
IMPORTING
e_dd03p = ls_dd03p
EXCEPTIONS
field_not_found = 1
OTHERS = 2.
IF sy-subrc EQ 0.
ls_comp-name = ls_fcat-fieldname.
ls_comp-type ?= cl_abap_datadescr=>describe_by_name( ls_dd03p-rollname ).
APPEND ls_comp TO lt_comptab.
CLEAR ls_comp.
ENDIF.
ELSE.
ls_comp-name = ls_fcat-fieldname.
ls_comp-type ?= cl_abap_datadescr=>describe_by_name( ls_fcat-rollname ).
APPEND ls_comp TO lt_comptab.
CLEAR ls_comp.
ENDIF.
ENDLOOP.
*Now for the Field which you want deep table then you can do like this
ls_fcat-fieldname = 'NESTED_TABLE'.
ls_fcat-inttype = 'C'.
ls_fcat-intlen = '000006'.
ls_fcat-rollname = 'SFLIGHT_TAB1'. "For SFLIGHT
APPEND ls_fcat TO lt_fcat.
ls_comp-name = ls_fcat-fieldname.
ls_comp-type ?= cl_abap_datadescr=>describe_by_name( ls_fcat-rollname ).
APPEND ls_comp TO lt_comptab.
CLEAR ls_comp.
lref_newstr = cl_abap_structdescr=>create( lt_comptab ).
lref_tab_type = cl_abap_tabledescr=>create( lref_newstr ).
create data lt_data type handle lref_tab_type.
assign lt_data->* to <fs_table>.
break-point.
Edited by: Vijay Babu Dudla on Apr 28, 2009 8:05 AM -
How to create Dynamic Window in Smartforms
Hi all,
Could you please help me out on how to create Dynamic Window in smartforms excluding Main Window.
Thanks in Advance.
Vinay.hi,
Hi,
1.If you are creating the Different windows for the Countries,then In conditions tab of window specify the Condition i.e.
company -code = '2201'.
2.Then that window can trigger ofr that condition.
3.Other wise, if you are using the different layouts ,then write the condition in Print program and call that form .
reward me if helpful.
Maybe you are looking for
-
I can't open Final Cut because of huge project
Hey everyone, I'm working on a timelapse project in 10.0.9 on my MacPro5,1 with OSX 10.9 (13A603). I have the OS, final cut and the project and event files running on a 240 solid state SATA drive within the tower. AND lastly I have 16gb of RAM So ba
-
Why can't I access the effects on iMovie?
I have the new iMovie '11, and can't seem to access ANY of the effects, like Slow Motion, Fade to black and white or Sepia, I can't change the speed or how long the interval is between images. Everything I go to do is gray, and can't be done. Please
-
Well, LION 10.7.1 is here....informing us "Address an issue that may cause the system to become unresponsive when playing a video in Safari".... the "Missing plug-in" issue has not been fixed, no change at all. Not sure what kind of UAT testing they
-
I upgraded to the 2014 version and now my sound does not play back from the timeline. I can see a waveform, but nothing plays back and there is no level showing in the meter. [Please choose only a short description for the thread title.] Message was
-
In case you want to see Dry Creek Photo gamuts
I haven't gone to the Dry Creek site to view their wire frame gamuts in quite a while, but when I did a month or so ago, I couldn't view them because my old Cortona viewer wasn't compatible with Mac anymore, so I did a search and found several Mac 3