on 01-24-2014 10:17 AM
Hi,
I have got the following requirement.
I have called a component from my enhanced standard component.In the output View,I need to make 3 standard buttons invisible.
I cannot not delete the UI elements since they are being already used in some other component. There are no binding properties already available and system is not allowing to bind properties to those buttons.
Please advice on what to write in the WDDOMODIFYVIEW of that view to make those buttons invisible. I can write the bypass code to happen the invisibility only on my requirement.
I got this following code from
IWDBotton btn = (iWDButton) view.getElement("<your button iD>");
btn.setEnabled(false);
But unable to decipher it and also it has syntax error
Hi,
if you are using Webdynpro Java, please post your question there.
regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kishore,
You can achieve your requirement as below
- Enhance the view and user either PostExit or OverWrite of method WDDOMODIFYVIEW( ) of view
- Identify the name of the buttons in view layout
- Get the element from view by using VIEW reference
- Now, set the property VISIBLE of the element
Example: Let us say we have button names as BTN_DISPLAY, BTN_BACK, etc
DATA lo_ui_element type ref to CL_WD_UIELEMENT.
DATA lo_container TYPE REF TO cl_wd_uielement_container.
" get root container
lo_container ?= view->get_root_element( ).
" get button reference
lo_ui_element ?= lo_container->get_element( 'BTN_DISPLAY' ).
"Hide the element
lo_ui_element->set_visible( cl_wd_uielement=>e_visible-none ).
"Repeat the same for other buttons as well
Please refer the below link for more information:
----------------------------------------
You can also hide the buttons by using customization of WD component.
Please refer the below link
Customize view fields using application configuration in Webdynpro ABAP
Hope this helps you.
Regards,
Rama
Hi Kishore,
Could you share the release of your system.
You can also hide the buttons by using customization:
Please refer the below link
Customize view fields using application configuration in Webdynpro ABAP
Hope this helps you.
Regards,
Rama
Hi Kishore,
We have below options to achieve your requirement
Please try the below steps for option 2
DATA lt_children TYPE cl_wd_uielement=>tt_uielement.
DATA lo_container TYPE REF TO cl_wd_uielement_container.
FIELD-SYMBOLS: <fs_ui_element> TYPE REF TO cl_wd_uielement.
CLEAR lt_children.
lo_container ?= view->get_root_element( ).
lt_children = lo_container->get_children( ).
LOOP AT lt_children ASSIGNING <fs_element>.
IF <fs_element>-id = 'BTN_DISPLY' OR
<fs_element>-id = 'BTN_BACK'.
<fs_element>->set_visible( cl_wd_uielement=>e_visible-NONE ).
ENDIF.
ENDLOOP.
Hope this helps you.
Regards,
Rama
Hi Kishore,
Sorry, it should be like this <fs_element>->id
DATA lt_children TYPE cl_wd_uielement=>tt_uielement.
DATA lo_container TYPE REF TO cl_wd_uielement_container.
FIELD-SYMBOLS: <fs_ui_element> TYPE REF TO cl_wd_uielement.
CLEAR lt_children.
lo_container ?= view->get_root_element( ).
lt_children = lo_container->get_children( ).
LOOP AT lt_children ASSIGNING <fs_element>.
IF <fs_element>->id = 'BTN_DISPLY' OR
<fs_element>->id = 'BTN_BACK'.
<fs_element>->set_visible( cl_wd_uielement=>e_visible-NONE ).
ENDIF.
ENDLOOP.
Regards,
Rama
Hi Kishore,
Your view elements are structured inside many transparent containers. So, we need recursive search to find our element.
ROOT_UIELEMENT ----> TRANSAPRENT_CONTAINER---->.........>BTN_DISPLAY
Please check my document as below .. which uses recursive search
How to Hide UI Elements & Adjust View Layout Dynamically in Web Dynpro ABAP
If you need further assistance let me know. Also share snap shot the view elements structure from layout.
Regards,
Rama
Hi Kishore,
Thanks for mailing the snap shot of view layout.
Your actual requirement : Dynamically hide the tool bar buttons in a table
Please write the below code in PostExit/OverWrite of WDDOMODIFY( ) of view
DATA lo_root TYPE REF TO cl_wd_uielement_container.
DATA lo_table TYPE REF TO cl_wd_table.
DATA lo_toolbar TYPE REF TO cl_wd_toolbar.
DATA lt_items TYPE if_wd_toolbar_item=>tt_toolbar_item.
DATA LO_UI_EL TYPE REF TO CL_WD_UIELEMENT.
FIELD-SYMBOLS <fs_items> LIKE LINE OF lt_items.
lo_root ?= view->get_root_element( ).
lo_table ?= lo_root->get_child( id = 'STAFFINGTABLE').
lo_toolbar = lo_table->get_toolbar( ).
lt_items = lo_toolbar->get_toolbar_items( ).
LOOP AT lt_items ASSIGNING <fs_items>.
lo_UI_EL ?= <fs_items>.
if lo_ui_el IS BOUND AND
( lo_ui_el->id eq 'BTN_1' or
lo_ui_el->id eq 'BTN_2' ).
lo_ui_el->set_visible( value = cl_wd_toolbar_button=>e_visible-none ).
ENDIF.
ENDLOOP.
Note: Replace tool bar buttons BTN_1, BTN_2 as per your requirement
Hope this resolves your issue.
Regards,
Rama
Kishore,
You can enhance the view and create Pre-Exit method. Inside the method please write the below code.
DATA: ui_element TYPE REF TO if_wd_view_element,
button TYPE REF TO cl_wd_button.
CALL METHOD view->get_element
EXPORTING
id = 'BUTTON1' "( ID of UI Element in Layout)
RECEIVING
element = ui_element.
button ?= ui_element."( Casting)
CALL METHOD button->set_visible
EXPORTING
value = '01' " Invisible.
Thanks,
Naga
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
The below highlighted line is throwing dump
DATA: ui_element TYPE REF TO if_wd_view_element,
button TYPE REF TO cl_wd_button.
CALL METHOD view->get_element
EXPORTING
id = 'BUTTON1' "( ID of UI Element in Layout)
RECEIVING
element = ui_element.
button ?= ui_element."( Casting)
CALL METHOD button->set_visible
EXPORTING
value = '01' " Invisible.
Description : Dynamic type conflict when assigning references
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.