Skip to Content
avatar image
Former Member

WITHIN THE SAME ALV GRID : INPUT FIELD / TEXT VIEW

Wihin one column is it possible to have some cell as input fields, some as text view ?

regards

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

3 Answers

  • Best Answer
    Apr 29, 2009 at 02:08 PM

    Yes, you have mutliple Cell Editors and control which cell editor is active based upon an attribute binding.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 29, 2009 at 03:25 PM

    Hi Stephan,

    here is a document explains how make columns editable

    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/d0155eb5-b6ce-2b10-3195-d9704982d69b

    Regards,

    Abdul

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Apr 30, 2009 at 06:24 AM

    Hey!

    Yes,you can use input field,text view ,link,checkbox or button and so on in column of the same alv gird.

    Sample of code:

      DATA: LR_CMP_USAGE           TYPE REF TO IF_WD_COMPONENT_USAGE,
            LR_INTERFACECONTROLLER TYPE REF TO IWCI_SALV_WD_TABLE,
            LR_CONFIG_TABLE        TYPE REF TO CL_SALV_WD_CONFIG_TABLE,
            LR_SALV_SETTINGS       TYPE REF TO IF_SALV_WD_TABLE_SETTINGS,
            LR_COLUMN              TYPE REF TO CL_SALV_WD_COLUMN,
            LR_INPUTFIELD          TYPE REF TO CL_SALV_WD_UIE_INPUT_FIELD,
            LR_TEXTVIEW            TYPE REF TO CL_SALV_WD_UIE_TEXT_VIEW.
    
      LR_CMP_USAGE = WD_THIS->WD_CPUSE_ALV_GRID( ).
      IF LR_CMP_USAGE->HAS_ACTIVE_COMPONENT( ) IS INITIAL.
        LR_CMP_USAGE->CREATE_COMPONENT( ).
      ENDIF.
      LR_INTERFACECONTROLLER = WD_THIS->WD_CPIFC_ALV_GRID( ).
      LR_CONFIG_TABLE = LR_INTERFACECONTROLLER->GET_MODEL( ).
      LR_SALV_SETTINGS ?= LR_CONFIG_TABLE.
    
      CALL METHOD LR_SALV_SETTINGS->SET_READ_ONLY
        EXPORTING
          VALUE  = ABAP_FALSE.
    
      LR_COLUMN = LR_CONFIG_TABLE->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'LUGGWEIGHT' ).
      CREATE OBJECT LR_INPUTFIELD
        EXPORTING
          VALUE_FIELDNAME = 'LUGGWEIGHT'.
      CALL METHOD LR_INPUTFIELD->SET_READ_ONLY
        EXPORTING
          VALUE  = ABAP_FALSE.
      CALL METHOD LR_INPUTFIELD->SET_ALIGNMENT
        EXPORTING
          value  = CL_WD_ABSTRACT_INPUT_FIELD=>E_ALIGNMENT-CENTER.
      CALL METHOD LR_COLUMN->SET_CELL_EDITOR
        EXPORTING
          VALUE  = LR_INPUTFIELD.
    
      LR_COLUMN = LR_CONFIG_TABLE->IF_SALV_WD_COLUMN_SETTINGS~GET_COLUMN( 'SMOKER' ).
      CREATE OBJECT LR_TEXTVIEW.
      CALL METHOD LR_TEXTVIEW->SET_TEXT_FIELDNAME
        EXPORTING
          VALUE  = 'SMOKER'.
      CALL METHOD LR_TEXTVIEW->SET_DESIGN
        EXPORTING
          VALUE  =  CL_WD_TEXT_VIEW=>E_DESIGN-EMPHASIZED.
      CALL METHOD LR_TEXTVIEW->SET_SEMANTIC_COLOR
        EXPORTING
          VALUE  =  CL_WD_TEXT_VIEW=>E_SEMANTIC_COLOR-NEGATIVE.
      CALL METHOD LR_COLUMN->SET_CELL_EDITOR
        EXPORTING
          VALUE  = LR_TEXTVIEW.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      I know how to set a column as input field, anotherone as text view !

      The point in in 1 and only one... for different rows, to have differences!