cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with different attribute properties in each row and column in a ALV component

Former Member
0 Kudos

Hi Guys,

I need to implement an ALV that can have editable and non-editable rows. I assign to the context for each element its corresponding properties of an attribute, When i debugg I can see them but in the ALV are always the same. When I create an ALV:

1°  Get or create the instance of ALV

2° Set a correct format for ALV:

3° Create the input field assigning each column to a  fieldname in a context

lr_aux->set_enabled_fieldname

lr_aux->set_read_only_fieldname

...

and so on

4° I assign its corresponding properties for each element in the context.

Finally I see the ALV with the same properties in all columns.

The main idea should be something like the following scracth:

+editable

-read only

+|+|+|-

-|-|+|+

+|+|-|-

But now are all the same

How could I solve it?

Thanks

Sergio.

Accepted Solutions (1)

Accepted Solutions (1)

former_member210266
Active Participant
0 Kudos

Hi Sergio

For that you need to add same number of technical columns as the number of columns your ALV has.

Then set the read only fieldname for each column with unique technical column name and handle the values of the technical column separately.

Regards

Swati

Former Member
0 Kudos

Hi Sergio,

I guess you might have missed one of the following things. .

1.   lo_model->if_salv_wd_table_settings~set_read_only( abap_false ).

This is mandatory to use if you want to make your ALV editable.

2.  lr_aux->set_enabled_fieldname( )

Do not use this. Instead use only lr_aux->set_read_only_fieldname( ) with the column name that contains your Boolean values abap_true and abap_false for editable rows and non editable rows.

Thanks,

Vishu Agarwal


Answers (1)

Answers (1)

0 Kudos

Hi Sergio ,

You can try something like this...

1. Create one node say NODE1 with required attributes.

2. Create another node2 say NODE2 with same number of attributes of first node, and data type of each attribute should be WDY_BOOLEAN. (Here attribute names of Node1 and Nod2 should be same).

3. Bind readonly property of each attribute with node2 attributes.

4. Now handle readonly property as follows.      

    lo_nd_node1 = wd_context->path_get_node( path = `NODE1` ).
    lo_el_node1 = lo_nd_node1->get_element( ).

    lo_nd_node2 = wd_context->path_get_node( path = `NODE2` ).
    lo_el_node2 = lo_nd_node2->get_element( ).

    lo_nd_node1->get_static_attributes_table( IMPORTING table = lt_node1 ).

      LOOP AT lt_node1 INTO ls_node1 .


      IF ls_node1-<XYZ> = 'ABC'.
        lo_el_node2->set_attribute( name = -<XYZ> value = abap_true ).

        lo_el_node2->set_attribute( name = -<PRQ> value = abap_false ).

      .

      .

      .

      ENDIF.

    

     ENDLOOP.

Regards,

     ELSEIF ls_node2-<PQR> = 'LMN'.

Venkat