Editable field in alv data format

i have a editable field on ALV which is of date format and i need when user enter a date the value will be updated in the database table .
note that i am using alv list and the field catalog is of date format dat 8
the update is not done pleaseee helppp urgent

Hi,
You need to use the USER_COMMAND in the ALV function module
{CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = gd_repid
i_callback_user_command = 'USER_COMMAND'
i_callback_pf_status_set = 'GUI_STAT'
*i_grid_title = outtext
is_layout = gd_layout
it_fieldcat = fieldcatalog[]
*it_special_groups = gd_tabgroup
*it_events = it_events
i_save = 'X'
*is_variant = z_template
TABLES
t_outtab = i_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
then you need to write the below FORM
*• FORM USER_COMMAND *
*• --> U_COMM *
*• --> RS_SELFIELD *
FORM user_command USING u_comm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.}
Here in the Form, Write the UPDATE statment to update the database table
Regards
Sudheer

Similar Messages

  • Editable field in alv

    hiii
    when doing editable field in alv
    you set
    i_fieldcat-edit = C_X
    i_fieldcat-input = C_X
    P_selfield-refresh = C_X
    this is not working when i click on save the internal table is not keeping the change i have edit on the screen and the p_selfield value also has still the old value.
    but when i double click the p_selfield is keeping the editable value.  Please advise ??

    hi,
    Check out this sample program.The part for 'EDIT' is in Bold..
    report  zalv_color_display_edit.
    type-pools: slis.
    tables : zcust_master2.
    types : begin of wi_zcust_master2,
            zcustid like zcust_master2-zcustid,
            zcustname like zcust_master2-zcustname,
            zaddr like zcust_master2-zaddr,
            zcity like zcust_master2-zcity,
            zstate like zcust_master2-zstate,
            zcountry like zcust_master2-zcountry,
            zphone like zcust_master2-zphone,
            zemail like zcust_master2-zemail,
            zfax like zcust_master2-zfax,
            zstat like zcust_master2-zstat,
            field_style  type lvc_t_styl,
    end of wi_zcust_master2.
    data: it_wi_zcust_master2 type standard table of wi_zcust_master2
                                                     initial size 0,
          wa_zcust_master2 type wi_zcust_master2.
    data: fieldcatalog type slis_t_fieldcat_alv with header line.
    data: it_fieldcat type lvc_t_fcat,    
          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.
      perform data_retrieval.
      perform set_specific_field_attributes.
      perform build_fieldcatalog.
      perform build_layout.
      perform display_alv_report.
    form build_fieldcatalog.
      wa_fieldcat-fieldname   = 'ZCUSTID'.
      wa_fieldcat-scrtext_m   = 'CUSTOMER ID'.
      wa_fieldcat-col_pos     = 0.
      wa_fieldcat-outputlen   = 10.
      append wa_fieldcat to it_fieldcat.
      clear  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZCUSTNAME'.
      wa_fieldcat-scrtext_m   = 'CUSTOMER NAME'.
      wa_fieldcat-col_pos     = 1.
      append wa_fieldcat to it_fieldcat.
      clear  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZADDR'.
      wa_fieldcat-scrtext_m   = 'ADDRESS'.
      wa_fieldcat-col_pos     = 2.
      append wa_fieldcat to it_fieldcat.
      clear  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZCITY'.
      wa_fieldcat-scrtext_m   = 'CITY'.
      wa_fieldcat-col_pos     = 3.
      append wa_fieldcat to it_fieldcat.
      clear  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZSTATE'.
      wa_fieldcat-scrtext_m   = 'STATE'.
      wa_fieldcat-col_pos     = 4.
      append wa_fieldcat to it_fieldcat.
      clear  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZCOUNTRY'.
      wa_fieldcat-scrtext_m   = 'COUNTRY'.
      wa_fieldcat-col_pos     = 5.
      append wa_fieldcat to it_fieldcat.
      clear  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZPHONE'.
      wa_fieldcat-scrtext_m   = 'PHONE NUMBER'.
      wa_fieldcat-col_pos     = 6.
    wa_fieldcat-edit        = 'X'. "sets whole column to be editable
      append wa_fieldcat to it_fieldcat.
      clear  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZEMAIL'.
      wa_fieldcat-scrtext_m   = 'EMAIL'.
      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   = 'ZFAX'.
      wa_fieldcat-scrtext_m   = 'FAX'.
      wa_fieldcat-col_pos     = 8.
      wa_fieldcat-edit        = 'X'. "sets whole column to be editable
      append wa_fieldcat to it_fieldcat.
      clear  wa_fieldcat.
      wa_fieldcat-fieldname   = 'ZSTAT'.
      wa_fieldcat-scrtext_m   = 'STATUS'.
      wa_fieldcat-col_pos     = 9.
      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
          is_layout_lvc      = gd_layout
          it_fieldcat_lvc    = it_fieldcat
          i_save             = 'X'
        tables
          t_outtab           = it_wi_zcust_master2
        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
          text
    -->  p1        text
    <--  p2        text
    form data_retrieval .
      data: ld_color(1) type c.
      select zcustid zcustname zaddr zcity zstate zcountry zphone zemail
    zfax zstat up to 10 rows from zcust_master2 into corresponding fields of
    table it_wi_zcust_master2.
    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 following code sets it to be disabled(display only) if 'ZFAX'
    is NOT INITIAL.
      loop at it_wi_zcust_master2 into  wa_zcust_master2.
        if  wa_zcust_master2-zfax is not initial.
          ls_stylerow-fieldname = 'ZFAX' .
          ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.
                                          "set field to disabled
          append ls_stylerow  to  wa_zcust_master2-field_style.
          modify it_wi_zcust_master2  from  wa_zcust_master2.
        endif.
      endloop.
    endform.                    "set_specific_field_attributes
    Hope this helps you,
    Arunsri

  • HOW TO READ THE EDITABLE FIELD IN ALV

    CAN ANYONE HELP ME IN READING THE EDITABLE FIELD IN ALV.
    I AM DOING THE FOLLOWING.
    BUT STILL THE EDITABLE FIELD IN NOT READ.
    WHEN 'EXE' OR 'EXEC'.
      LOOP AT I_RB1 INTO L_WA_STRU.
      L_WA_STRU-LIFSK = L_WA_STRU-LIFSK1.
      MODIFY I_RB1 FROM L_WA_STRU.
      CLEAR L_WA_STRU.
      ENDLOOP.
    I_RB1 IS MY TABLE WHICH I PASSED IN TABLES OF REUSE_ALV_GRID_DISPLAY.LIFSK1 IS MY EDITABLE FIELD.
    AND LIFSK IS THE FIELD WHERE THE DATA SHOULD GET TRANSFERRED WHEN I HIT EXECUTE BUTTON.

    DATA: lt_display LIKE TABLE OF gt_display.
      REFRESH lt_display.
      CLEAR lt_display.
      lt_display[] = gt_display[].
      CLEAR ref_grid.
      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.
      IF lt_display[] NE gt_display[].
        gv_tosave = 'X'.
      ENDIF.
    Check this program. It will help you. 
    awrd points if helpful
    Bhupal

  • Editable field in ALV does not accept negative sign values

    Hi guys,
    We have an editable field in ALV but it does not accept negative sign,,, it is causing an error... We need to input a negative value in that editable field...
    How to handle this?
    Thanks!

    Hi Mark,
      This topic has been just discussed at this thread:
    Problem with OO ALV
    Regards,
    Chandra Sekhar

  • Editable field in alv list display

    i WANT TO GIVE COLOR FOR EDITABLE FIELD IN ALV LIST DISPLAY.i TRIED WITH EMPHASIZE IN FIELD CATALOGUE ASSIGNING.bUT,IT IS NOT WORKING.HOW TO DO.tHANX IN ADVANCE.........

    HI,
    Please refer the link below:
    http://www.****************/Tutorials/ALV/Edit/demo.htm
    http://www.****************/Tutorials/ALV/ColorSALV/Demo.htm
    Thanks,
    Sriram Ponna.

  • How to display date field in ALV in format 'YYYY-MM-DD'?

    Hi experts,
    I am not getting displayed the date field in ALV in the format 'YYYY-MM-DD' if it is different than my user setting's format (DD.MM.YYYY).
    Tried with the edit mask
    LVC_S_FCAT-EDIT_MASK = '____-__-__'  but it does not work.
    I could not find the conversion routine for this. Is it possible to write customer conversion routine?
    I have to use DATE field, otherwise if I display this format in CHAR10 field , sorting in ALV does not work for this field.
    PLEASE ANY HELP!
    Kind regards,
    Danijela

    Hi,
    Use FM FORMAT_DATE_4_OUTPUT.
    TYPE-POOLS : slis, KKBLO.
    TYPES: BEGIN OF t_data,
           sel     TYPE char1,
           matnr   TYPE matnr,
           bldat   type char10,
           END OF t_data.
    DATA: it_tab TYPE STANDARD TABLE OF t_data,
          it_fcat TYPE slis_t_fieldcat_alv.
    DATA: wa_tab TYPE t_data,
          wa_fcat TYPE slis_fieldcat_alv,
          wa_layout type SLIS_LAYOUT_ALV.
    data: lv_repid    TYPE syrepid.
    data : lv_date    type NLEI-IBGDT,
           lv_outdate type RN1DATUM-DATEX,
           lv_format  type RN1DATUM-FORMAT value 'YYYY-MM-DD'.
    lv_repid = sy-repid.
    lv_date = sy-datum.
    CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
      EXPORTING
        datin         = lv_date
        format        =  lv_format
    IMPORTING
       DATEX         = lv_outdate.
       move lv_outdate to wa_tab-bldat.
    wa_tab-matnr = '0000001'.
    APPEND wa_tab TO it_tab.
    lv_date = sy-datum + 1.
    CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
      EXPORTING
        datin         = lv_date
        format        =  lv_format
    IMPORTING
       DATEX         = lv_outdate.
       move lv_outdate to wa_tab-bldat.
    wa_tab-matnr = '0000002'.
    APPEND wa_tab TO it_tab.
    lv_date = sy-datum + 2.
    CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
      EXPORTING
        datin         = lv_date
        format        =  lv_format
    IMPORTING
       DATEX         = lv_outdate.
       move lv_outdate to wa_tab-bldat.
    wa_tab-matnr = '0000003'.
    APPEND wa_tab TO it_tab.
    wa_fcat-fieldname = 'SEL'.
    wa_fcat-ref_fieldname = 'XCHPF'.
    wa_fcat-ref_tabname = 'MARA'.
    wa_fcat-edit = 'X'.
    wa_fcat-checkbox = 'X'.
    APPEND  wa_fcat TO  it_fcat.
    CLEAR :  wa_fcat.
    wa_fcat-fieldname = 'MATNR'.
    wa_fcat-ref_fieldname = 'MATNR'.
    wa_fcat-ref_tabname = 'MARA'.
    APPEND  wa_fcat TO  it_fcat.
    CLEAR :  wa_fcat.
    wa_fcat-fieldname = 'BLDAT'.
    wa_fcat-ref_fieldname = 'BLDAT'.
    wa_fcat-ref_tabname = 'BKPF'.
    APPEND  wa_fcat TO  it_fcat.
    call 'REUSE_ALV_GRID_DISPLAY'' after this
    Edited by: Ankur Parab on Oct 1, 2009 2:50 PM
    Edited by: Ankur Parab on Oct 1, 2009 2:51 PM

  • F4 for Editable field in ALV, display Name but capture ID

    Hi Friends,
    I have a ALV for which i have defined a Structure, which is passed to Fieldcatlog.
    I have defined a Search help - ZUSER_NAME which has following fields to display.
    USERID - USR02-BNAME
    FNAME
    LNAME
    FULLNAME
    So my structure for fieldcatalog has User-id which is linked to this search help with Domain XUBNAME.
    So in my report i made this User-Id as editable and F4 available, everything is working fine.
    when user does a F4, its displaying Userid,Fname,Lname and complete name.upon selection and save i am capturing the id and storing in the ztable.
    But now i have a requirement that when user selects a value from this search help on F4, i need to display Fullname but capture the User Id. How can i do that?
    This is something similar to the one we have in BSP- key-value pair.
    how to do this in ALV.
    Appreciate if someone can guide me thru.
    Thanks,
    Simha
    Edited by: Simha on Sep 6, 2008 2:24 PM

    hai ,  this is example code for editing the F4 display .. check out this
    REPORT zalv_editf4display.
    *Type pools for alv
    TYPE-POOLS : slis.
    *structure for t582a tbale
    TYPES : BEGIN OF ty_table,
            infty TYPE infty,
            pnnnn TYPE pnnnn_d,
            zrmkz TYPE dzrmkz,
            zeitb TYPE dzeitb,
            dname TYPE dianm,
             davo TYPE davo,
            davoe TYPE davoe,
            END OF ty_table.
    *Structure for infotype text
    TYPES : BEGIN OF ty_itext,
            infty TYPE infty,
            itext TYPE intxt,
            sprsl TYPE sprsl,
            END OF ty_itext.
    *Structure for output display
    TYPES : BEGIN OF ty_output,
            infty TYPE infty,
            itext TYPE intxt,
            pnnnn TYPE pnnnn_d,
            zrmkz TYPE dzrmkz,
            zeitb TYPE dzeitb,
            dname TYPE dianm,
            davo TYPE davo,
            davoe TYPE davoe,
           END OF ty_output.
    *internal table and work area declarations
    DATA : it_table TYPE STANDARD TABLE OF ty_table INITIAL SIZE 0,
           it_output TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
           it_pbo TYPE STANDARD TABLE OF ty_output INITIAL SIZE 0,
           it_ittext TYPE STANDARD TABLE OF ty_itext INITIAL SIZE 0,
           wa_table TYPE ty_table,
           wa_output TYPE ty_output,
           wa_ittext TYPE ty_itext.
    *Data declarations for dropdown lists for f4
    DATA: it_dropdown TYPE lvc_t_drop,
          ty_dropdown TYPE lvc_s_drop,
    *data declaration for refreshing of alv
          stable TYPE lvc_s_stbl.
    *Global variable declaration
    DATA: gstring TYPE c.
    *Data declarations for ALV
    DATA: c_ccont TYPE REF TO cl_gui_custom_container,         "Custom container object
          c_alvgd         TYPE REF TO cl_gui_alv_grid,         "ALV grid object
          it_fcat            TYPE lvc_t_fcat,                  "Field catalogue
          it_layout          TYPE lvc_s_layo.                  "Layout
    *ok code declaration
    DATA:
      ok_code       TYPE ui_func.
    *initialization event
    INITIALIZATION.
    *start of selection event
    START-OF-SELECTION.
    *select the infotypes maintained
      SELECT infty
              pnnnn
              zrmkz
              zeitb
              dname
              davo
              davoe
              FROM t582a UP TO 10 ROWS
              INTO CORRESPONDING FIELDS OF TABLE it_table.
    *Select the infotype texts
      IF it_table[] IS NOT INITIAL.
        SELECT itext
                 infty
                 sprsl
                 FROM t582s
                 INTO CORRESPONDING FIELDS OF TABLE it_ittext
                 FOR ALL ENTRIES IN it_table
                 WHERE infty = it_table-infty
                 AND sprsl = 'E'.
      ENDIF.
    *Apppending the data to the internal table of ALV output
      LOOP AT it_table INTO wa_table.
        wa_output-infty = wa_table-infty.
        wa_output-pnnnn = wa_table-pnnnn.
        wa_output-zrmkz = wa_table-zrmkz.
        wa_output-zeitb = wa_table-zeitb.
        wa_output-dname = wa_table-dname.
        wa_output-davo = wa_table-davo.
        wa_output-davoe = wa_table-davoe.
    For texts
        READ TABLE it_ittext INTO wa_ittext WITH KEY infty = wa_table-infty.
        wa_output-itext = wa_ittext-itext.
        APPEND wa_output TO it_output.
        CLEAR wa_output.
      ENDLOOP.
    Calling the ALV screen with custom container
      CALL SCREEN 0600.
    *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
    *create 2 buttons with function code 'SAVE' and 'EXIT'.
    GIVE A SUITABLE TITLE
    *&      Module  STATUS_0600  OUTPUT
          text
    MODULE status_0600 OUTPUT.
      SET PF-STATUS 'DISP'.
      SET TITLEBAR 'ALVF4'.
    ENDMODULE.                 " STATUS_0600  OUTPUT
    calling the PBO module ALV_GRID.
    *&      Module  PBO  OUTPUT
          text
    MODULE pbo OUTPUT.
    *Creating objects of the container
      CREATE OBJECT c_ccont
           EXPORTING
              container_name = 'CCONT'.
    create object for alv grid
      create object c_alvgd
      exporting
      i_parent = c_ccont.
    SET field for ALV
      PERFORM alv_build_fieldcat.
    Set ALV attributes FOR LAYOUT
      PERFORM alv_report_layout.
      CHECK NOT c_alvgd IS INITIAL.
    Call ALV GRID
      CALL METHOD c_alvgd->set_table_for_first_display
        EXPORTING
          is_layout                     = it_layout
          i_save                        = 'A'
        CHANGING
          it_outtab                     = it_output
          it_fieldcatalog               = it_fcat
        EXCEPTIONS
          invalid_parameter_combination = 1
          program_error                 = 2
          too_many_lines                = 3
          OTHERS                        = 4.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                   WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      ENDIF.
    ENDMODULE.                 " PBO  OUTPUT
    *&      Form  alv_build_fieldcat
          text
         <--P_IT_FCAT  text
    *subroutine to build fieldcat
    FORM alv_build_fieldcat.
      DATA lv_fldcat TYPE lvc_s_fcat.
      CLEAR lv_fldcat.
      lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '1'.
      lv_fldcat-fieldname = 'INFTY'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 8.
      lv_fldcat-scrtext_m = 'Infotype'.
      lv_fldcat-icon = 'X'.
      APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.
      lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '2'.
      lv_fldcat-fieldname = 'PNNNN'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 15.
      lv_fldcat-scrtext_m = 'Structure'.
      lv_fldcat-icon = ''.
      APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.
      lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '3'.
      lv_fldcat-fieldname = 'ITEXT'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 60.
      lv_fldcat-scrtext_m = 'Description'.
      lv_fldcat-icon = ''.
      APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.
      lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '5'.
      lv_fldcat-fieldname = 'ZRMKZ'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 1.
      lv_fldcat-scrtext_m = 'PERIOD'.
      lv_fldcat-icon = ''.
      APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.
      lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '6'.
      lv_fldcat-fieldname = 'ZEITB'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 5.
      lv_fldcat-scrtext_m = 'Time constraint'.
      lv_fldcat-edit = 'X'.
    *To avail the existing F4 help these are to
    *be given in the field catalogue
      lv_fldcat-f4availabl = 'X'.
      lv_fldcat-ref_table = 'T582A'.
      lv_fldcat-ref_field = 'ZEITB'.
      APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.
      lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '7'.
      lv_fldcat-fieldname = 'DNAME'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 15.
      lv_fldcat-scrtext_m = 'Dialogmodule'.
      lv_fldcat-icon = ''.
      APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.
      lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '8'.
      lv_fldcat-fieldname = 'DAVO'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 15.
      lv_fldcat-scrtext_m = 'Start'.
      lv_fldcat-edit = 'X'.
      APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.
      lv_fldcat-row_pos   = '1'.
      lv_fldcat-col_pos   = '9'.
      lv_fldcat-fieldname = 'DAVOE'.
      lv_fldcat-tabname   = 'IT_OUTPUT'.
      lv_fldcat-outputlen = 15.
      lv_fldcat-scrtext_m = 'End'.
      lv_fldcat-icon = ''.
      APPEND lv_fldcat TO it_fcat.
      CLEAR lv_fldcat.
    *To create drop down for the field 'DAVO'
    with our own f4 help
      ty_dropdown-handle = '1'.
      ty_dropdown-value = ' '.
      APPEND ty_dropdown TO it_dropdown.
      ty_dropdown-handle = '1'.
      ty_dropdown-value = '1'.
      APPEND ty_dropdown TO it_dropdown.
      ty_dropdown-handle = '1'.
      ty_dropdown-value = '2'.
      APPEND ty_dropdown TO it_dropdown.
      ty_dropdown-handle = '1'.
      ty_dropdown-value = '3'.
      APPEND ty_dropdown TO it_dropdown.
      CALL METHOD c_alvgd->set_drop_down_table
        EXPORTING
          it_drop_down = it_dropdown.
      LOOP AT it_fcat INTO lv_fldcat.
        CASE lv_fldcat-fieldname.
    To assign dropdown in the fieldcataogue
          WHEN 'DAVO'.
            lv_fldcat-drdn_hndl = '1'.
            lv_fldcat-outputlen = 15.
            MODIFY it_fcat FROM lv_fldcat.
        ENDCASE.
      ENDLOOP.
    ENDFORM.                    " alv_build_fieldcat
    *&      Form  alv_report_layout
          text
         <--P_IT_LAYOUT  text
    *Subroutine for setting alv layout
    FORM alv_report_layout.
      it_layout-cwidth_opt = 'X'.
      it_layout-col_opt = 'X'.
      it_layout-zebra = 'X'.
    ENDFORM.                    " alv_report_layout
    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.
    *&      Module  PAI  INPUT
          text
    MODULE pai INPUT.
    *To change the existing values and refresh the grid
    *And only values in the dropdown or in the default
    *F4 can be given , else no action takes place for the dropdown
    *and error is thrown for the default F4 help and font changes to red
    *and on still saving, value is not changed
      c_alvgd->check_changed_data( ).
    *Based on the user input
    *When user clicks 'SAVE;
      CASE ok_code.
        WHEN 'SAVE'.
    *A pop up is called to confirm the saving of changed data
          CALL FUNCTION 'POPUP_TO_CONFIRM'
            EXPORTING
              titlebar       = 'SAVING DATA'
              text_question  = 'Continue?'
              icon_button_1  = 'icon_booking_ok'
            IMPORTING
              answer         = gstring
            EXCEPTIONS
              text_not_found = 1
              OTHERS         = 2.
          IF sy-subrc NE 0.
          MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                  WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    *When the User clicks 'YES'
          IF ( gstring = '1' ).
            MESSAGE 'Saved' TYPE 'S'.
    *Now the changed data is stored in the it_pbo internal table
            it_pbo = it_output.
    *Subroutine to display the ALV with changed data.
            PERFORM redisplay.
          ELSE.
    *When user clicks NO or Cancel
            MESSAGE 'Not Saved'  TYPE 'S'.
          ENDIF.
    **When the user clicks the 'EXIT; he is out
        WHEN 'EXIT'.
          LEAVE PROGRAM.
      ENDCASE.
      CLEAR: ok_code.
    ENDMODULE.                 " PAI  INPUT
    *&      Form  REDISPLAY
          text
    -->  p1        text
    <--  p2        text
    FORM redisplay .
    *Cells of the alv are made non editable after entering OK to save
      CALL METHOD c_alvgd->set_ready_for_input
        EXPORTING
          i_ready_for_input = 0.
    *Row and column of the alv are refreshed after changing values
      stable-row = 'X'.
      stable-col = 'X'.
    *REfreshed ALV display with the changed values
    *This ALV is non editable and contains new values
      CALL METHOD c_alvgd->refresh_table_display
        EXPORTING
          is_stable = stable
        EXCEPTIONS
          finished  = 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.                    " REDISPLAY

  • Editable Field in ALV Tree Control

    Hello All,
    Can anyone tell me how can i make a field editable in an Alv Tree grid. I have tried with fiedcatalog-edit = 'X'. but that doesn't work. 
    also please provide a piece of code to be clear ...
    Thanks,
    Ravi Aswani

    hI ,
    Data : LI_fieldcat  type lvc_t_fcat,
              ls_fcat type lvc_s_fcat.
    IF OKCODE = 'MAIN'.
          CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
        EXPORTING
        I_BUFFER_ACTIVE              =
          i_structure_name             = 'ZCUS'
        I_CLIENT_NEVER_DISPLAY       = 'X'
        I_BYPASSING_BUFFER           =
        I_INTERNAL_TABNAME           =
        CHANGING
          ct_fieldcat                  = LI_fieldcat[]            .
      LOOP AT LI_FIELDCAT INTO LS_FCAT.
        CASE ls_fcat-fieldname.
          WHEN 'KUNNR'.
            ls_fcat-col_pos = 1.
          WHEN 'NAME1'.
            ls_fcat-edit = 'X'.
            ls_fcat-col_pos = 2.
          WHEN 'ORT01'.
            ls_fcat-edit = 'X'.
            ls_fcat-col_pos = 3.
            ls_fcat-drdn_hndl = '1'.
            ls_fcat-outputlen = 20.
          WHEN 'LAND1'.
            ls_fcat-edit = 'X'.
            ls_fcat-col_pos = 4.
        ENDCASE.
        MODIFY LI_fieldcat FROM ls_fcat.
      ENDLOOP.
    ENDIF.
    With this The internal Table contains 4 fields Kunnr Name1 Ort01 Land1 Here Kunnr is the Key field so , it is not editable , reaming fields are Editable.
    There u must write the Modify statement.
    check it once
    Regards
    Krishna

  • Editable Field in ALV TREE Display Using OOPs

    Hi,
    I am trying to make a field editable on the ALV Tree display. I could create an editable check box. But could not make a field Editable. I have made EDIT = 'X' in the fieldcatalog for the particular field. but  it is not working.
    Please help me in solving this. Its very urgent.

    You do this with the following code example
      DATA: ls_layout TYPE lvc_s_layi.
      CLEAR ls_layout.
      ls_layout-class     = cl_item_tree_control=>item_class_text.
      ls_layout-editable   = 'X'.
      ls_layout-fieldname = your fieldname.
      APPEND ls_layout TO lt_layout.
    add PO header to tree
          CALL METHOD tree->add_node
            EXPORTING
              i_relat_node_key = space
              i_relationship   = cl_gui_column_tree=>relat_last_child
              i_node_text      = l_node_text
              is_outtab_line   = ls_po_item
              is_node_layout   = wa_layout_node
              it_item_layout   = lt_layout
    Roy

  • How to validate editable field in ALV

    Hi All,
    I have a alv program using OOPS concept where two fields(columns) are editable in the alv output. These two columns contain table names and field names which can be edited.
    I just want to validate these table and field names when we press the save button. If the edited entry is valid,i.e., the tablename is existing in the database, then it must update the entered value oftbl name to the db. else it shud give a error msg.
    Please help with this code.
    Thanks in Advance.

    Hey!!!
    Try using this...
    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.
    CLASS lcl_event_receiver IMPLEMENTATION.
      METHOD handle_data_changed.
        PERFORM data_changed USING er_data_changed.
      ENDMETHOD.   
    ENDCLASS.
    form DATA_CHANGED  using p_er_data_changed
                             TYPE REF TO cl_alv_changed_data_protocol.
      DATA : ls_mod_cells TYPE lvc_s_modi,
                   declare a variable for your table or field name.
      LOOP AT p_er_data_changed->mt_good_cells INTO ls_mod_cells.
          CASE ls_mod_cells-fieldname.
          WHEN 'LIFNR'.
              CALL METHOD p_er_data_changed->get_cell_value
              EXPORTING
                i_row_id    = ls_mod_cells-row_id
                i_fieldname = 'LIFNR'
              IMPORTING
                e_value     = The variable you have defined.
    put ur condition according to variable here, if the condition is not satisfied, then throw a message like this.
            CALL METHOD p_er_data_changed->add_protocol_entry
                EXPORTING
                  i_msgid     = 'ZFI'
                  i_msgno     = '999'
                  i_msgty     = 'E'
                  i_msgv1     = 'Employee Number Doesn''t Exist'
                  i_fieldname = ls_mod_cells-fieldname
                  i_row_id    = ls_mod_cells-row_id.
              EXIT.
            ENDIF.
    Hope this helps.
    Regrds,
    Abhinab Mishra

  • To store Editable Field in ALV

    hi! all,
               I'm displaying an ALV Grid Report with a field as editable. Now i need to store the values entered in the editable field to a table how to access the data from that field and store. Kindly help me.
    Thanks and Regards,
    Nagulan

    This code of mine may be help u to achieve ur requirement.
    REPORT z_demo_alv_jg.
    TYPE-POOLS                                                          *
    TYPE-POOLS: slis.
    INTERNAL TABLES/WORK AREAS/VARIABLES                                *
    DATA: i_fieldcat TYPE slis_t_fieldcat_alv,
          i_index TYPE STANDARD TABLE OF i WITH HEADER LINE,
          w_field TYPE slis_fieldcat_alv,
          p_table LIKE dd02l-tabname,
          dy_table TYPE REF TO data,
          dy_tab TYPE REF TO data,
          dy_line TYPE REF TO data.
    FIELD-SYMBOLS                                                       *
    FIELD-SYMBOLS: <dyn_table> TYPE STANDARD TABLE,
                   <dyn_wa> TYPE ANY,
                   <dyn_field> TYPE ANY,
                   <dyn_tab_temp> TYPE STANDARD TABLE.
    SELECTION SCREEN                                                    *
    PARAMETERS: tabname(30) TYPE c,
                lines(5)  TYPE n.
    START-OF-SELECTION                                                  *
    START-OF-SELECTION.
    Storing table name
      p_table = tabname.
    Create internal table dynamically with the stucture of table name
    entered in the selection screen
      CREATE DATA dy_table TYPE STANDARD TABLE OF (p_table).
      ASSIGN dy_table->* TO <dyn_table>.
      IF sy-subrc <> 0.
        MESSAGE i000(z_zzz_ca_messages) WITH ' No table found'.
        LEAVE TO LIST-PROCESSING.
      ENDIF.
    Create workarea for the table
      CREATE DATA dy_line LIKE LINE OF <dyn_table>.
      ASSIGN dy_line->* TO <dyn_wa>.
    Create another temp. table
      CREATE DATA dy_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN dy_tab->* TO <dyn_tab_temp>.
      SORT i_fieldcat BY col_pos.
    Select data from table
      SELECT * FROM (p_table)
      INTO TABLE <dyn_table>
      UP TO lines ROWS.
      REFRESH <dyn_tab_temp>.
    Display report
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          i_callback_program       = sy-repid
          i_structure_name         = p_table
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_pf_status_set = 'SET_PF_STATUS'
        TABLES
          t_outtab                 = <dyn_table>
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
      IF sy-subrc <> 0.
      ENDIF.
    *&      Form  SET_PF_STATUS
          Setting custom PF-Status
         -->RT_EXTAB   Excluding table
    FORM set_pf_status USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'Z_STANDARD'.
    ENDFORM.                    "SET_PF_STATUS
    *&      Form  user_command
          Handling custom function codes
         -->R_UCOMM      Function code value
         -->RS_SELFIELD  Info. of cursor position in ALV
    FORM user_command  USING    r_ucomm LIKE sy-ucomm
                               rs_selfield TYPE slis_selfield.
    Local data declaration
      DATA: li_tab TYPE REF TO data,
            l_line TYPE REF TO data.
    Local field-symbols
      FIELD-SYMBOLS:<l_tab> TYPE table,
                    <l_wa>  TYPE ANY.
    Create table
      CREATE DATA li_tab TYPE STANDARD TABLE OF (p_table).
      ASSIGN li_tab->* TO <l_tab>.
    Create workarea
      CREATE DATA l_line LIKE LINE OF <l_tab>.
      ASSIGN l_line->* TO <l_wa>.
      CASE r_ucomm.
      When a record is selected
        WHEN '&IC1'.
        Read the selected record
          READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX
          rs_selfield-tabindex.
          IF sy-subrc = 0.
          Store the record in an internal table
            APPEND <dyn_wa> TO <l_tab>.
          Fetch the field catalog info
            CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
              EXPORTING
                i_program_name         = 'Z_DEMO_PDF_JG'
                i_structure_name       = p_table
              CHANGING
                ct_fieldcat            = i_fieldcat
              EXCEPTIONS
                inconsistent_interface = 1
                program_error          = 2
                OTHERS                 = 3.
            IF sy-subrc = 0.
            Make all the fields input enabled except key fields
              w_field-input = 'X'.
              MODIFY i_fieldcat FROM w_field TRANSPORTING input
              WHERE key IS INITIAL.
            ENDIF.
          Display the record for editing purpose
            CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
              EXPORTING
                i_callback_program    = sy-repid
                i_structure_name      = p_table
                it_fieldcat           = i_fieldcat
                i_screen_start_column = 10
                i_screen_start_line   = 15
                i_screen_end_column   = 200
                i_screen_end_line     = 20
              TABLES
                t_outtab              = <l_tab>
              EXCEPTIONS
                program_error         = 1
                OTHERS                = 2.
            IF sy-subrc = 0.
            Read the modified data
              READ TABLE <l_tab> INDEX 1 INTO <l_wa>.
            If the record is changed then track its index no.
            and populate it in an internal table for future
            action
              IF sy-subrc = 0 AND <dyn_wa> <> <l_wa>.
                <dyn_wa> = <l_wa>.
                i_index = rs_selfield-tabindex.
                APPEND i_index.
              ENDIF.
            ENDIF.
          ENDIF.
      When save button is pressed
        WHEN 'SAVE'.
        Sort the index table
          SORT i_index.
        Delete all duplicate records
          DELETE ADJACENT DUPLICATES FROM i_index.
          LOOP AT i_index.
          Find out the changes in the internal table
          and populate these changes in another internal table
            READ TABLE <dyn_table> ASSIGNING <dyn_wa> INDEX i_index.
            IF sy-subrc = 0.
              APPEND <dyn_wa> TO <dyn_tab_temp>.
            ENDIF.
          ENDLOOP.
        Lock the table
          CALL FUNCTION 'ENQUEUE_E_TABLE'
            EXPORTING
              mode_rstable   = 'E'
              tabname        = p_table
            EXCEPTIONS
              foreign_lock   = 1
              system_failure = 2
              OTHERS         = 3.
          IF sy-subrc = 0.
          Modify the database table with these changes
            MODIFY (p_table) FROM TABLE <dyn_tab_temp>.
            REFRESH <dyn_tab_temp>.
          Unlock the table
            CALL FUNCTION 'DEQUEUE_E_TABLE'
              EXPORTING
                mode_rstable = 'E'
                tabname      = p_table.
          ENDIF.
      ENDCASE.
      rs_selfield-refresh = 'X'.
    ENDFORM.                    "user_command
    Regards,
    Joy.

  • How to use Editable Fields in ALV

    Hi,
    i am using alv with checkbox at extream right and one field date which is  editable.
    now i am executing program,selecing the checkbox and changing the date.
    i want to store the new value of the date field of the selected row in the internal table.
    anyone can tell me how can i store the new value of date field of the selected rows in the internal table.
    Thanks in advance.
    Chintan

    Hi Chintan,
    Please check this code:
    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
    This should help u out...
    Mark useful answers...

  • Disable editable field in ALV grid using OOPS

    I have following requirements,
    Displaying ALV grid output with most of the fields editable.
    Validations on data entered for each fields,for error messages
    Query :
    I want to make all the fields except the field in ERROR in display only mode
    similar to case when we do validation of fields in table controls.

    HI
    check the below links lot of info and examples r there for OOPS
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.geocities.com/victorav15/sapr3/abap_ood.html
    http://www.brabandt.de/html/abap_oo.html
    Check this cool weblog:
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    /people/thomas.jung3/blog/2004/12/08/abap-persistent-classes-coding-without-sql
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b6254f411d194a60000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/c3/225b5654f411d194a60000e8353423/content.htm
    http://www.esnips.com/doc/375fff1b-5a62-444d-8ec1-55508c308b17/prefinalppt.ppt
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    http://www.allsaplinks.com/
    http://www.sap-img.com/
    http://www.sapgenie.com/
    http://help.sap.com
    http://www.sapgenie.com/abap/OO/
    http://www.sapgenie.com/abap/OO/index.htm
    http://www.sapgenie.com/abap/controls/index.htm
    http://www.esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    http://www.esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    http://www.sapgenie.com/abap/OO/index.htm
    http://help.sap.com/saphelp_erp2005/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    http://www.sapgenie.com/abap/OO/
    these links
    http://help.sap.com/saphelp_47x200/helpdata/en/ce/b518b6513611d194a50000e8353423/content.htm
    For funtion module to class
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5954f411d194a60000e8353423/content.htm
    for classes
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b5c54f411d194a60000e8353423/content.htm
    for methods
    http://help.sap.com/saphelp_47x200/helpdata/en/08/d27c03b81011d194f60000e8353423/content.htm
    for inheritance
    http://help.sap.com/saphelp_47x200/helpdata/en/dd/4049c40f4611d3b9380000e8353423/content.htm
    for interfaces
    http://help.sap.com/saphelp_47x200/helpdata/en/c3/225b6254f411d194a60000e8353423/content.htm
    For Materials:
    1) http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCABA/BCABA.pdf -- Page no: 1291
    2) http://esnips.com/doc/5c65b0dd-eddf-4512-8e32-ecd26735f0f2/prefinalppt.ppt
    3) http://esnips.com/doc/2c76dc57-e74a-4539-a20e-29383317e804/OO-abap.pdf
    4) http://esnips.com/doc/0ef39d4b-586a-4637-abbb-e4f69d2d9307/SAP-CONTROLS-WORKSHOP.pdf
    5) http://esnips.com/doc/92be4457-1b6e-4061-92e5-8e4b3a6e3239/Object-Oriented-ABAP.ppt
    6) http://esnips.com/doc/448e8302-68b1-4046-9fef-8fa8808caee0/abap-objects-by-helen.pdf
    7) http://esnips.com/doc/39fdc647-1aed-4b40-a476-4d3042b6ec28/class_builder.ppt
    8) http://www.amazon.com/gp/explorer/0201750805/2/ref=pd_lpo_ase/102-9378020-8749710?ie=UTF8
    1) http://www.erpgenie.com/sap/abap/OO/index.htm
    2) http://help.sap.com/saphelp_nw04/helpdata/en/ce/b518b6513611d194a50000e8353423/frameset.htm
    Check these sample code
    data : begin of it_mara occurs 0,
    mark type flag,
    matnr type matnr,
    mtart type mtart,
    meins type meins,
    end of it_mara.
    data : begin of it_mara1 occurs 0,
    mark type flag,
    matnr type matnr,
    mtart type mtart,
    meins type meins,
    end of it_mara1.
    data : begin of it_mara2 occurs 0,
    mark type flag,
    matnr type matnr,
    mtart type mtart,
    meins type meins,
    end of it_mara2.
    data : t_fieldcat type lvc_t_fcat,
    t_fieldcat1 type lvc_t_fcat,
    s_fieldcat like line of t_fieldcat.
    data : s_layout type lvc_s_layo.
    data : control type ref to cl_gui_custom_container,
    grid type ref to cl_gui_alv_grid.
    data: begin of wa ,
    mark type flag,
    matnr type matnr,
    mtart type mtart,
    meins type meins,
    end of wa.
    class lcl_events_box definition.
    public section.
    methods :
    *Handler_Data_Changed for event Data_Changed of cl_gui_alv_grid
    *imporTing er_data_changed,
    Handler_User_Command for event User_Command of cl_gui_alv_grid
    imporTing e_ucomm,
    Handler_ToolBar for event ToolBar of cl_gui_alv_grid
    importing E_object E_interactive.
    endclass.
    class lcl_events_box implementation.
    method Handler_user_command.
    PERFORM FORM_USERCOMMAND CHANGING E_UCOMM.
    endmethod.
    method Handler_ToolBar.
    PERFORM FORM_TOOLBAR CHANGING E_OBJECT E_INTERACTIVE
    E_OBJECT->MT_TOOLBAR.
    endmethod.
    ENDCLASS.
    start-of-selection.
    data : w_events type ref to lcl_events_box.
    select matnr mtart meins from mara into corresponding fields of table
    it_mara.
    call screen 100.
    *& Module pbo_module OUTPUT
    text
    MODULE pbo_module OUTPUT.
    if GRID is initial.
    CREATE OBJECT CONTROL
    EXPORTING
    CONTAINER_NAME = 'CUST_CTRL'.
    CREATE OBJECT GRID
    EXPORTING
    I_PARENT = CONTROL.
    PERFORM BUILD_CATALOG.
    PERFORM BUILD_CATALOG1.
    PERFORM BUILD_LAYOUT.
    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    IS_LAYOUT = s_layout
    CHANGING
    IT_OUTTAB = it_mara[]
    IT_FIELDCATALOG = t_fieldcat.
    CREATE OBJECT W_EVENTS.
    SET HANDLER : W_EVENTS->HANDLER_TOOLBAR FOR GRID,
    W_EVENTS->HANDLER_USER_COMMAND FOR GRID.
    CALL METHOD GRID->SET_TOOLBAR_INTERACTIVE.
    ELSE.
    call method grid->refresh_table_display.
    ENDIF.
    ENDMODULE. " pbo_module OUTPUT
    *& Form BUILD_CATALOG
    FORM BUILD_CATALOG .
    S_FIELDCAT-COL_POS = '1'.
    S_FIELDCAT-FIELDNAME = 'MARK'.
    S_FIELDCAT-CHECKBOX = 'X'.
    S_FIELDCAT-eDIT = 'X'.
    APPEND S_FIELDCAT TO T_FIELDCAT.
    CLEAR S_FIELDCAT.
    S_FIELDCAT-COL_POS = '2'.
    S_FIELDCAT-FIELDNAME = 'MATNR'.
    S_FIELDCAT-SCRTEXT_M = 'MATERIAL'.
    APPEND S_FIELDCAT TO T_FIELDCAT.
    S_FIELDCAT-COL_POS = '3'.
    S_FIELDCAT-FIELDNAME = 'MTART'.
    S_FIELDCAT-SCRTEXT_M = 'MATERL TYPE'.
    APPEND S_FIELDCAT TO T_FIELDCAT.
    S_FIELDCAT-COL_POS = '4'.
    S_FIELDCAT-FIELDNAME = 'MEINS'.
    S_FIELDCAT-SCRTEXT_M = 'UOM'.
    APPEND S_FIELDCAT TO T_FIELDCAT.
    ENDFORM. " BUILD_CATALOG
    *& Form BUILD_LAYOUT
    text
    --> p1 text
    <-- p2 text
    FORM BUILD_LAYOUT .
    S_LAYOUT-ZEBRA = 'X'.
    S_LAYOUT-CWIDTH_OPT = 'X'.
    S_LAYOUT-GRID_TITLE = 'Material Details'.
    ENDFORM.
    " BUILD_LAYOUT////////////////////////////////////
    " USER_COMMAND_0100 INPUT
    *& Form FORM_USERCOMMAND
    text
    <--P_E_UCOMM text
    form FORM_USERCOMMAND changing p_e_ucomm.
    CASE P_E_UCOMM.
    WHEN 'INT1'.
    DO.
    READ TABLE IT_MARA INDEX SY-INDEX TRANSPORTING MARK MATNR.
    IF SY-SUBRC <> 0.
    EXIT.
    ENDIF.
    IF IT_MARA-MARK = 'X'.
    read table it_mara into wa TRANSPORTING MATNR MTART MEINS .
    MOVE-CORRESPONDING WA TO IT_MARA1.
    READ TABLE IT_MARA1 TRANSPORTING MATNR MTART MEINS .
    MOVE-CORRESPONDING IT_MARA1 TO IT_MARA2.
    APPEND IT_MARA2.
    CALL METHOD GRID->SET_TABLE_FOR_FIRST_DISPLAY
    EXPORTING
    IS_LAYOUT = s_layout
    CHANGING
    IT_OUTTAB = it_mara2[]
    IT_FIELDCATALOG = t_fieldcat1.
    SET PARAMETER ID 'MAT' FIELD IT_MARA-MATNR.
    CALL TRANSACTION 'MM02'.
    . ENDIF.
    ENDIF.
    ENDDO.
    ENDCASE.
    endform. " FORM_USERCOMMAND
    *& Form FORM_TOOLBAR
    text
    <--P_E_OBJECT text
    <--P_E_INTERACTIVE text
    <--P_E_OBJECT_>MT_TOOLBAR text
    FORM FORM_TOOLBAR CHANGING P_E_OBJECT TYPE REF TO
    CL_ALV_EVENT_TOOLBAR_SET
    P_E_INTERACTIVE
    MT_TOOLBAR TYPE TTB_BUTTON.
    DATA WAL_BUTTON TYPE STB_BUTTON.
    *WAL_BUTTON-ICON = ICON_status_reverse.
    WAL_BUTTON-TEXT = 'GO'.
    WAL_BUTTON-QUICKINFO = 'PROCEED'.
    waL_button-FUNCTION = 'INT1'.
    WAL_BUTTON-BUTN_TYPE = 0.
    WAL_BUTTON-DISABLED = SPACE.
    insert WAL_BUTTON INTO P_E_OBJECT->MT_TOOLBAR index 1.
    endform. " FORM_TOOLBAR
    *& Module PF-STATUS OUTPUT
    text
    module PF-STATUS output.
    set pf-status 'Z7PSTAT'.
    endmodule. " PF-STATUS OUTPUT
    *& Module USER_COMMAND_0100 INPUT
    text
    module USER_COMMAND_0100 input.
    CASE SY-UCOMM.
    WHEN 'BACK'.
    LEAVE PROGRAM.
    WHEN 'CANCEL'.
    LEAVE PROGRAM.
    ENDCASE.
    endmodule. " USER_COMMAND_0100 INPUT
    *& Form BUILD_CATALOG1
    text
    --> p1 text
    <-- p2 text
    form BUILD_CATALOG1 .
    S_FIELDCAT-COL_POS = '1'.
    S_FIELDCAT-FIELDNAME = 'MATNR'.
    S_FIELDCAT-SCRTEXT_M = 'MATERIAL'.
    APPEND S_FIELDCAT TO T_FIELDCAT1.
    S_FIELDCAT-COL_POS = '2'.
    S_FIELDCAT-FIELDNAME = 'MTART'.
    S_FIELDCAT-SCRTEXT_M = 'MATERL TYPE'.
    APPEND S_FIELDCAT TO T_FIELDCAT1.
    S_FIELDCAT-COL_POS = '3'.
    S_FIELDCAT-FIELDNAME = 'MEINS'.
    S_FIELDCAT-SCRTEXT_M = 'UOM'.
    APPEND S_FIELDCAT TO T_FIELDCAT1.
    endform. " BUILD_CATALOG1
    check the below link may be useful for you
    http://www.sapdevelopment.co.uk/reporting/alvhome.htm
    http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCSRVALV/BCSRVALV.pdf
    Simple ALV report
    http://www.sapgenie.com/abap/controls/alvgrid.htm
    http://wiki.ittoolbox.com/index.php/Code:Ultimate_ALV_table_toolbox
    ALV
    1. Please give me general info on ALV.
    http://www.sapfans.com/forums/viewtopic.php?t=58286
    http://www.sapfans.com/forums/viewtopic.php?t=76490
    http://www.sapfans.com/forums/viewtopic.php?t=20591
    http://www.sapfans.com/forums/viewtopic.php?t=66305 - this one discusses which way should you use - ABAP Objects calls or simple function modules.
    2. How do I program double click in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=11601
    http://www.sapfans.com/forums/viewtopic.php?t=23010
    3. How do I add subtotals (I have problem to add them)...
    http://www.sapfans.com/forums/viewtopic.php?t=20386
    http://www.sapfans.com/forums/viewtopic.php?t=85191
    http://www.sapfans.com/forums/viewtopic.php?t=88401
    http://www.sapfans.com/forums/viewtopic.php?t=17335
    4. How to add list heading like top-of-page in ABAP lists?
    http://www.sapfans.com/forums/viewtopic.php?t=58775
    http://www.sapfans.com/forums/viewtopic.php?t=60550
    http://www.sapfans.com/forums/viewtopic.php?t=16629
    5. How to print page number / total number of pages X/XX in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=29597 (no direct solution)
    6. ALV printing problems. The favourite is: The first page shows the number of records selected but I don't need this.
    http://www.sapfans.com/forums/viewtopic.php?t=64320
    http://www.sapfans.com/forums/viewtopic.php?t=44477
    7. How can I set the cell color in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=52107
    8. How do I print a logo/graphics in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=81149
    http://www.sapfans.com/forums/viewtopic.php?t=35498
    http://www.sapfans.com/forums/viewtopic.php?t=5013
    9. How do I create and use input-enabled fields in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=84933
    http://www.sapfans.com/forums/viewtopic.php?t=69878
    10. How can I use ALV for reports that are going to be run in background?
    http://www.sapfans.com/forums/viewtopic.php?t=83243
    http://www.sapfans.com/forums/viewtopic.php?t=19224
    11. How can I display an icon in ALV? (Common requirement is traffic light icon).
    http://www.sapfans.com/forums/viewtopic.php?t=79424
    http://www.sapfans.com/forums/viewtopic.php?t=24512
    12. How can I display a checkbox in ALV?
    http://www.sapfans.com/forums/viewtopic.php?t=88376
    http://www.sapfans.com/forums/viewtopic.php?t=40968
    http://www.sapfans.com/forums/viewtopic.php?t=6919
    Go thru these programs they may help u to try on some hands on
    ALV Demo program
    BCALV_DEMO_HTML
    BCALV_FULLSCREEN_DEMO ALV Demo: Fullscreen Mode
    BCALV_FULLSCREEN_DEMO_CLASSIC ALV demo: Fullscreen mode
    BCALV_GRID_DEMO Simple ALV Control Call Demo Program
    BCALV_TREE_DEMO Demo for ALV tree control
    BCALV_TREE_SIMPLE_DEMO
    BC_ALV_DEMO_HTML_D0100
    <b>Reward all helpfull answers</b>
    Regards

  • Restricting character values in Editable field in ALV

    Hi ,
    I am working on Editable ALV ..,
    Editable field is net amount field ,
    can you tell me how to restrict the user to enter the
    character values before he is going for saving.
    can i restrict the user while entering it self b'coz
    while saving message is getting but client want at user entry level itself..,
    code ::
      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-REF_TABLE = 'EKPO'.
      WA_FIELDCAT-REF_FIELD  = 'NETPR'.
      APPEND WA_FIELDCAT TO IT_FIELDCAT.
      CLEAR  WA_FIELDCAT.
    regards,
    abdul

    Hi,
    Yes, you can ristrict the data entered by user.
    1. declare the field of type P for net price, if will not accept character values. and  if user entered char value and press enter it 
        will through error.
    2. check in loop, if net price is of P type, etc....
    3. u cas pass routine to your REUSE_ALV_grid_display.
    i_callback_user_command           = 'USER_COMM'  
    in user_comm you can write ur logic.
    Ex: when Save.
           check ur fiels etc...
    4. remove the given reference table and field name.
    EX :   LS_FIELDCAT-REF_FIELDNAME = 'NAME1'.
                LS_FIELDCAT-REF_TABNAME = 'ZCYLI_QUAN'.
    hope this will solve your problem.

  • Unable to enter value in editable field of ALV (set_current_cell_via_id)

    In the Editable screen of ALV, I have to set the cursor on the 3rd field 'VBELN' ( which is editable ).
    Using the method set_current_cell_via_id of ALV grid the focus has been set on the particular field. The field Sales order 'VBELN' is already set as editable (EDIT = 'X').
    But still I am unable to enter values unless and until I click anywhere on the screen.
    Please help me with the solution.
    Thanks in Advance.

    No...Whenever my screen is called, the focus is set on the 'VBELN' field but I can not enter the value.
    See the code below:
    Display the ALV report.
          CALL METHOD grf_alv_popup->set_table_for_first_display
            EXPORTING
              is_layout                     = gs_layout
              it_toolbar_excluding          = gt_exclude
            CHANGING
              it_outtab                     = fp_output[]
              it_fieldcatalog               = gt_fieldcat_popup
            EXCEPTIONS
              invalid_parameter_combination = 1
              program_error                 = 2
              too_many_lines                = 3
              OTHERS                        = 4.
          IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
          ENDIF.
    ls_row-row_id = 1.
    ls_col-fieldname = 'VBELN'.
          CALL METHOD grf_alv_popup->set_current_cell_via_id
            EXPORTING
              is_column_id = ls_col
              is_row_no    = ls_row.
    With the method set_current_cell_via_id, the field VBELN displays as highlighted but to enter the value I need to click on the screen first.

Maybe you are looking for

  • Combine csv files and insert source filename

    Newbie powershell question - Need help combining multiple csv files (100+) and inserting a column containing the name of the source file ex:  Apples.csv A,B,C,D 1,2,3,4 Oranges.csv A,B,C,D 1,2,3,4 Desired output would look like this: combined.csv A,B

  • 2nd iPod doesnt update when connected to iTunes

    I have 2 iPod Nano's 2nd Gen. When I connect the first one itunes updates then shows the message "iPod update is complete. OK to disconnect." Then the iPod disply shows the charging icon. When I connect the second nano it does not try to update. It s

  • Solman Integration with HP QC

    HI we have installed new Solman EhP1 7.0 SPS23, we already have HP QC 10. we have installed Enterprise Integration 2.5 in HP QC and ST-QCA in Solman I have completed all the steps provided in SPRO, except connecting link to QC project. from solman pr

  • Programmtically Scaling the front panel objects depending on the Dispaly card resolution.

    I have programmed my application in dispaly resolution of 1024 by 768. I want to deploy the same code on a machine having a resolution of 800 by 600. how do i scale down my front panel objects to 800 by 600 resolution . I want to do it programmatical

  • How to make 'always open in ... view' check box actually work?

    What I need is a "Make 'Always open in ... view' check box work" check box. Specifically: I double click on my hard drive icon to open its window. I press command 3 to make it display in column view. I press command J and check "Always open in column