Skip to Content

Editable / Non editable input field CELL (individually) on ALV dynamically

Hi again,

I need more help with an issue.

I have an ALV table with three columns that is necessary put values into input field cell editors, but these cells should be editable or not depending of business logic. I've got make editable or non in entire ROW LEVEL (method set_read_only_fieldname( 'READ_ONLY' )., but ¿how can I set editable or non at individual cells?

Any idea to do that?

Regards

Edited by: vanbelal on Mar 24, 2010 3:33 PM

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    avatar image
    Former Member
    Mar 24, 2010 at 03:05 PM

    Hi,

    You need to create another variable / field to the context node which is bound to the ALV and set the values for it dynamically based on business logic.

    Then use this fields value in the WDDOINIT of the view holding the ALV component to make individual cell active / inactive.

    Get the ref. to all the columns and set them based on the value of this additional field.

    Thanks,

    Abhishek

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Alfonso Vandellós

      the code will go some like this:

      • lets say CELL_INPUT is the field added to the context which will be set

      • now in the WDDOINIT of the view . get the ref of all the columns then loop thru

      LOOP AT GT_COLUMNS INTO GS_COLUMN.

      CASE GS_COLUMN-ID.

      WHEN 'FIELD1'. "this cell we are interested in

      DATA: LR_INPUT TYPE REF TO CL_SALV_WD_UIE_INPUT_FIELD.

      CREATE OBJECT LR_INPUT

      EXPORTING

      VALUE_FIELDNAME = GS_COLUMN-ID.

      LR_INPUT->SET_READ_ONLY( CELL_INPUT ). "this will dynamically make it write protected

      GS_COLUMN-R_COLUMN->SET_CELL_EDITOR( LR_INPUT ).

      ENDCASE.

      ENDLOOP.

      This should work. I have not tried it but should work 😊

      Thanks,

      Abhishek

  • avatar image
    Former Member
    Mar 25, 2010 at 03:43 AM

    Hi,

    Refer to this link which has the code snippet which would be useful -

    [Editable ALV with check box|http://divulgesap.com/blog.php?p=Njc=]

    Cheers,

    Ravi

    Add comment
    10|10000 characters needed characters exceeded