cancel
Showing results for 
Search instead for 
Did you mean: 

Refresh ALV Table columns

Former Member
0 Kudos

Dear Experts,

Can any help me in "How to refresh ALV table columns "?

The scenario is : I have ALV table in my webdynpro component with

1st column has dropdown values (Say USERNAME , EMAIL , USER ID).

2nd Column has the facility(F4) to select values based values on 1st Column.

3rd Column has the relative description of 2nd Column values.

Now when i select USERNAME from my 1st column dropdown, and on click of F4 of 2nd column,the values related to  USERNAME will display,the user can select any USERNAME value and on click of OK,Im populating the 2nd column with the value selected in F4 POPUP and 3rd Column with its respective description.

Now my 1st column in still in editable mode, But when User changes the dropdown value of 1st column from " USERNAME" to "EMAIL",The already polpulated values of USERNAME in COL-2 and COL-3 should be refreshed.

Pls help me to achieve this functionality.

Thanks in advance

Santhosh

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Santhosh,

You can achieve your requirement as below

  • set alv table settings as below ( here lo_model is reference to alv model )

  lo_model->if_salv_wd_table_settings~set_cell_action_event_enabled(

abap_true ).

  lo_model->if_salv_wd_table_settings~set_read_only( abap_false ).

  • Create an event handler in view for action 'ON_CELL_ACTION" of alv as below

    

  • Add the below code in event handler

  DATA lo_node    TYPE REF TO if_wd_context_node.
  DATA lo_el      TYPE REF TO if_wd_context_element.

  " Nothing to do if column name is not "COLUMN1'
  IF r_param->column NE 'COLUMN1'.
    RETURN.
  ENDIF.

  lo_node = wd_context->get_child_node( name = wd_this->wdctx_table )." replace with your node name

  "Get the element based on current index
  lo_el = lo_node->get_element( index = r_param->index ).


  IF lo_el IS BOUND.

    "first name
    lo_el->set_attribute(
      EXPORTING
        value = space    "clear value
        name  = 'FIRST_NAME'  "replace it with your ctx attr name
    ).

    "last name
    lo_el->set_attribute(
      EXPORTING
        value = space    "clear value
        name  = 'LAST_NAME' "replace it with your ctx attr name
    ).

  ENDIF.

Note: replace the node name, field names as per your application

Hope this helps you.

Regards,

Rama

Former Member
0 Kudos

hi,

You can achieve this functionality, by clearing the values in col2 and col3 when an event trigger in col1.

when dropdown is selected while populating f4 functionality clear(set null_attribute) the col2,col3 and populate f4. 

Regards,

Ashok.

Former Member
0 Kudos

Thank you Rama.

BR,

Santhosh

Former Member
0 Kudos

Thank you Siva.

BR,

Santhosh

Answers (1)

Answers (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Santhosh,

Is your issue resolved? If yes, please close the discussion.

Regards,

Rama