How to hide selection-screen fields dynamically

Hiding fields on selection-screen dynamically

Screen 1

 1

Screen 2

 2

 

Codes:

 

report  zanil   .

* Selection-Screen Hiding Fields Dynamically

tablesmara.

parameterrb1 radiobutton group rb1

           default ‘X’ user-command comm.

parameterrb2 radiobutton group rb1 .

selectoptions:

s_matnr for maramatnr no intervals

                       modif id I1.

at selection-screen output.

  if rb1 eq ‘X’.

  loop at screen.

    case screengroup1.

      when ‘I1’.

        screenactive ‘1’.

        modify screen.

    endcase.

  endloop.

  else.

  loop at screen.

    case screengroup1.

      when ‘I1’.

        screenactive ‘0’.

        modify screen.

    endcase.

  endloop.

  endif.

How build fieldcatalog dynamically

Building fieldcat dynamically.

Class-Method:

 1

Parameters:

 2

 

Codes:

 

data lt_fieldcat type slis_t_fieldcat_alv.

data ls_fieldcat type slis_fieldcat_alv.

data ls_layout   type      slis_layout_alv.

data lo_aele  type ref to cl_abap_elemdescr.

data lo_asdes type ref to cl_abap_structdescr.

data ls_dfies type        dfies.

field-symbols <fs_comp>  

          like line of lo_asdes->components.

field-symbols <fs_field> type any.

* Creating Structure Obj.

lo_asdes ?= cl_abap_structdescr=>describe_by_data(

   p_data is_structure ).


How to make an object visible or invisible dynamically.

1-) Define an attribute named ‘WDUI_Visibility’

       Set its TYPE as ‘WDUI_VISIBILITY’

 

2-) Open your objects properties which you

       You want to make visible or invisible.

 1

3-) Set  attribute ‘WDUI_Visibility’ object you have created

     at  ‘Visible’ property.

 2

Codes:

 

 DATA lo_el_context TYPE REF TO if_wd_context_element.

 DATA ls_context TYPE wd_this->Element_context.

 DATA lv_wdui_visibility TYPE wd_this->Element_contextwdui_visibility.

 lo_el_context wd_context->get_element( ).

 lv_wdui_visibility ‘1’. “1-Unvisible 2 Visible

 lo_el_context->set_attribute(

   name =  `WDUI_VISIBILITY`

   value lv_wdui_visibility ).