Making Fields editable in ALV

I am displaying the custom table entries in an ALV. i am trying to make the fields in the ALV as editable. All the fields got enabled but only first field is in disabled mode. its type is NUMC. Can i know the reason behind this ?
Here is the code that i am using to make the fields editable.
  IF v_flag = 'X'.
    lr_table_settings ?= l_value.
    lr_table_settings->set_read_only( abap_false ).
    lr_column_settings ?= l_value.
    lr_column = lr_column_settings->get_column( 'PROJ_ID' ).
    CREATE OBJECT lr_input_field
      EXPORTING
        value_fieldname = 'PROJ_ID'.
    lr_column->set_cell_editor( lr_input_field ).
    lr_column_settings ?= l_value.
    lr_column = lr_column_settings->get_column( 'ACCOUNT_NAME' ).
    CREATE OBJECT lr_input_field
      EXPORTING
        value_fieldname = 'ACCOUNT_NAME'.
    lr_column->set_cell_editor( lr_input_field ).
    lr_column_settings ?= l_value.
    lr_column = lr_column_settings->get_column( 'ZTASK' ).
    CREATE OBJECT lr_input_field
      EXPORTING
        value_fieldname = 'ZTASK'.
    lr_column->set_cell_editor( lr_input_field ).
  ELSE.
    lr_table_settings ?= l_value.
    lr_table_settings->set_read_only( abap_true ).
    lr_column_settings ?= l_value.
    lr_column = lr_column_settings->get_column( 'PROJ_ID' ).
    CREATE OBJECT lr_input_field
      EXPORTING
        value_fieldname = 'PROJ_ID'.
    lr_column->set_cell_editor( lr_input_field ).
    lr_column_settings ?= l_value.
    lr_column = lr_column_settings->get_column( 'ACCOUNT_NAME' ).
    CREATE OBJECT lr_input_field
      EXPORTING
        value_fieldname = 'ACCOUNT_NAME'.
    lr_column->set_cell_editor( lr_input_field ).
    lr_table_settings ?= l_value.
    lr_table_settings->set_read_only( abap_true ).
    lr_column_settings ?= l_value.
    lr_column = lr_column_settings->get_column( 'ZTASK' ).
    CREATE OBJECT lr_input_field
      EXPORTING
        value_fieldname = 'ZTASK'.
    lr_column->set_cell_editor( lr_input_field ).
  ENDIF.

Hi Manjunath,
I dont undersatnd what you are trying to write.Because you write same logic in the if and else part.What is purpose of it.
Try to take different variables for columns.
IF v_flag = 'X'.
lr_table_settings ?= l_value.
lr_table_settings->set_read_only( abap_false ).
lr_column_settings ?= l_value.
lr_column1= lr_column_settings->get_column( 'PROJ_ID' ).
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = 'PROJ_ID'.
lr_column1->set_cell_editor( lr_input_field ).
lr_column_settings ?= l_value.
lr_column2 = lr_column_settings->get_column( 'ACCOUNT_NAME' ).
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = 'ACCOUNT_NAME'.
lr_column2->set_cell_editor( lr_input_field ).
lr_column_settings ?= l_value.
lr_column3 = lr_column_settings->get_column( 'ZTASK' ).
CREATE OBJECT lr_input_field
EXPORTING
value_fieldname = 'ZTASK'.
lr_column3->set_cell_editor( lr_input_field ).
endif.

Similar Messages

  • How to make a particular row and column field editable in ALV

    Hi Experts,
    I have a requirement to make a particular row and column field editable in ALV output. Like i need to make 2nd row - 4th column editable of ALV output.
    Kindly help me out to solve this.
    Any help would be appreciated.
    Thanks,
    Ashutosh

    Hi Ashutosh,
    please check below, explained by some experts.
    In the below link  editing two columns MOD_RANK and TECH_RANK.
    These two columns will be in edit mode once after selecting the required record
    Editing single cell in a row of ALV table
    And also look for more info
    http://scn.sap.com/thread/884976

  • How to make field editable in ALV tree in OOPs?

    Hi Gems,
    Again I need help from you all.
    I am writing a program using OOPs and the uotput will be in ALV tree. I need to make a field editable in a perticular row.
    I am doing it using layout but the program is giving error during
    CALL METHOD CL_GUI_CFW=>FLUSH
          EXCEPTIONS
            CNTL_SYSTEM_ERROR = 1
            CNTL_ERROR        = 2.
    This method is returning sy-subrc = 2 and I am unable to get the output.
    I am using below code to make the field editable:
    DATA: LT_LAYOUT_ITEM TYPE LVC_T_LAYI,
                LS_LAYOUT_ITEM TYPE LVC_S_LAYI.
      LS_LAYOUT_ITEM-FIELDNAME = 'ACPCKTWRT'.     "ACPCKTWRT is the field name in the Internal table
      LS_LAYOUT_ITEM-EDITABLE = 'X'.
      APPEND LS_LAYOUT_ITEM TO LT_LAYOUT_ITEM.
    CALL METHOD G_ALV_TREE->ADD_NODE
        EXPORTING
          I_RELAT_NODE_KEY     = FP_RELAT_KEY
          I_RELATIONSHIP       = CL_GUI_COLUMN_TREE=>RELAT_LAST_CHILD
          IS_OUTTAB_LINE       = LS_TMP_FINFCNO                                                "structure of the internal table
         IS_NODE_LAYOUT       =
          IT_ITEM_LAYOUT       = LT_LAYOUT_ITEM                                                "Added layout to make the field editable
          I_NODE_TEXT          = LV_NODE_TEXT                                                      "Node text
        IMPORTING
          E_NEW_NODE_KEY       = FP_NODE_KEY
        EXCEPTIONS
          RELAT_NODE_NOT_FOUND = 1
          NODE_NOT_FOUND       = 2
          OTHERS               = 3
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                   WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Please help me and let me know how to get the solution.

    Hello
    The ALV tree control is not intended for making values editable (e.g. see
    [How to make ALV tree columns editable|http://sap.ittoolbox.com/groups/technical-functional/sap-abap/how-to-make-alv-tree-columns-editable-2052414])
    However, if you need an editable tree control then you have to use a different class (e.g. CL_ITEM_TREE_MODEL or CL_COLUMN_TREE_MODEL) but you will not have the ALV functionality of the ALV tree control.
    Regards
      Uwe

  • Field editable in alv

    Hi,
    I'm using REUSE_ALV function module for the ALV display. I want to make a particular field editable in my display. How do I do it, and if I do it will the edited value get updated in my internal table as well.
    Thanks for the help in advance.
    Regards,
    Vijay

    Hi,
    there is sample code for it...
    REPORT  ZTESTDFALV1                             .
    *Data Declaration
    DATA: BEGIN OF T_EKKO,
      EBELN TYPE EKPO-EBELN,
      EBELP TYPE EKPO-EBELP,
    *  FLAG TYPE C,
    *  HANDLE_STYLE TYPE LVC_T_STYL,
    END OF T_EKKO.
      DATA: GD_REPID LIKE SY-REPID, "Exists
      REF_GRID TYPE REF TO CL_GUI_ALV_GRID. "new
    DATA: BEGIN OF IT_EKKO OCCURS 0.
            INCLUDE STRUCTURE T_EKKO.
    DATA: END OF IT_EKKO.
    DATA: BEGIN OF IT_BACKUP OCCURS 0.
            INCLUDE STRUCTURE T_EKKO.
    DATA: END OF IT_BACKUP.
    *ALV data declarations
    TYPE-POOLS: SLIS.                                 "ALV Declarations
    DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          GD_LAYOUT    TYPE SLIS_LAYOUT_ALV.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM DATA_RETRIEVAL.
      PERFORM BUILD_FIELDCATALOG.
      PERFORM BUILD_LAYOUT.
      IT_BACKUP[] = IT_EKKO[].
      PERFORM DISPLAY_ALV_REPORT.
    *&      Form  build_fieldcatalog
    *       text
    FORM BUILD_FIELDCATALOG.
      REFRESH FIELDCATALOG.
      CLEAR FIELDCATALOG.
      FIELDCATALOG-FIELDNAME   = 'EBELN'.
      FIELDCATALOG-SELTEXT_M   = 'Purchase Order'.
      FIELDCATALOG-INPUT     = 'X'.
      FIELDCATALOG-EDIT     = 'X'.
      FIELDCATALOG-COL_POS     = 2.
      APPEND FIELDCATALOG.
      CLEAR  FIELDCATALOG.
      FIELDCATALOG-FIELDNAME   = 'EBELP'.
      FIELDCATALOG-SELTEXT_M   = 'PO Item'.
      FIELDCATALOG-COL_POS     = 3.
      APPEND FIELDCATALOG.
      CLEAR  FIELDCATALOG.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    FORM BUILD_LAYOUT.
      "Permet d'ajuster les colonnes au text
    *  gd_layout-colwidth_optimize = 'X'.
    *  GD_LAYOUT-TOTALS_TEXT       = 'Totals'(201).
    *  gd_layout-box_fieldname = 'SELECT'.
    *  gd_layout-box_tabname   = 'IT_EKKO'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    FORM DISPLAY_ALV_REPORT .
      GD_REPID = SY-REPID.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                I_CALLBACK_PROGRAM        = GD_REPID
    *            i_callback_top_of_page   = 'TOP-OF-PAGE'
                I_CALLBACK_PF_STATUS_SET  = 'SET_PF_STATUS'
                I_CALLBACK_USER_COMMAND   = 'USER_COMMAND'
    *            i_grid_title             = 'My Title'
                IS_LAYOUT                 = GD_LAYOUT
                IT_FIELDCAT               = FIELDCATALOG[]
           TABLES
                T_OUTTAB                  = IT_EKKO
           EXCEPTIONS
                PROGRAM_ERROR             = 1
                OTHERS                    = 2.
      IF SY-SUBRC <> 0.
        WRITE:/ SY-SUBRC.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    FORM DATA_RETRIEVAL.
      SELECT EBELN EBELP
       UP TO 10 ROWS
        FROM EKPO
        INTO CORRESPONDING FIELDS OF TABLE  IT_EKKO.
    ENDFORM.                    " DATA_RETRIEVAL
    *                      FORM SET_PF_STATUS                              *
    FORM SET_PF_STATUS USING RT_EXTAB   TYPE  SLIS_T_EXTAB.
      SET PF-STATUS 'STANDARD_FULLSCREEN1' EXCLUDING RT_EXTAB.
    ENDFORM.                    "set_pf_status
    *&      Form  user_command
    *       text
    *      -->R_UCOMM    text
    *      -->RS_SELFIELDtext
    FORM USER_COMMAND  USING R_UCOMM LIKE SY-UCOMM
                             RS_SELFIELD TYPE SLIS_SELFIELD.
    *then insert the following code in your USER_COMMAND routine...
      IF REF_GRID IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            E_GRID = REF_GRID.
      ENDIF.
      IF NOT REF_GRID IS INITIAL.
        CALL METHOD REF_GRID->CHECK_CHANGED_DATA
      ENDIF.
    *modify
      CASE R_UCOMM.
        WHEN '&IC1'.
          CHECK RS_SELFIELD-TABINDEX > 0.
          IF RS_SELFIELD-VALUE EQ '6000000001'.
            CALL TRANSACTION 'ZDF2'.
          ENDIF.
        WHEN 'REFRESH'.
          READ TABLE IT_EKKO INDEX  RS_SELFIELD-TABINDEX.
          IF SY-SUBRC = 0.
            READ TABLE IT_BACKUP INDEX RS_SELFIELD-TABINDEX.
            IF SY-SUBRC = 0.
              IF IT_EKKO <> IT_BACKUP.
    *  then do your check
              ENDIF.
            ENDIF.
          ENDIF.
          PERFORM DATA_RETRIEVAL.
          RS_SELFIELD-REFRESH = 'X'.
      ENDCASE.
    ENDFORM.                    "user_command
    and also check this thread in which i gave the solution....
    REUSE_ALV_GRID EDITABLE
    Regards
    vijay

  • Making fields editable

    Can Adobe Reader Touch make some pdf fields editable?

    Hi Manjunath,
    I dont undersatnd what you are trying to write.Because you write same logic in the if and else part.What is purpose of it.
    Try to take different variables for columns.
    IF v_flag = 'X'.
    lr_table_settings ?= l_value.
    lr_table_settings->set_read_only( abap_false ).
    lr_column_settings ?= l_value.
    lr_column1= lr_column_settings->get_column( 'PROJ_ID' ).
    CREATE OBJECT lr_input_field
    EXPORTING
    value_fieldname = 'PROJ_ID'.
    lr_column1->set_cell_editor( lr_input_field ).
    lr_column_settings ?= l_value.
    lr_column2 = lr_column_settings->get_column( 'ACCOUNT_NAME' ).
    CREATE OBJECT lr_input_field
    EXPORTING
    value_fieldname = 'ACCOUNT_NAME'.
    lr_column2->set_cell_editor( lr_input_field ).
    lr_column_settings ?= l_value.
    lr_column3 = lr_column_settings->get_column( 'ZTASK' ).
    CREATE OBJECT lr_input_field
    EXPORTING
    value_fieldname = 'ZTASK'.
    lr_column3->set_cell_editor( lr_input_field ).
    endif.

  • Field Editing in ALV Report

    hello everyone,
    I have created an alv report using MARA table. but i am unable to edit any field and save the changes back to the table in the database.
    I

    Hi Ravi,
    Check out the below demo program for editable ALV .
    REPORT  ZDEMO_ALVGRID_EDIT                 .
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
      field_style  TYPE lvc_t_styl, "FOR DISABLE
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    DATA: it_fieldcat TYPE lvc_t_fcat,     "slis_t_fieldcat_alv WITH HEADER LINE,
          wa_fieldcat TYPE lvc_s_fcat,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE lvc_s_layo,     "slis_layout_alv,
          gd_repid     LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM set_specific_field_attributes.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
    *       Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      wa_fieldcat-fieldname   = 'EBELN'.
      wa_fieldcat-scrtext_m   = 'Purchase Order'.
      wa_fieldcat-col_pos     = 0.
      wa_fieldcat-outputlen   = 10.
      wa_fieldcat-emphasize   = 'X'.
      wa_fieldcat-key         = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'EBELP'.
      wa_fieldcat-scrtext_m   = 'PO Item'.
      wa_fieldcat-col_pos     = 1.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'STATU'.
      wa_fieldcat-scrtext_m   = 'Status'.
      wa_fieldcat-col_pos     = 2.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'AEDAT'.
      wa_fieldcat-scrtext_m   = 'Item change date'.
      wa_fieldcat-col_pos     = 3.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MATNR'.
      wa_fieldcat-scrtext_m   = 'Material Number'.
      wa_fieldcat-col_pos     = 4.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MENGE'.
      wa_fieldcat-scrtext_m   = 'PO quantity'.
      wa_fieldcat-col_pos     = 5.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MEINS'.
      wa_fieldcat-scrtext_m   = 'Order Unit'.
      wa_fieldcat-col_pos     = 6.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'NETPR'.
      wa_fieldcat-scrtext_m   = 'Net Price'.
      wa_fieldcat-edit        = 'X'. "sets whole column to be editable
      wa_fieldcat-col_pos     = 7.
      wa_fieldcat-outputlen   = 15.
      wa_fieldcat-datatype     = 'CURR'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'PEINH'.
      wa_fieldcat-scrtext_m   = 'Price Unit'.
      wa_fieldcat-col_pos     = 8.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
    *       Build layout for ALV grid report
    FORM build_layout.
    * Set layout field for field attributes(i.e. input/output)
      gd_layout-stylefname = 'FIELD_STYLE'.
      gd_layout-zebra             = 'X'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
    *       Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
    *  call function 'REUSE_ALV_GRID_DISPLAY'
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
           EXPORTING
                i_callback_program      = gd_repid
    *            i_callback_user_command = 'USER_COMMAND'
                is_layout_lvc               = gd_layout
                it_fieldcat_lvc             = it_fieldcat
                i_save                  = 'X'
           TABLES
                t_outtab                = it_ekko
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
    *       Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO  CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  set_specific_field_attributes
    *       populate FIELD_STYLE table with specific field attributes
    form set_specific_field_attributes .
      DATA ls_stylerow TYPE lvc_s_styl .
      DATA lt_styletab TYPE lvc_t_styl .
    * Populate style variable (FIELD_STYLE) with style properties
    * The NETPR field/column has been set to editable in the fieldcatalog...
    * The following code sets it to be disabled(display only) if 'NETPR'
    * is gt than 10.
      LOOP AT it_ekko INTO wa_ekko.
        IF wa_ekko-netpr GT 10.
          ls_stylerow-fieldname = 'NETPR' .
          ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
                                                 "set field to disabled
          APPEND ls_stylerow  TO wa_ekko-field_style.
          MODIFY it_ekko FROM wa_ekko.
        ENDIF.
      ENDLOOP.
    endform.                    " set_specific_field_attributes

  • Dynamically making fields editable or non editable according to ddl value.

    Hi All,
    In my case I have a drop down field having various values on ADOBE form.According to those values the remaining fields in the form should get visible or invisible accordingly. Can you please help me out in javascripting required in this case?
    I have tried scripting as given below but it is not working. I request you to please tell me whats the problem in this and what needs to be done to achieve this.
    For Example in case if i select "03 - Transfer" in the dropdown field named OPTION then I want to make New Personal Sub area field as visible and editable on the form so that user can enter data into it ELSE it should not be visible on the form.For this the scripting i wrote in javascript in the event CALCULATE for this field is as follows.
    if($record.OPTION.DATA.FIELD == "03 - Transfer")
    then
    this.access == "open"
    else
    this.presence = "invisible"
    endif
    But this is not working when I check the form on portal.Please let me know what I need to do inorder to achieve this functionality.
    I have wrote the similar code in CALCULATE event for each field on the form but the form not working according to requirement.
    Please provide me with information how to decide the event in which we should write the script?
    Please let me know if this functionality can be achieved by coding in F.M in ABAP?If yes how?
    Thanks in Advance.
    Sarang

    Hi Chintan,
                    Thanks for the reply. The scripting I used in my case is as follows.But this is not working.Please let me know what may the problem.
    In the dropdown in EXIT event I wrote the following javascript.
    if(this.rawValue == "01 - Promotion")
         DATA.MainSubform.Subform3.EFF_DATE.access = "open";
         DATA.MainSubform.Subform3.EFF_DATE.presence = "visible";
    and in the main subform I have wrote the following script as u told in the FORM READY event
    DATA.MainSubform.Subform3.EFF_DATE.access = "readOnly";
    DATA.MainSubform.Subform3.EFF_DATE.presence = "hidden";
    According to this script the at first when the form is opened the EFF_DATE field should be invisible and should only get visible when the user selects "01 - Promotion" from the drop down.
    Note - "01 -  Promotion" is one of the values from the drop down
    Also Please let me know what needs to be done to make the form dynamic.
    waiting for ur reply.
    Thanks in Advance,
    Sarang.

  • To edit the field in the ALV report

    Hi,
        i want to edit the field of the ALV report what i need to do for that..
    Thanks & Regards
    Ashu Singh

    hi,
    check the code,
    REPORT  zalv_fcat.* Output table T006 structure declarationTYPES : BEGIN OF ty_t006.
            INCLUDE STRUCTURE t006.
    TYPES : END OF ty_t006.*Internal table and wa declaration for T006
    DATA : it_t006 TYPE STANDARD TABLE OF ty_t006,
           wa_t006 TYPE ty_t006.*declarations for ALV
    DATA: ok_code               TYPE sy-ucomm,
    fieldcatalog for T006
          it_fielcat           TYPE lvc_t_fcat,
    fieldcatalog for fieldcatalog itself:
          it_fielcatalogue           TYPE lvc_t_fcat,
          it_layout           TYPE lvc_s_layo.*declaration for toolbar function
    DATA:   it_excl_func        TYPE ui_functions.
    Controls to display it_t006 and corresponding fieldcatalog
    DATA: cont_dock TYPE REF TO cl_gui_docking_container,
          cont_alvgd     TYPE REF TO cl_gui_alv_grid.*controls to display the fieldcatalog as editable alv grid and container
    DATA: cont_cust TYPE REF TO cl_gui_custom_container,
          cont_editalvgd     TYPE REF TO cl_gui_alv_grid.*intialization event
    INITIALIZATION.*start of selection event
    START-OF-SELECTION.
    LOCAL CLASS Definition for data changed in fieldcatalog ALV
    CLASS lcl_event_receiver DEFINITION.
      PUBLIC SECTION.
        METHODS handle_data_changed
          FOR EVENT data_changed OF cl_gui_alv_grid
          IMPORTING er_data_changed.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    LOCAL CLASS implementation for data changed in fieldcatalog ALV
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
      ENDMETHOD.                    "handle_data_changed
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION*data declaration for event receiver
    DATA: event_receiver TYPE REF TO lcl_event_receiver.*end of selection event
    END-OF-SELECTION.*setting the screen for alv output for table display and
    *changed fieldcatalalogue display
    SET SCREEN 600.
    On this statement double click  it takes you to the screen painter SE51. Enter the attributes
    *Create a Custom container and name it CCONT and OK code as OK_CODE.
    *Save check and Activate the screen painter.
    *Now a normal screen with number 600 is created which holds the ALV grid.
    PBO of the actual screen , Here we can give a title and customized menus
    *Go to SE41 and create status 'STATUS600' and create THE function code 'SUBMIT'
    *and 'EXIT' with icons and icon texts
    Also create a TitleBar 'TITLE600' and give the relevant title.&----
    *&      Module  STATUS_0600  OUTPUT
    MODULE status_0600 OUTPUT.
      SET PF-STATUS 'STATUS600'.
      SET TITLEBAR 'TITLE600'.
    CREATE ALV GRID CONTROL IF DOES NOT EXISTS INITIALLY
      IF cont_dock IS INITIAL.
        PERFORM create_alv.
      ENDIF.ENDMODULE.                             " STATUS_0600  OUTPUT* PAI module of the screen created. In case we use an interactive ALV or
    *for additional functionalities we can create OK codes and based on the
    *user command we can do the coding as shown below
    *&      Module  USER_COMMAND_0600  INPUT
    MODULE user_command_0600 INPUT.
      CASE ok_code.
        WHEN 'SUBMIT'.
    *TO GET THE CURRENT FIELDCATALOGUE FROM THE FRONTEND
          CALL METHOD cont_alvgd->set_frontend_fieldcatalog
            EXPORTING
              it_fieldcatalog = it_fielcat.
    *refresh the alv
          CALL METHOD cont_alvgd->refresh_table_display.
    *to Send Buffered Automation Queue to Frontend
          CALL METHOD cl_gui_cfw=>flush.*Exit button clicked to leave the program
        WHEN 'EXIT'.
          LEAVE PROGRAM.  ENDCASE.ENDMODULE.                             " USER_COMMAND_0600  INPUT&----
    *&      Form  CREATE_ALV
    &----FORM create_alv.*create a docking container and dock the control at the botton
      CREATE OBJECT cont_dock
          EXPORTING
               dynnr = '600'
               extension = 100
               side = cl_gui_docking_container=>dock_at_bottom.*create the alv grid for display the table
      CREATE OBJECT cont_alvgd
          EXPORTING
               i_parent = cont_dock.*create custome container for alv
      CREATE OBJECT cont_cust
          EXPORTING
               container_name = 'CCONT'.
    *create alv editable grid
      CREATE OBJECT cont_editalvgd
          EXPORTING
               i_parent = cont_cust.* register events for the editable alv
      CREATE OBJECT event_receiver.
      SET HANDLER event_receiver->handle_data_changed FOR cont_editalvgd.  CALL METHOD cont_editalvgd->register_edit_event
        EXPORTING
          i_event_id = cl_gui_alv_grid=>mc_evt_modified.*building the fieldcatalogue for the initial display
      PERFORM build_fieldcat CHANGING it_fielcat it_fielcatalogue.*building the fieldcatalogue after the user has changed it
      PERFORM change_fieldcat CHANGING it_fielcatalogue.*fetch data from the table
      PERFORM fetch_data.*    Get excluding functions for the alv editable tool bar  APPEND cl_gui_alv_grid=>mc_fc_loc_append_row TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_loc_insert_row TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_loc_cut TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_sort TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_sort_asc TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_sort_dsc TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_subtot TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_sum TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_graph TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_info TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_print TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_filter TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_views TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_mb_export TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_mb_sum TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_mb_sum TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_mb_paste TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_find TO it_excl_func.
      APPEND cl_gui_alv_grid=>mc_fc_loc_copy  TO it_excl_func.
    *Alv display for the T006 table at the bottom
      CALL METHOD cont_alvgd->set_table_for_first_display
        CHANGING
          it_outtab       = it_t006[]
          it_fieldcatalog = it_fielcat[].
    optimize column width of grid displaying fieldcatalog
      it_layout-cwidth_opt = 'X'.* Get fieldcatalog of table T006 - alv might have
    modified it after passing.
      CALL METHOD cont_alvgd->get_frontend_fieldcatalog
        IMPORTING
          et_fieldcatalog = it_fielcat[].to Send Buffered Automation Queue to Frontend  CALL METHOD cl_gui_cfw=>flush. Display fieldcatalog of table T006 in editable alv grid
      CALL METHOD cont_editalvgd->set_table_for_first_display
        EXPORTING
          is_layout            = it_layout
          it_toolbar_excluding = it_excl_func
        CHANGING
          it_outtab            = it_fielcat[]
          it_fieldcatalog      = it_fielcatalogue[].
    ENDFORM.                               " CREATE_alv
    *&      Form  fetch_data
    FORM fetch_data.* select data of T006
      SELECT * FROM t006 INTO TABLE it_t006 UP TO 50 ROWS.
    ENDFORM.                               " fetch_data
    *&      Form  BUILD_FIELDCAT
    FORM build_fieldcat CHANGING it_fldcat TYPE lvc_t_fcat
                                       it_fcat TYPE lvc_t_fcat.
    Fieldcatalog for table T006: it_fldcat
    to generate the fields automatically  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'T006'
        CHANGING
          ct_fieldcat            = it_fldcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.*----
    Fieldcatalog for table LVC_T_FCAT:it_fcat
    Generate fieldcatalog of fieldcatalog structure.
    This fieldcatalog is used to display fieldcatalog 'it_fldcat'
    on the top of the screen.  CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
          i_structure_name       = 'LVC_S_FCAT'
        CHANGING
          ct_fieldcat            = it_fcat[]
        EXCEPTIONS
          inconsistent_interface = 1
          program_error          = 2
          OTHERS                 = 3.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                               " BUILD_FIELDCAT
    *&      Form  CHANGE_FIELDCAT
    *after the user has modified the fieldcatalogue we build another fieldcat
    *for the modified alv display
    FORM change_fieldcat CHANGING it_fcat TYPE lvc_t_fcat.  DATA ls_fcat TYPE lvc_s_fcat.  LOOP AT it_fcat INTO ls_fcat.
        ls_fcat-coltext = ls_fcat-fieldname.
        ls_fcat-edit = 'X'.    IF ls_fcat-fieldname = 'COL_POS' OR ls_fcat-fieldname = 'FIELDNAME'.
          ls_fcat-key = 'X'.
        ENDIF.    MODIFY it_fcat FROM ls_fcat.
      ENDLOOP.
    ENDFORM.                               " CHANGE_FIELDCAT
    ref:saptechnical tutorial.
    Regards,
    Anirban

  • Making selective fields editable in adobe form [using web dynpro]

    Hi,
    I have displayed an adobe form using web dynpro application. But I have to make certain fields (not all fields) on this adobe form editable. I dont want to make this adobe form interactive because I dont have to save any data in database. The data entered in the editable fields will be saved as a pdf.
    What I did so far:
    1) The fields which I want as editable,  I have given there type as "User entered/ optional" & for rest of the fields I have given type as "Read only".
    2) In web dynpro, I have enabled the adobe
    3) This is not making the fields editable.
    4) If I write the following code in my webdynpro method WDDOMODIFYVIEW, then my data coming from adobe is not getting displayed even though the fields get selectively editable.
    *data: LR_INTERACTIVE_FORM type ref to CL_WD_INTERACTIVE_FORM,
    *LR_METHOD_HANDLER type ref to IF_WD_IACTIVE_FORM_METHOD_HNDL.
    *check first_time = abap_true.
    *LR_INTERACTIVE_FORM ?= VIEW->GET_ELEMENT('adobe').
    *LR_METHOD_HANDLER ?= LR_INTERACTIVE_FORM->_METHOD_HANDLER.
    *LR_METHOD_HANDLER->SET_LEGACY_EDITING_ENABLED( abap_true ).
    Any inputs regarding this??
    Thanks & Regards.

    Hi,
    Like I had mentioned using the following code in my webdynpro method WDDOMODIFYVIEW, my data coming from adobe form was not getting displayed even though the fields get selectively editable.
    *data: LR_INTERACTIVE_FORM type ref to CL_WD_INTERACTIVE_FORM,
    *LR_METHOD_HANDLER type ref to IF_WD_IACTIVE_FORM_METHOD_HNDL.
    *check first_time = abap_true.
    *LR_INTERACTIVE_FORM ?= VIEW->GET_ELEMENT('adobe').
    *LR_METHOD_HANDLER ?= LR_INTERACTIVE_FORM->_METHOD_HANDLER.
    *LR_METHOD_HANDLER->SET_LEGACY_EDITING_ENABLED( abap_true ).
    So I kept this code & I also kept the Interface type "ABAP Dictionary based".
    Additionally in Webdynpro, I used adobe form generated FM to get the adobe content & passed it to the "content" parameter of my adobe component in webdynpro.
    Thanks & Regards.

  • Create a ALV report with fields editable and  entry to be saved in ztable

    Hello Experts,
    I have created the ALV report which has two of the fields editable. Now whenever user puts an entry in the ALV it has to be saved in the ZTABLE.
    The report is displayed with editable fields but i'm not sure what has to be written in the 'USER COMMAND' subroutine to save the entries in ztable.
    Please see my code belwo:-
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
           EXPORTING
                i_callback_program      = gd_repid
               i_callback_top_of_page   = 'TOP-OF-PAGE'  "see FORM
                i_callback_user_command = 'ALV_USER_COMM'
               i_grid_title           = outtext
                is_layout               = gd_layout
                it_fieldcat             = fieldcatalog[]
               it_special_groups       = gd_tabgroup
               it_events               = gt_events
               is_print                = gd_prntparams
                 i_save                  = 'X'
               is_variant              = z_template
           TABLES
                t_outtab                = it_bg2
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
    Thanks,
    Naveen
    Edited by: jaikrishna on Sep 4, 2010 8:13 AM

    Hi,
    I have worked on similar requirement. You can do that on sy-ucomm value only and you have to call a FM and a method. For that end user has to click on a button which you need to create in the application toolbar. Say that button function code is 'SAVE'. Write the following code in your user command :
    *&      Form  USER_COMMAND
    FORM USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
            RS_SELFIELD TYPE SLIS_SELFIELD.
    *Code to reflect the changes done in the internal table
      DATA : REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
      DATA: L_VALID TYPE C.
      IF REF_GRID IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            E_GRID = REF_GRID.
      ENDIF.
      IF NOT REF_GRID IS INITIAL.
        CALL METHOD REF_GRID->CHECK_CHANGED_DATA
          IMPORTING
            E_VALID = L_VALID.
      ENDIF.
      CASE SY-UCOMM.
        WHEN 'SAVE'.
    *Data will come with the edited values from ALV
    *Here you write your code to save entries into Z table
    ENDCASE.
    ENDFORM. "USER_COMMAND
    Thanks & Regards,
    Rock.

  • ALV field editable

    Hi,
    Please help me,
    I need to make a ALV report, which is having one field editable.
    I want a code , when i will give input in editable field in ALV report , it should be save in my internal table.
    Please give me a sample program ,
    like take a internal table with two field. whose one field will editable.when user will give input in editable field it should save in internal table in same row like ALV list.
    Thanks,
    Abhishek

    The follow program demonstrates how to make individual fields of an ALV grid editable (NetPR greater than 10).
    Changes required from a basic ALV grid include adding a new field to ALV grid data table(it_ekko), Populating this
    field with style attribute and adding an entry to layout control table.
    *& Report  ZDEMO_ALVGRID_EDIT                                          *
    *& Example of a simple ALV Grid Report                                 *
    *& The basic ALV grid, Enhanced to display specific fields as          *
    *& editable depending on field value                                   *
    REPORT  ZDEMO_ALVGRID_EDIT                 .
    TABLES:     ekko.
    TYPE-POOLS: slis.                                 "ALV Declarations
    *Data Declaration
    TYPES: BEGIN OF t_ekko,
      ebeln TYPE ekpo-ebeln,
      ebelp TYPE ekpo-ebelp,
      statu TYPE ekpo-statu,
      aedat TYPE ekpo-aedat,
      matnr TYPE ekpo-matnr,
      menge TYPE ekpo-menge,
      meins TYPE ekpo-meins,
      netpr TYPE ekpo-netpr,
      peinh TYPE ekpo-peinh,
      field_style  TYPE lvc_t_styl, "FOR DISABLE
    END OF t_ekko.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          wa_ekko TYPE t_ekko.
    *ALV data declarations
    DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
    DATA: it_fieldcat TYPE lvc_t_fcat,     "slis_t_fieldcat_alv WITH HEADER LINE,
          wa_fieldcat TYPE lvc_s_fcat,
          gd_tab_group TYPE slis_t_sp_group_alv,
          gd_layout    TYPE lvc_s_layo,     "slis_layout_alv,
          gd_repid     LIKE sy-repid.
    *Start-of-selection.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM set_specific_field_attributes.
      PERFORM build_fieldcatalog.
      PERFORM build_layout.
      PERFORM display_alv_report.
    *&      Form  BUILD_FIELDCATALOG
          Build Fieldcatalog for ALV Report
    FORM build_fieldcatalog.
      wa_fieldcat-fieldname   = 'EBELN'.
      wa_fieldcat-scrtext_m   = 'Purchase Order'.
      wa_fieldcat-col_pos     = 0.
      wa_fieldcat-outputlen   = 10.
      wa_fieldcat-emphasize   = 'X'.
      wa_fieldcat-key         = 'X'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'EBELP'.
      wa_fieldcat-scrtext_m   = 'PO Item'.
      wa_fieldcat-col_pos     = 1.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'STATU'.
      wa_fieldcat-scrtext_m   = 'Status'.
      wa_fieldcat-col_pos     = 2.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'AEDAT'.
      wa_fieldcat-scrtext_m   = 'Item change date'.
      wa_fieldcat-col_pos     = 3.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MATNR'.
      wa_fieldcat-scrtext_m   = 'Material Number'.
      wa_fieldcat-col_pos     = 4.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MENGE'.
      wa_fieldcat-scrtext_m   = 'PO quantity'.
      wa_fieldcat-col_pos     = 5.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'MEINS'.
      wa_fieldcat-scrtext_m   = 'Order Unit'.
      wa_fieldcat-col_pos     = 6.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'NETPR'.
      wa_fieldcat-scrtext_m   = 'Net Price'.
      wa_fieldcat-edit        = 'X'. "sets whole column to be editable
      wa_fieldcat-col_pos     = 7.
      wa_fieldcat-outputlen   = 15.
      wa_fieldcat-datatype     = 'CURR'.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
      wa_fieldcat-fieldname   = 'PEINH'.
      wa_fieldcat-scrtext_m   = 'Price Unit'.
      wa_fieldcat-col_pos     = 8.
      APPEND wa_fieldcat TO it_fieldcat.
      CLEAR  wa_fieldcat.
    ENDFORM.                    " BUILD_FIELDCATALOG
    *&      Form  BUILD_LAYOUT
          Build layout for ALV grid report
    FORM build_layout.
    Set layout field for field attributes(i.e. input/output)
      gd_layout-stylefname = 'FIELD_STYLE'.
      gd_layout-zebra             = 'X'.
    ENDFORM.                    " BUILD_LAYOUT
    *&      Form  DISPLAY_ALV_REPORT
          Display report using ALV grid
    FORM display_alv_report.
      gd_repid = sy-repid.
    call function 'REUSE_ALV_GRID_DISPLAY'
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
           EXPORTING
                i_callback_program      = gd_repid
               i_callback_user_command = 'USER_COMMAND'
                is_layout_lvc               = gd_layout
                it_fieldcat_lvc             = it_fieldcat
                i_save                  = 'X'
           TABLES
                t_outtab                = it_ekko
           EXCEPTIONS
                program_error           = 1
                OTHERS                  = 2.
      IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDFORM.                    " DISPLAY_ALV_REPORT
    *&      Form  DATA_RETRIEVAL
          Retrieve data form EKPO table and populate itab it_ekko
    FORM data_retrieval.
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO  CORRESPONDING FIELDS OF TABLE it_ekko.
    ENDFORM.                    " DATA_RETRIEVAL
    *&      Form  set_specific_field_attributes
          populate FIELD_STYLE table with specific field attributes
    form set_specific_field_attributes .
      DATA ls_stylerow TYPE lvc_s_styl .
      DATA lt_styletab TYPE lvc_t_styl .
    Populate style variable (FIELD_STYLE) with style properties
    The NETPR field/column has been set to editable in the fieldcatalog...
    The following code sets it to be disabled(display only) if 'NETPR'
    is gt than 10.
      LOOP AT it_ekko INTO wa_ekko.
        IF wa_ekko-netpr GT 10.
          ls_stylerow-fieldname = 'NETPR' .
          ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
                                                 "set field to disabled
          APPEND ls_stylerow  TO wa_ekko-field_style.
          MODIFY it_ekko FROM wa_ekko.
        ENDIF.
      ENDLOOP.
    endform.                    " set_specific_field_attributes
    hope this helps
    reward if useful
    Edited by: Richa Khosla on Mar 25, 2008 1:30 PM

  • Making field as Dropdown list in ALV

    Hi
    This is the code for making field as dropdown list in ALV.
    But wat do you mean by HANDLE here.
    What is the value one indicates.
    FORM prepare_drilldown_values.
    DATA lt_ddval TYPE lvc_t_drop .
    DATA ls_ddval TYPE lvc_s_drop .
    ls_ddval-handle = '1' .ls_ddval-value = 'JFK-12' .
    APPEND ls_ddval TO lt_ddval .
    ls_ddval-handle = '1' .
    ls_ddval-value = 'JSF-44' .
    APPEND ls_ddval TO lt_ddval .
    ls_ddval-handle = '1' .
    ls_ddval-value = 'KMDA-53' .
    APPEND ls_ddval TO lt_ddval .
    ls_ddval-handle = '1' .
    ls_ddval-value = 'SS3O/N' .
    APPEND ls_ddval TO lt_ddval .
    CALL METHOD gr_alvgrid->set_drop_down_table
    EXPORTING
    it_drop_down = lt_ddval .
    ENDFORM. " prepare_drilldown_values
    Regards
    Sandeep Reddy

    Hi,
    REPORT  YMS_DROPDOWNLISTBOX.
          TYPE-POOLS : VRM.
    TABLES : AFKO,AFPO,SSCRFIELDS.
    DATA : BEGIN OF IAFKO OCCURS 0,
           AUFNR LIKE AFKO-AUFNR,
           END OF IAFKO.
    DATA : BEGIN OF IAFPO OCCURS 0,
           MATNR LIKE AFPO-MATNR,
           END OF IAFPO.
    DATA : ITAB TYPE VRM_VALUE.
    DATA : VID TYPE VRM_ID.
    DATA : ITAB1 TYPE VRM_VALUES  ,
           ITAB2 TYPE VRM_VALUES  .
    DATA : FLAG.
    PARAMETERS : P_AUFNR LIKE AFKO-AUFNR AS LISTBOX VISIBLE LENGTH 15.
    INITIALIZATION.
      SELECT AUFNR FROM AFKO UP TO 10 ROWS INTO TABLE IAFKO WHERE AUFNR LIKE
      '%704%'.
      LOOP AT IAFKO.
        ITAB-KEY = IAFKO-AUFNR.
        ITAB-TEXT = IAFKO-AUFNR.
        APPEND ITAB TO ITAB1.
      ENDLOOP.
    AT SELECTION-SCREEN OUTPUT.
      VID = 'P_AUFNR'.
      CALL FUNCTION 'VRM_SET_VALUES'
        EXPORTING
          ID              = VID
          VALUES          = ITAB1
        EXCEPTIONS
          ID_ILLEGAL_NAME = 1
          OTHERS          = 2.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    Thanks,
    Sankar M

  • Making field input editable after giving error msg from table event 01

    Hi All,
    I have a requirement of giving error msg and making that row or the particular field input editable by writing code in table event 01 i.e before saving any record in a z-table i have to chk some condition for a column value and if that condition fails then i have to give error msg and make that column input editable.
    I have created a routine for event 01 and written the code to give error msg. But my problem is that column is not becoming input editable. Could you pls tell me how can i make that field editable?
    Thanks in advance.

    Hi Piyali,
    Use SET PARAMETER & GET PARAMETER ID  .
    You will get it.
    Best Regards,
    Pravin

  • ALV grid field editable/non editable at runtime

    Hi All,
    I am working on alv grid using containers. I have to make few cells in grid to editable and few othres to non editable which I did using styles by defining table type lvc_t_styl and updating my main internal table. Now once grid is displayed for first time (using set_table_for_first_display) it has required fields in editable and non editable as required. But now on triggering of data_changed event I have to change the editable cells to non editable and the non editable cells to editable. I tried doing this as same way as I have done before calling set_table_for_first_display method i.e. by  defining table of type lvc_t_styl in data_changed event and modifying my main internal table but this time the editable fields are changed to non editable and again becomes editable. Same problem with non editable cells also. They become editable and again becomes non ediatble of there own. Can anyone suggest any solution.
    <b>Note: Points awarded for helpful answers</b>
    null

    Hi,
    Check this link.I am explaining the steps for this.
    Kindly reward points by clicking the star on the left of reply,if it helps.<a href="https://wiki.sdn.sap.com/wiki/display/Snippets/ALV-Editingandsavingtheeditedvaluesin+Database(OOPS)">Editing OOPS ALV</a>

  • ALV Grid OO : Set Field editable for  selected rows

    Hello ABAPers,
    I used object  cl_gui_alv_grid to created ALV grid and i succed to set an editable
    field for all rows. However my request is to set it for and only for selected rows
    I could get the row index but i didn't know how to use it
    Thanks in advance
    Amine

    Hi Amine,
    I think the standard SAP sample program might help you, BCALV_EDIT_02.
    I will tell the procedure to make the selected rows editable on ALV.
    1. Add a additional field of type LVC_T_STYL in the internal table that you are displaying in the ALV. LVC_T_STYL is a actually a table type.
    2. Place a button on the ALV toolbar for EDIT/DISPLAY.
    3. Once you press the EDIT button after selecting the rows, loop through the records which you have selected (you have already said that you have the index of selected records).
    4. The table type LVC_T_STYL has fields for FIELDNAME and STYLE.
       If you have 10 fields in the internal table, then all these ten fields name should be appended to the newly added field in the internal table (LVC_T_STYL) and their style should be populated with value cl_gui_alv_grid=>mc_style_enabled.
    Regards,
    Rahul MB

Maybe you are looking for

  • Object expected error in java script...

    Dear All, we have Java Struts 1.1... I am getting "Object Expected" error while processing jsp page. I want to modify the text field so that only number and one dot(.) should be entered. I have one function and i am calling it as "onkeypress" event.

  • Inter-company Posting in F110

    Hello All, I would like to know if there is  any standard SAP Program/IDoc which creates inter-company postings while making payment to the Inter-co Customers/Vendors in F110. For example: Company A and Company B are related to one group. Company B m

  • How can I put text (in perspective) round two sides of a 3d object?

    If I have a block of text that I want to wrap across two planes of a 3D building, how do I do that...while keeping both sides in perspective on the respective planes. Suppose I want a letter to be split in the middle so that part is on one plan and p

  • Copy doc date to posting date in MIGO

    HI all,           I have a requirement where I need to copy the document date to the posting date in the MIGO transaction. The date should be copied up on ENTER, I have tried Exits but it is not taking to the break point,           Please suggest the

  • How to change my iCloud name

    How can I change my iCloud name? Such as [email protected]..