Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ABAP Webdynpro : Unable to hide fields on initial screen

Former Member
0 Likes
827

Hi Team,

I have created one group and one button in one view of custom WD. In this group, there are 2 checkboxs.

My requirement is that initially only Button should be there on output screen and when user presses the button, only then group should be displayed.

For this, I have tried to write code in "WDDOMODIFYVIEW" method of view to  hide the block initially and then in the Action method of button to make it visible.

    CALL METHOD lo_el_incident->set_attribute_property
    EXPORTING
      attribute_name = 'First Check Box Name'

      property       = lo_el_incident->e_property-visible
      value          = abap_false.

But above has NO effect.

I am new to web dynpro.Could you please help me in some sample code for the same.

Warm Regards,

Krishan

Hi Team,

I have created one group and one button in one view of custom WD. In this group, there are 2 checkboxs.

My requirement is that initially only Button should be there on output screen and when user presses the button, only then group should be displayed.

For this, I have tried to write code in "WDDOMODIFYVIEW" method of view to  hide the block initially and then in the Action method of button to make it visible.

    CALL METHOD lo_el_incident->set_attribute_property
    EXPORTING
      attribute_name = 'First Check Box Name'

      property       = lo_el_incident->e_property-visible
      value          = abap_false.

But above has NO effect.

I am new to web dynpro.Could you please help me in some sample code for the same.

Warm Regards,

Krishan

4 REPLIES 4
Read only

Former Member
0 Likes
716

Hi Krishan,

There is more than one possibility to do this. Here is one method.

1) Create an attribute of type BOOLEAN in your context. In our example, we'll call it GROUP_VISIBILITY.

2) Map the visibility property of your group with GROUP_VISIBILITY

3)In the "onAction" method of the button, change the GROUP_VISIBILITY and set it to true (' X').

Hope this can you help,

Regards,

Christophe

Read only

0 Likes
716

Hi Christophe,

Thanks for your reply.

I have procedded as suggested by you, but need your small help again.

Initially I have make the visibily property FALSE and the group does not appear on screen.

But unble to make it visible.

I have written below code..but it had no effect when I click on button.

Please suggest

   * @TODO fill attribute
  lv_group_visibility = 1.


* set single attribute
  lo_el_context->set_attribute(
    name `GROUP_VISIBILITY`
    value = lv_group_visibility ).

Read only

0 Likes
716

Hi Krishan,

Try with this:

   * @TODO fill attribute
  lv_group_visibility = 'X'.

Regards,

Christophe

Read only

Former Member
0 Likes
716

Hi Krishan,

     Try the below code snippet to hide the UI element. The code has been done in method

  WDDOMODIFYVIEW of the view.

     data : l_container TYPE REF TO CL_WD_UIELEMENT_CONTAINER,
              l_group TYPE REF TO CL_WD_UIELEMENT.

    

  l_container ?= view->get_element('ROOTUIELEMENTCONTAINER').

  CALL METHOD l_container->get_child
    EXPORTING
      id        = 'GROUP'                    "ID of the group created in the view
    receiving
      the_child = l_group.

   l_group->set_visible( 01 ).

Following the above steps will make the group invisible when you run the application. Use the same code to enable the group when you click on the button, except for l_group->set_visible( ) method. To make the group visible use l_group->set_visible( 02 ) instead of l_group->set_visible( 01 ).

Hope this helps,

~Athreya