Controlling visibility of ALV columns at runtime
Hi
I have an ALV column which is of type DropdownByKey. I can control the visibility of the dropdown by setting it based on another context node attribute (for e.g., 'CAT_VALUE_I_VISIBLE') which I modify at runtime. But then I want to hide the column itself based on the other context node attribute which I am not able to. Is it possible ?
I have something like this to hide the dropdown
lo_drdn_by_key->set_visible_fieldname( 'CAT_VALUE_I_VISIBLE' ).
But on the column level there is only a method like :
DATA lo_column type ref to cl_salv_wd_column.
lo_column-r_column->set_visible( cl_wd_uielement=>e_visible-none ).
Is there a possibility to control the visibility of an ALV column at runtime ?
Thanks and regards
Sukanya
Hi,
Depending upon another context attribute condition get th ecolumn ref of the alv field which you want to hide and set the visibility property to none.
data : lt_columns type SALV_WD_T_COLUMN_REF.
Get the column ref
CALL METHOD lo_value->if_salv_wd_column_settings~get_columns
RECEIVING
value = lt_columns.
CALL METHOD lr_column->set_visible
EXPORTING
value = cl_wd_uielement=>e_visible-none.
Thanks,
Shailaja Ainala.
Similar Messages
-
How do I control a table's column visible in Java
Using JDeveloper 11.1.1.4.0
I want to control a rich tree table's column visibility programatically in Java. I've looked for syntax and do not find an example like I need. I need to directly control the column similar to how a panel collection does. The visibility of the column will be set and then the table refreshed (I've got the refresh part working), I just need to correctly reference the column. This logic will be triggered by a rowDisclosureListener that is defined as pageFlowScope. I've tried experimenting on myTable which is a RichTreeTable, but the plethora of syntax choices after "myTable." is enormous. Also, is it possible to allow the panel collection to override this logic or remove the column from its columns list?
Thanks in advance,
TroyWow, I wish I could include a screenshot to show what is happening. My bean has somewhat similar logic, only I am trying to have my treetable show an additional column when a node of the treetable is expanded. I thought this problem might be caused by the panel collection so I tried taking it off, but it still behaves the same. I can show the column, but no header shows up for it. The original column headers stay fixed as does the data of node 0, but the subsequent (node 1) data after the first column is shifted to the right with each column added between the first column and the end column. If I do a browser refresh after expanding a node, it refreshes with the column header that was missing--strange.
from my bean:
public void onNodeDisclosure(RowDisclosureEvent rowDisclosureEvent) {
boolean isCloseEvent = false;
RowKeySet rowKeySet = rowDisclosureEvent.getAddedSet();
//did disclosure event open a new node ?
if (rowKeySet.iterator().hasNext()) {
isCloseEvent = false;
nodeLevel++;
} else {
isCloseEvent = true;
nodeLevel--;
//get the previously disclosed set
rowKeySet = rowDisclosureEvent.getRemovedSet();
if (nodeLevel == 1 && isCloseEvent == false) {
setShowTaxyear(Boolean.TRUE);
} else if (nodeLevel == 1 && isCloseEvent == true) {
setShowTaxyear(Boolean.FALSE);
setShowTaxunit(Boolean.FALSE);
if (nodeLevel == 2 && isCloseEvent == false) {
setShowTaxyear(Boolean.TRUE);
setShowTaxunit(Boolean.TRUE);
} else if (nodeLevel == 2 && isCloseEvent == true) {
showTaxunit = true;
if (nodeLevel == 3 && isCloseEvent == false) {
setShowTaxyear(Boolean.TRUE);
setShowTaxunit(Boolean.TRUE);
partiallyrefreshUIComponent();
public void setAmtsOwedTreeTbl(RichTreeTable amtsOwedTreeTbl) {
this.amtsOwedTreeTbl = amtsOwedTreeTbl;
public RichTreeTable getAmtsOwedTreeTbl() {
return amtsOwedTreeTbl;
public void setShowTaxyear(boolean showTaxyear) {
this.showTaxyear = showTaxyear;
public boolean isShowTaxyear() {
return showTaxyear;
public void setShowTaxunit(boolean showTaxunit) {
this.showTaxunit = showTaxunit;
public boolean isShowTaxunit() {
return showTaxunit;
* PRIVATE METHOD
private void partiallyrefreshUIComponent() {
AdfFacesContext adfFacesContext = AdfFacesContext.getCurrentInstance();
adfFacesContext.addPartialTarget(getAmtsOwedTreeTbl());
}my treetable:
<af:treeTable value="#{bindings.GetAmtsGrandTotal_VO2.treeModel}"
var="node"
selectionListener="#{bindings.GetAmtsGrandTotal_VO2.treeModel.makeCurrent}"
rowSelection="multiple" id="amtsowedtt1" width="900"
columnSelection="multiple"
inlineStyle="border-style:none;"
summary="This table dynamically displays the amounts due, (interest, penalties and attorney fees--if any) and a total due. The rows can be expanded to show the above amounts by year, tax unit and owner."
shortDesc="Amounts Due" autoHeightRows="0"
immediate="false"
clientComponent="true"
rowDisclosureListener="#{pageFlowScope.browseAmtsOwedTreeTblBean.onNodeDisclosure}"
binding="#{pageFlowScope.browseAmtsOwedTreeTblBean.amtsOwedTreeTbl}">
<f:facet name="nodeStamp">
<!-- this column is to always show -->
<af:column id="amtsowedc1" width="130"
inlineStyle="#{node.bindings.NodeType=='aggregate'?'font-weight:bold;':''}"
visible="#{true}">
<af:outputText value="#{node.bindings.NodeLabel}"
id="amtsowedot1"/>
</af:column>
</f:facet>
<!-- this column should show when node 1 or greater is exposed -->
<af:column width="45" id="amtsowedc2"
visible="#{pageFlowScope.browseAmtsOwedTreeTblBean.showTaxyear}" inlineStyle="text-align:center;"
sortable="true" sortProperty="#{node.bindings.Taxyear}">
<af:outputText value="#{node.bindings.Taxyear}" id="amtsowedot2"/>
<f:facet name="header">
<af:outputText value="Tax Year" id="amtsowedot33"
inlineStyle="text-align:center;"
visible="#{pageFlowScope.browseAmtsOwedTreeTblBean.showTaxyear}"
noWrap="true" rendered="#{pageFlowScope.browseAmtsOwedTreeTblBean.showTaxyear}"/>
</f:facet>
</af:column>
<!-- this column should show when node 2 or greater is exposed -->
<af:column width="40" id="amtsowedc3" visible="#{pageFlowScope.browseAmtsOwedTreeTblBean.showTaxunit}"
inlineStyle="text-align:center;"
sortable="true" sortProperty="#{node.bindings.Taxunit}"
filterable="true" filterFeatures="caseInsensitive">
<af:outputText value="#{node.bindings.Taxunit}" id="amtsowedot3"/>
<f:facet name="header">
<af:outputText value="Tax Unit" id="amtsowedot66"
inlineStyle="text-align:center;"
visible="#{pageFlowScope.browseAmtsOwedTreeTblBean.showTaxunit}"
noWrap="true" rendered="#{pageFlowScope.browseAmtsOwedTreeTblBean.showTaxunit}"/>
</f:facet>
</af:column>
<af:column id="amtsowedc4" align="right" headerText="Calculated Levy"
inlineStyle="#{node.bindings.NodeType=='aggregate'?'font-weight:bold;':''};"
visible="false">
<af:outputText value="#{node.bindings.Calclevy}" id="amtsowedot4"/>
</af:column>
<af:column id="amtsowedc5" align="right" headerText="Levy Due"
inlineStyle="#{node.bindings.NodeType=='aggregate'?'font-weight:bold;':''};"
visible="false">
<af:outputText value="#{node.bindings.Ballevydue}"
id="amtsowedot5"/>
</af:column>
<af:column id="amtsowedc6" align="right" headerText="Interest Due"
inlineStyle="#{node.bindings.NodeType=='aggregate'?'font-weight:bold;':''};"
visible="false">
<af:outputText value="#{node.bindings.Intdue}" id="amtsowedot6"/>
</af:column>
<af:column id="amtsowedc7" align="right" headerText="Penalty Due"
inlineStyle="#{node.NodeType=='aggregate'?'font-weight:bold;':''};"
visible="false">
<af:outputText value="#{node.bindings.Pendue}" id="amtsowedot7"/>
</af:column>
<af:column id="amtsowedc8" align="right" headerText="Attorney Due"
inlineStyle="#{node.bindings.NodeType=='aggregate'?'font-weight:bold;':''};"
visible="false">
<af:outputText value="#{node.bindings.Attydue}" id="amtsowedot8"/>
</af:column>
<!-- this column is to always show -->
<af:column id="amtsowedc9" align="right" headerText="Total Due"
inlineStyle="#{node.bindings.NodeType=='aggregate'?'font-weight:bold;':''};"
visible="#{true}">
<af:outputText value="#{node.bindings.Totalbaldue}"
id="amtsowedot9"/>
</af:column>
<f:facet name="pathStamp">
<af:outputText value="#{node}" id="amtsowedot0"/>
</f:facet>
</af:treeTable> -
ALV column displays either button or text ?
Dear collegues,
I want to display one column in an ALV table that either displays a button (with a text on it) or displays a text (without button). The decision what of these 2 possibilites is shown should be controlled by the runtime data (eg. the WD context).
PS: I know how to display one ALV column with only buttons or one ALV column with only text.Hi Christian,
a) Is the command l_cv->set_key( 'TEXT_VIEW' ) still correct to display the icon ?
yes there is a no show stopper to display icon.since TEXT_VIEW is a string value to populate text/check box conditionally.
b) What I fill into the new context field 'CELL_VARIANT' while runtime ? Should it filled with u201CTEXT_VIEWu201D to display the iconand with u201C u201C to display the button ?
you can give either button or icon to cell_variant.Follow my code as it is .you will get the output. -
Changing header title of column at runtime
Hi
I want to change the column header in an ALV table at runtime. I know how to overwrite a DDIC binding text of the column header with my own static text but I also want to know how to modify this column header text dynamically. I have a separate attribute in my context node to serve as the column header, which I can keep modifying at runtime, but the problem is to bind this attribute to the header of the column.
Thanks and regards
SukanyaHi Sukanya,
Refer to code given by Thomas in this thread: change ALV column Header
Also refer these threads: Webdynpro ALV title
Re: Change Header Text for a ALV table column
I hope it helps.
Regards
Arjun
Edited by: Arjun Thakur on Mar 26, 2009 4:41 PM -
How to hide ALV column in webdynpro
Hi frnds,
I want to hide one columns in ALV output on webdynpro , give the procedure ...
Thanks & Regards,
Rajesh.jProcedure is :
a) Get ALV Model reference
b) Get list of ALV Columns
c) Loop at each column and set visibility
Code would be something like this
I'm storing ALV model reference in view attributes wd_this->alv_config_table of type ref to CL_SALV_WD_CONFIG_TABLE.
Data: lo_cmp_usage type ref to if_wd_component_usage.
DATA: lr_salv_wd_table TYPE REF TO iwci_salv_wd_table.
DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings,
lr_column TYPE REF TO cl_salv_wd_column,
lt_column type salv_wd_t_column_ref,
ls_column type salv_wd_s_column_ref.
*create an instance of ALV component
lo_cmp_usage = wd_this->wd_cpuse_OVERVIEW_EARNED_ALV( ).
* if not initialized, then initialize
if lo_cmp_usage->has_active_component( ) is initial.
lo_cmp_usage->create_component( ).
endif.
* get ALV component
lr_salv_wd_table = wd_this->wd_cpifc_OVERVIEW_EARNED_ALV( ).
wd_this->alv_config_table = lr_salv_wd_table->get_model( ).
lr_column_settings ?= wd_this->alv_config_table.
lt_column = lr_column_settings->get_columns( ).
loop at lt_column into ls_column.
CASE ls_column-id.
when 'POST_YEAR'.
ls_column-r_column->set_visible( if_wdl_core=>visibility_none ).
ENDCASE.
endloop. -
Controle the WD table column position Sequence
HI All,
How to controle the WD table column position (not ALV) in webdynpro as per custom requirnment.
Column1, Column2, Column3, Column4…………
I looked into CL_WD_TABLE to see any possibility.
Can anyone suggest me the right one?
Thanks
GopalHi,
Can we rearrange the existing columns of nodes by passing the index and column name.
Unfortunately, No! you have to remove the column and add it.
As I have already have a component with table need to rearrange the columns.
Is it a standard component or custom component?
If it is a custom component, you can rearrange by right click on column and move up/down.
If it is a standard component, consider deleting the table( Remove Element) in enhancement mode and then create a new Table UI with specified order. Or, create a post exit in wddomodifyview and then get the table reference and use remove_column( ) add_column( ) methods
code snippet:
DATA: lr_table TYPE REF TO cl_wd_table,
lr_abs_col TYPE REF TO cl_wd_abstr_table_column,
lr_col TYPE REF TO cl_wd_table_column.
IF first_time EQ abap_true.
* get table reference
lr_table ?= view->get_element( id = 'TABLE ). " ID of Table UI
CALL METHOD lr_table->remove_grouped_column
EXPORTING
id = 'COL1' " column
index = 1 " index
RECEIVING
the_grouped_column = lr_abs_col.
lr_col ?= lr_abs_col.
CALL METHOD lr_table->add_column
EXPORTING
index = 20 " new index
the_column = lr_col.
ENDIF.
hope this helps u,
Regards,
Kiran -
Web dynpro for abap how to create a customize search help in alv column
hi:
Web dynpro for abap how to create a customize search help in alv column and put search help value into alv column?
Are there specific examples ?
thanks!!HI:
I want to created a freely programed help which include date&time,and put help value to alv column.
I have created a freely programed help in web dynpro for abpa application,I refer:
**************** - WebDynpro for ABAP
but have a problem!
If you focus on the the input field in the first row, you get the value help
However if I go to the second row and focus on the same input field in this column, I don't get the value help:
What is a good way to solve similar problems?
thanks -
How to Pre-Select a View for ALV dashboard at runtime
Hello Experts,
The requirement is to pre-select 1 view initially (out of several configured) for 'All' users and disable the 'View-selection' dropdown function in a standard ALV dashboard. So whenever the dashboard loads, a particular view has to be set automatically for all users.
I need your help for the first part, which is to always pre-set a 'View' in a standard dashboard.
I tried to implement the suggestion provided in the following thread:
How to apply ALV view at runtime
However I couldn't make this work in my case. I created a Post-Exit of a method in Comp Ctlr of dashboard (Initialize method) - where I receive the refrence 'IWCI_SALV_WD_TABLE'. Then calling the method 'GET_CONFIG_DATA' with action 'if_salv_wd_table=>set', I try to set the view, but it has no effect.
Thanks a lot for your help,
AbirHi abir,
Use this and alv1 is my alv component name
DATA LO_CMP_USAGE TYPE REF TO IF_WD_COMPONENT_USAGE.
LO_CMP_USAGE = WD_THIS->WD_CPUSE_ALV1( ).
IF LO_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
LO_CMP_USAGE->CREATE_COMPONENT( ).
ENDIF.
DATA LO_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE .
LO_INTERFACECONTROLLER = WD_THIS->WD_CPIFC_ALV1( ).
LS_PARAM_IN TYPE IF_SALV_WD_TABLE=>S_TYPE_PARAM_CONFIG_IN.
ls_param_in-default = "your view name " ( view is of type wdr_pers_variant)
DATA LO_VALUE TYPE REF TO CL_SALV_WD_CONFIG_TABLE.
LO_VALUE = LO_INTERFACECONTROLLER->GET_CONFIG_DATA( ls_param_in )
Regards
Srinivas
Edited by: sanasrinivas on Dec 30, 2011 7:15 AM -
USING MULTIPLE CONTROLLING AREA in the column
Dear Experts,
As per my requirement i need fetch the data from multiple controlling areas in to one report. please let us know how many ways are there? can i able to use controlling are in the column of the report. when i try to select the controlling area is not appearing in the coumn and it is appearing only in the geneHi,
You can select multiple Controlling area Please try with following steps.
Maintain variant
Click on attributes.
Environment > Maint.sel.varables.
Click on Display/Change.
Create new Parameter.
Maintain selection options to new parameter.
Save and back.
Select "T" in selection variable against Field name :Controlling Area.
Select the selection variable(Newly created Parameter)
Regards
Mahesh -
Problem while exporting ALV column header to excel sheet.
Hi,
I am able to export an ALV grid details to an excel sheet. But the ALV column headers when exported to excel sheet are getting truncated.
For eg: if my column header in ALV grid is displayed as 'Material' then the column header in excel sheet is 'Mater' only. Remaining portion is getting truncated.
How can I view the entire column header text?
Kindly assist.
Thanks.I have the same problem with you, when user export to excel. I fixed it by using
w_layo-colwidth_optimize = 'X'. <<<<<<<<<<<<This
perform generate_fcat_reftab
using 'PRUEFLOS' 'T_INPUT' '' '' 'Inspection Lot' 0.
form generate_fcat_reftab using p_fieldname
p_tabname
p_ref_tabname
p_ref_fieldname
p_output_text
p_output_lenght.
clear w_fcat.
w_fcat-fieldname = p_fieldname.
w_fcat-tabname = p_tabname.
w_fcat-ref_fieldname = p_ref_fieldname.
w_fcat-ref_tabname = p_ref_tabname.
w_fcat-seltext_s = p_output_text.
w_fcat-seltext_m = p_output_text.
w_fcat-seltext_l = p_output_text.
w_fcat-outputlen = p_output_lenght.
w_fcat-ddictxt = 'L'. <<<<<<<<<<<<<<<<<<This
append w_fcat to t_fcat.
endform. -
Is it possible to create a column in runtime?
Hi,
I created a application that connect with Access database. I just wonder is it possible for user to create a column in runtime, because the application need this kind of interaction.
Many thanks,
AnnHere's code to do that
static void addColumn(Connection dbConn, String cname)
Statement ins;
String sql = "ALTER TABLE TestTable ADD "+cname+" CHAR(20)";
try
ins = dbConn.createStatement();
ins.executeUpdate(sql);
ins.close();
catch (SQLException se){fail(se);}
}The rest of my TestODBC example can be found at
http://forum.java.sun.com/thread.jsp?forum=31&thread=453376 -
Show image in Web Dynpro ALV column
Hello everybody,
I have a WD component with an ALV table bound to a context node. Works very fine so far.
Now in the first column of the node I have put an image source (MIME object in my WD component).
I configured the first ALV column as Link To Action and now would like to link it to the image source. My problem is that the image is not loaded in the ALV.
This is my coding (INIT method of my view):
METHOD wddoinit .
DATA: lo_alv_cmp TYPE REF TO if_wd_component_usage,
lo_alv_if TYPE REF TO iwci_salv_wd_table,
lo_alv_config TYPE REF TO cl_salv_wd_config_table,
lo_column_settings TYPE REF TO if_salv_wd_column_settings,
lo_column TYPE REF TO cl_salv_wd_column,
lo_link_to_action TYPE REF TO cl_salv_wd_uie_link_to_action.
get instance of ALV component
lo_alv_cmp = wd_this->wd_cpuse_alv( ).
IF lo_alv_cmp->has_active_component( ) IS INITIAL.
lo_alv_cmp->create_component( ).
ENDIF.
get instance of ALV Interface Controller
lo_alv_if = wd_this->wd_cpifc_alv( ).
configure ALV
lo_alv_config = lo_alv_if->get_model( ).
lo_column_settings ?= lo_alv_config.
lo_column = lo_column_settings->get_column( 'IMAGE' ).
CREATE OBJECT lo_link_to_action.
fix settings for test purpose (how must I change it to get the information from the context node??)
lo_link_to_action->set_image_height( '50px' ).
lo_link_to_action->set_image_width( '50px' ).
lo_link_to_action->set_image_source( 'ICE Flottenportal.jpg' ).
lo_column->set_cell_editor( lo_link_to_action ).
ENDMETHOD.
Thanx a lot in advance for any help!!Thanks a lot for your helpful advice.
I now found that method cl_wdr_utilities=>get_mime_path is the best way to get the path.
But one question is still open:
How can I retrieve my image source from the context? Do I have to read the context and then write it to the image_source attribute? Or ist there a more elegant solution?
Thank you for any help! -
How to Display Formatted Text IN ALV Column?
HI experts ,
I am displaying ALV with Multiple Column's , One of the Column is TEXT(Fomatted text).
When ALV is Displayed TEXT Column Comes as Continues TEXT . and is Not Formatted .
Now when i want to edit this text i am Calling another View which contains text edit . This Text edit will display correct Formatted Text . but when i save it and Come back to ALV again i do see continues text .
Is there any way where in i can display the Formatted text in ALV Column ?
Any body have any clue with this ...
Thanks in Advance
Patil
Edited by: Badarinarayan Patil on Feb 22, 2008 3:45 PMHi Juergen,
I found Your blog and found it really interesting... though I was not able to use it: I (like Jun Li is asking, I guess) need to use a dynamic text, containing formatting informations (according the xhtml syntax).
I tried to pass it to the form by an ABAP-dictionary based interface and by means of the context (in a webdynpro page), but both tries failed.
Some suggestion will be greatly appreciated.
Thankyou
Simone -
Drag And Drop in ALV Column Tree
Hello All,
Can anyone tell me the method used for a drag and drop in a column tree....
i found it for a simple tree but not for a column tree.....
thanks in advance....
Regards,
PraveenCheck the links -
drag drop required for alv column!
drag and drop in a tree
Drag&Drop within the Tree
Drag&Drop within a tree
Drag and drop in ALV tree
Regards,
Amit
Reward all helpful replies. -
Can we change width of the column at runtime
I have a report with columns assigned runtime, can we change width of the colimn runtime?
for example Query: select &lp_1, &lp_2 from emp &LP_Where
if i assign lp_1 empno size 10 and empname size 50. Vertical and horizantal elasticty is not going work for me. Any suggestions please..
LalithaDoubt there is the dynamic you are seeking.
But you may put a few overlapped columns (diff. length of course) and display/hide by passing parameters.
Maybe you are looking for
-
I started a "duplicate file process" and decided to stop it. When I pressed the "cancel" button, the program is taking forever to stop. Is there a way to get it to stop, or should I just wait it out?
-
How to remove scour in safari?
Does anyone know how to remove scour.com add in in safari?
-
My iDVD(7.1.2) one step recording loops indefinitely. It was done from an iMovie (9.0.4). Is there a way to stop the looping?
-
Displaying pages in classical report output
Hi all, I am developing a report. In the report output I am displaying 4 lines. When I click on 1st line then list will display but on the second page after the intial output page and when I click on 2nd line then list will display on the third page
-
Cisco conferencing solution vs competitors
Hi, Anyone here has experience deploying video over IP (Cisco Unified) vs competitors such as Microsoft Live Communication Server? I know that this is a Cisco forum, but I am wondering whether one has indication on which vendor has been more widely a