Editable cell in ALV OO with F4 Help

Hi Abapers,
i have an ALV with an editable cell wich an F4 help is available on it. When clicking on the F4 button i'm getting the list of possible values but when choosing a value it is not updating the alv cell. (F4 help is on a Z* field wich i created already with its matchcode).
Does anyone have a piece of code wich can help ?
Thanks in advance,
Soufiane

Hi,
Check the following code:
*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 eventINITIALIZATION.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 fieldcatFORM 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
Regards,
Bhaskar

Similar Messages

  • Alv field with f4 help without using class

    Hi,
    Can any one give me a program of "Alv field with f4 help without using class".
    Thanking you in advance.

    hi
    <b>Linking F4 Help to Fields</b>
    For the last section, we will deal with linking F4 help to fields. It is easy. As usual, define, implement and register the event “onf4” at proper places in your code. For F4 help, you must register the fields whose F4 request will trigger the “onf4” event. For this you must prepare a table of type “LVC_T_F4” and register this table using the method “register_f4_for_fields”. While preparing table you must include a line for each field which will trigger F4 event. For each field in the structure;
    &#1048766; Pass the fieldname to ‘FIELDNAME’
    &#1048766; Set ‘REGISTER’ to make the field registered,
    &#1048766; Set ‘GETBEFORE’ to provide field content transport before F4 in editable mode
    &#1048766; Set ‘CHNGEAFTER’ to make the data changed after F4 in editable mode.
    DATA: lt_f4 TYPE lvc_t_f4 WITH HEADER LINE .
    lt_f4-fieldname = 'PRICE'.
    lt_f4-register = 'X' .
    lt_f4-getbefore = 'X' .
    APPEND lt_f4 .
    CALL METHOD gr_alvgrid->register_f4_for_fields
    EXPORTING
    it_f4 = lt_f4[] .
    Preparing table for the fields to be registered to trigger F4 event
    METHOD handle_on_f4 .
    PERFORM f4_help USING e_fieldname es_row_no .
    er_event_data->m_event_handled = 'X' .
    ENDMETHOD .
    A sample “onf4” method implementation
    Again, we set the attribute “er_event_data->m_event_handled” to prevent further processing of standard F4 help.
    regards
    Ravish
    <b>
    reward if useful</b>

  • One editable cell in alv grid using function module

    Hello all,
    Any one have an idea how to make a single editable cell in alv grid using function module, i mean to say
    with out using object oriented programming.
    Regards,
    Prakash

    Hi,
    Using ALV List display it is possible.
    Try this.
    TYPE-POOLS:SLIS.
    DATA: X_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
    DATA: IT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
    DATA:IT_EVENTS TYPE SLIS_T_EVENT.
    data: begin of it_chg occurs 0,
          index type sy-tabix,
          end of it_chg.
    DATA:  X_EVENTS    TYPE SLIS_ALV_EVENT.
    DATA: BEGIN OF ITAB OCCURS 0,
          NAME(10) TYPE C,
          ZTERM TYPE C,
          END OF ITAB.
    PERFORM FILL_TABLE.
    loop at itab where zterm = 'A'.
    it_chg-index = sy-tabix + 3.
    " addition 3 IS FOR FIELD LABELS
    append it_chg.
    clear it_chg.
    endloop.
    DATA:L_POS TYPE I VALUE 1.
    CLEAR: L_POS.
    L_POS = L_POS + 1.
    **fieldcatalog
    X_FIELDCAT-FIELDNAME = 'NAME'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-OUTPUTLEN = '10'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    L_POS = L_POS + 1.
    X_FIELDCAT-FIELDNAME = 'ZTERM'.
    X_FIELDCAT-TABNAME = 'ITAB'.
    X_FIELDCAT-COL_POS    = L_POS.
    X_FIELDCAT-OUTPUTLEN = '10'.
    APPEND X_FIELDCAT TO IT_FIELDCAT.
    CLEAR X_FIELDCAT.
    **events
    REFRESH:IT_EVENTS.
    CLEAR:X_EVENTS,IT_EVENTS.
    X_EVENTS-NAME = SLIS_EV_END_OF_LIST.
    X_EVENTS-FORM = 'MODIFY_LIST'.
    APPEND X_EVENTS TO IT_EVENTS.
    CLEAR X_EVENTS.
    END-OF-SELECTION.
    data lv_repid type sy-repid.
    lv_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
        EXPORTING
          I_CALLBACK_PROGRAM = lv_REPID
          IT_FIELDCAT        = IT_FIELDCAT
          IT_EVENTS          = IT_EVENTS
        TABLES
          T_OUTTAB           = ITAB
        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.
    *&      Form FILL_TABLE
          text
    FORM FILL_TABLE.
      ITAB-NAME = 'AAA'.
      ITAB-ZTERM = 'A'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = 'ABC'.
      ITAB-ZTERM = 'B'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = 'TEST'.
      ITAB-ZTERM = 'C'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = 'BBB'.
      ITAB-ZTERM = 'D'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = '123'.
      ITAB-ZTERM = 'E'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = 'GEN'.
      ITAB-ZTERM = 'A'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = 'ALV'.
      ITAB-ZTERM = 'F'.
      APPEND ITAB.
      clear itab.
      ITAB-NAME = 'ALVTEST'.
      ITAB-ZTERM = 'A'.
      APPEND ITAB.
      clear itab.
    ENDFORM.                    "FILL_TABLE
    *&      Form  MODIFY_LIST
          text
    FORM MODIFY_LIST.
    data: l_lines type i.
    describe table itab lines l_lines.
      L_LINES  = L_LINES + 3.
    "because we have 3 lines extra occupied by lables.
    "if we have header,i mean top of page add the no.of lines
    "how many ever top of page have + 3 for labels.
      DO L_LINES TIMES.
        read table it_chg with key INDEX = sy-index.
        if sy-subrc = 0.
    **This code is for reading the out put line
    **and modify accordinlg to our requiremnet.
    **don't chnage this.
          READ LINE SY-INDEX INDEX SY-LSIND.
          IF SY-SUBRC = 0.
            MODIFY LINE SY-INDEX INDEX SY-LSIND
                       FIELD FORMAT ITAB-NAME INPUT.
          ENDIF.
        ENDIF.
      ENDDO.
    ENDFORM.                    "MODIFY_LIST

  • Problem with 'Word edit cell.vi' , Inputs transduced with the value of every row repeated

    Hello,
    Im using LV2013 with office 2013 report tool kit. I am trying to use Word edit cell to input values in table previously created in template .doc.
    Indeed, i trying the example Generate report from template and didnt works well. I search for solution and I see it was a problem with previous version but it seems not solve totally in this version for word office 2010. 
    http://digital.ni.com/public.nsf/allkb/4041ECB5D02BA57D862579A00002FE8D
    I checked this thread but i didnt get it to works. http://forums.ni.com/t5/LabVIEW/Problem-with-append-table-and-Word-2010/m-p/2190960#M702610
    Any way to solve it?.
    Thanks for help.
    Fred
    Attachments:
    error.png ‏32 KB
    Untitled 1.vi ‏19 KB
    exampleTemplate.doc ‏37 KB

    Hello, I solve it adding this to Word_insert_Table.
    http://forums.ni.com/t5/LabVIEW/Report-Generation-MS-Word-Table-Bug/td-p/1605170
    Thanks.
    Open [LabVIEW installation folder]\vi.lib\addons\_office\_wordsub.llb\Word_Insert_Table.vi
    There is a nested for loop that interprets the provided string array data and reformats it into a long ASCII string for the copy buffer. It should look like this:
    Change the nested loop to look like this:
    The changes I've made are twofold:
    1. Within the inner loop, replace the "\n" char with a Tab character
    2. Just after the inner loop, add a new "concatenate strings" function that adds "\n".

  • Edit cells in alv report

    hi,
    i have used FM like
    CALL FUNCTION 'REUSE_ALV_HIERSEQ_LIST_DISPLAY'
          EXPORTING
            I_CALLBACK_PROGRAM = L_REPID
            I_CALLBACK_USER_COMMAND= 'FRM_USER_COMMAND '
            IT_FIELDCAT        = IT_FIELDCAT
            it_events          = lt_evts
            I_TABNAME_HEADER   = G_TABNAME_HEADER
            I_TABNAME_ITEM     = G_TABNAME_ITEM
            IS_KEYINFO         = GS_KEYINFO
          TABLES
            T_OUTTAB_HEADER    = IT_HEADER
            T_OUTTAB_ITEM      = IT_ITEM
          EXCEPTIONS
            PROGRAM_ERROR      = 1
            OTHERS             = 2.
    form frm_user_command using r_ucomm     like sy-ucomm
                                          rs_selfield type slis_selfield.
                                                                "#EC *
      data: l_event type lvc_fname.               
    case r_ucomm.
        when 'EDIT'.
        perform switch_edit_mode.
    endcase.
    endform.
    FORM switch_edit_mode.
    IF gr_grid_d1001->is_ready_for_input( ) eq 0.
    set edit enabled cells ready for input
        CALL METHOD gr_grid_d1001->set_ready_for_input
                         EXPORTING i_ready_for_input = 1.
      ELSE.
    lock edit enabled cells against input
        CALL METHOD gr_grid_d1001->set_ready_for_input
                        EXPORTING i_ready_for_input = 0.
      ENDIF.
    ENDFORM.                               " SWITCH_EDIT_MODE
    here i have a doubt like in this  gr_grid_d1001 was empty.please give some idea how to make the cells editable?
    i have also passed edit = 'X'. in fieldcatalog

    Hi Priya,
    Check out the sample program:
    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
    Thanks,
    Chidanand

  • Web dynpro ALV requirement with search help

    Hello Experts,
    I developed a custom transaction in Web dynpro. It has an ALV display in editable mode where the user can enter Material number, plant, quantity and Batch as input fields for Production confirmation.
    There is a requirement to add a search-help to BATCH field similar to the one that appears in std. MFBF transaction. Basically what it means is that I will have to capture the material, plant of that line in ALV table and get the stock and batch details from MCHB table and provide them in search help.
    I created a dictionary search help with a search-help exit FM that will extract the details from MCHB table. I am having trouble in extracting the line index to get the material number and plant values from the view to export.
    Please help me as to how to extract the line index of an ALV table for which the F4 help was clicked.
    Also it would be great if I could find a much simpler and better approach to handle the requirement.
    Regards
    Pratyusha

    Hi,
    If you have set the help mode as dictionary search help in your context, and if you have defined your search help to have these importing and exporting parameters, then it will work without you doing anything else. Provided you have mentioned the name of the search help in the structure definition itself. You do not have to write explicit event handlers for dictionary search helps.
    Or else, you can use an OVS search help. In that case, in the OVS event handler, you will have a parameter ovs_callback_object. Ovs_callback_object->context_element will give you the element on which the F4 was clicked. If you do a get_static_attributes on that, you will get the values of each attribute. Then you can call your function module to get the Batch field. I think OVS will suit your requirement. You can see examples of OVS in the component demo_value_help in the package swdp_demo.
    Hope this helps.
    Regards,
    Nithya

  • How to make editable cell in ALV TREE?

    Hi all,
    I have a problem to make the cell in item row (I mean not  the cell in hierarchy columns and not in the node row) in ALV tree editable.
    I know to make it in "normal" ALV, but my ALV is type class: cl_gui_alv_tree and the nodes are calculated in a sum.Can anyone help me to set the cell editable in ALV tree?
    Thank you a lot!
    Best regards,
    Danijela Zivanovic
    Message was edited by: Danijela Zivanovic

    HI,
    To make a column editable, it will be sufficient to set the field “<b>EDIT</b>” in the field catalog. The ALV Grid perceives if there are some editable fields and adds buttons for editing purposes. If you do not need these new buttons
    <u><i>if you want it in the Classes</i></u>
    For this procedure; add the name of the field to the field “FIELDNAME”, and pass “cl_gui_alv_grid=>mc_style_enabled” to make a field editable and “cl_gui_alv_grid=>mc_style_disabled” to make a field non-editable,
    <b>Example:</b>
    FORM adjust_editables USING pt_list LIKE gt_list[] .
    DATA ls_listrow LIKE LINE OF pt_list .
    DATA ls_stylerow TYPE lvc_s_styl .
    DATA lt_styletab TYPE lvc_t_styl .
    LOOP AT pt_list INTO ls_listrow .
    IF ls_listrow-carrid = 'XY' .
    ls_stylerow-fieldname = 'SEATSMAX' .
    ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled . APPEND ls_stylerow TO lt_styletab .
    ENDIF .
    IF ls_listrow-connid = '02' .
    ls_stylerow-fieldname = 'PLANETYPE' .
    ls_stylerow-style = cl_gui_alv_grid=>mc_style_enabled . APPEND ls_stylerow TO lt_styletab .
    ENDIF .
    INSERT LINES OF lt_styletab INTO ls_listrow-cellstyles . MODIFY pt_list FROM ls_listrow .
    ENDLOOP .
    ENDFORM
    Thanks
    Sudheer

  • ALVGRID edit cell IN SAPGUI JAVA for MAC

    Hello!:
    I have a problem with a editable cell in ALV GRID. When I like select a cell to writer with the keyboard i can´t write in, is necesary select it with the "mouse".
    Sorry my english is very bad and thanks for the help.

    HI,
    You can select cells if pushbuttons are displayed on the left side of your list. The use of the ALV Grid Control then determines whether you can select one or several cells
    To select an individual cell, click the relevant entry.
    To select several cells, choose Shift, and choose the relevant cells

  • Mouse Double Click on an editable cell of JTable

    Hi Pros:
    Maybe this is an old question but no answser from Forum.
    I have a JTable with adding MouseListener. I tried to put double click behavior on nay row in the table. The problem was that this action can obly work on the uneditable cell and do not work on editable cell.
    Anyone have ideas and help me.
    Thank you!

    Hi Wang,
    I have a problem similar to the one you have some time back.
    I have a query for which I need to use PreparedStatement .The query runs likes this :-
    String str = " Select ? , ename from emp where deptno ? ";
    The values of ? need to be assigned dynamically.
    But I cannot create Prepared Statement from this query .
    If you have got answer to your questions can you inform me at
    [email protected]
    Thanks in advance

  • Editable cell table

    Hi experts,
    I need to make editable a cell of a table on a web dynpro. How can I do?
    Tks in advance.

    Hi,
    *Editable cell in ALV table*
    1] I want to edit the alv table cell and I want to capture what we enter in that cell.
    2] I want to put the check box,radio button  in the first column of the  alv table.
    3] Based on the check i want to write my requirement.
    Can you know how to do the above points please let me know how to do that if you did give me data.

  • ALV- Editable cell with sign (+/-)

    Hello,
    I have an ALV with one editable cell. I need that in this cell I can put a number with sign, I try with data elements that accepts sign but it doesn't work well.
    Can anyone help me? Can I modify the fieldcatalog.
    I'm using the FM Reuse_alv_grid.
    Thanks

    try this..
    wa_fcat-no_sign = '  '.

  • Editable field with F4 help in alv tree output using cl_gui_alv_tree

    HI
    i need Editable field with F4 help in alv tree output using cl_gui_alv_tree
    Regards
    Naresh

    Hi Naresh,
    Pass the field catalog with the additional parameter (ls_fcat-edit = 'X'.).
    for F4 help if the data element have the search help it automatically will come. other wise include the additional parameter in the field catalog (ls_fcat-F4AVAILABL = 'X')
    Reward if found helpful.
    Regards,
    Boobalan Suburaj

  • Need help in ALV grid editable cells

    Hi,
    I have created a ALV Grid program in which i made certain cells as editable cells.Now my question is if suppose i have 2 rows in my output then if i change the 2nd rows some cells, then some calculation has to perform till this it is fine but nw i want to modify the 3rd rows some cells as per the changes in 2nd row.
    How to do it with ALV oops concepts.
    I have refered BCALV_EDIT_02 and BCALV_EDIT_03 these std programs.
    Thanks & Regards
    Madhuri

    Hello Madhuri
    I recommend to do any post-processing of the changed data OUTSIDE your event handler method (HANDLE_DATA_CHANGED).
    Within the event handler method do all required validations and the trigger PAI by calling method CL_GUI_CFW=>SET_NEW_OK_CODE (for an example refer to my sample report ZUS_SDN_TWO_ALV_GRIDS in alv)
    Now at PAI of your screen you can do any kind of post-processing, calculation, etc. within the itab used for the ALV list.
    Regards
      Uwe

  • Editable ALV with F4 help

    Hi Gurus,
    I have created an editable ALV with F4 help, but the value doesnt reflect in the F4 help.
    Regards,
    Chinmaya

    Hi Chinmaya,
    Include the field F4AVAILABL in your field catalog internal table.
    itab_fieldcatalog-F4AVAILABL = X
    if you are not using the data element for the field 'F4' help won't come. in this situation, use the ONF4 event to build the F4 Help.
    Reward if found helpful.
    Regards,
    Boobalan Suburaj

  • ALV editable Cells, fixed Columns, possible?

    I've got 2 issues:
    1) User should not be able to move Columns, how can I do this using CL_GUI_ALV_GRID?
    2) I know how to make a whole column editable in an ALV (CL_GUI_ALV_GRID), but how can I make only some cells editable?
    thanks for your help.
    Samir

    Hi,
    for making certain cells editable check this code...
    steps are ..
    1.you need to add one extra field in the internal table.
       HANDLE_STYLE TYPE LVC_T_STYL
    2. before calling the metho set_table_display...
    write your own conditions , in my case i am checking for flag is 'X' or not..
    LOOP AT IT_FINAL INTO LS_OUTTAB WHERE FLAG = 'X'.
        V_INDEX = SY-TABIX.
        LS_EDIT-FIELDNAME = 'FIELD1'.
        LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
        LS_EDIT-STYLE2 = SPACE.
        LS_EDIT-STYLE3 = SPACE.
        LS_EDIT-STYLE4 = SPACE.
        LS_EDIT-MAXLEN = 8.
        INSERT LS_EDIT INTO TABLE LT_EDIT.
        LS_EDIT-FIELDNAME = 'FIELD2'.
        LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
        LS_EDIT-STYLE2 = SPACE.
        LS_EDIT-STYLE3 = SPACE.
        LS_EDIT-STYLE4 = SPACE.
        LS_EDIT-MAXLEN = 8.
        INSERT LS_EDIT INTO TABLE LT_EDIT.
        LS_EDIT-FIELDNAME = 'FIELD5'.
        LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
        LS_EDIT-STYLE2 = SPACE.
        LS_EDIT-STYLE3 = SPACE.
        LS_EDIT-STYLE4 = SPACE.
        LS_EDIT-MAXLEN = 8.
        INSERT LS_EDIT INTO TABLE LT_EDIT.
        INSERT LINES OF LT_EDIT INTO TABLE LS_OUTTAB-HANDLE_STYLE.
        MODIFY IT_FINAL INDEX V_INDEX FROM LS_OUTTAB  TRANSPORTING
                                          HANDLE_STYLE.
      ENDLOOP.
    3. psss the style name to layout
      GS_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
    REPORT  ZTEST1234    MESSAGE-ID ZZ                           .
    DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID,  "First
          G_GRID1 TYPE REF TO CL_GUI_ALV_GRID. "Second
    DATA: L_VALID TYPE C,
          V_FLAG,
          V_DATA_CHANGE,
          V_ROW TYPE LVC_S_ROW,
          V_COLUMN TYPE LVC_S_COL,
          V_ROW_NUM TYPE LVC_S_ROID.
    DATA: OK_CODE LIKE SY-UCOMM,
          SAVE_OK LIKE SY-UCOMM,
          G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST', "First Container
          G_CONTAINER2 TYPE SCRFNAME VALUE 'TEST1',"Second container
          GS_LAYOUT TYPE LVC_S_LAYO.
    DATA:BEGIN OF  ITAB OCCURS 0,
         VBELN LIKE LIKP-VBELN,
         POSNR LIKE LIPS-POSNR,
         LFDAT like lips-vfdat,
         BOX(1),
         HANDLE_STYLE TYPE LVC_T_STYL,
         END OF ITAB.
    *       CLASS lcl_event_handler DEFINITION
    CLASS LCL_EVENT_HANDLER DEFINITION .
      PUBLIC SECTION .
        METHODS:
    **Hot spot Handler
        HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
                          IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
    **Handler to Check the Data Change
        HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
                             OF CL_GUI_ALV_GRID
                             IMPORTING ER_DATA_CHANGED
                                       E_ONF4
                                       E_ONF4_BEFORE
                                       E_ONF4_AFTER,
    **Double Click Handler
        HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
                                         IMPORTING E_ROW E_COLUMN ES_ROW_NO.
    ENDCLASS.                    "lcl_event_handler DEFINITION
    *       CLASS lcl_event_handler IMPLEMENTATION
    CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
    *Handle Hotspot Click
      METHOD HANDLE_HOTSPOT_CLICK .
        CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
        V_ROW  = E_ROW_ID.
        V_COLUMN = E_COLUMN_ID.
        V_ROW_NUM = ES_ROW_NO.
        MESSAGE I000 WITH V_ROW 'clicked'.
      ENDMETHOD.                    "lcl_event_handler
    *Handle Double Click
      METHOD  HANDLE_DOUBLE_CLICK.
        CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
        V_ROW  = E_ROW.
        V_COLUMN = E_COLUMN.
        V_ROW_NUM = ES_ROW_NO.
        IF E_COLUMN = 'VBELN'.
          SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
          CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
        ENDIF.
        IF E_COLUMN = 'POSNR'.
          MESSAGE I000 WITH 'Click on POSNR row number '  E_ROW.
          "with this row num you can get the data
        ENDIF.
      ENDMETHOD.                    "handle_double_click
    **Handle Data Change
      METHOD HANDLE_DATA_CHANGED.
        CALL METHOD G_GRID->REFRESH_TABLE_DISPLAY
          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.
      ENDMETHOD.                    "HANDLE_DATA_CHANGED
    ENDCLASS.                    "LCL_EVENT_HANDLER IMPLEMENTATION
    *&             Global Definitions
    DATA:      G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,"Container1
                G_HANDLER TYPE REF TO LCL_EVENT_HANDLER, "handler
                G_CUSTOM_CONTAINER1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER. "Container2
    *- Fieldcatalog for First and second Report
    DATA: IT_FIELDCAT  TYPE  LVC_T_FCAT,
          X_FIELDCAT TYPE LVC_S_FCAT,
          LS_VARI  TYPE DISVARIANT.
    *                START-OF_SELECTION
    START-OF-SELECTION.
      SELECT VBELN
             POSNR
             FROM LIPS
             UP TO 20 ROWS
             INTO CORRESPONDING FIELDS OF TABLE ITAB.
    END-OF-SELECTION.
      IF NOT ITAB[] IS INITIAL.
        CALL SCREEN 100.
      ELSE.
        MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
      ENDIF.
    *&      Form  CREATE_AND_INIT_ALV
    *       text
    FORM CREATE_AND_INIT_ALV .
      DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
    "First Grid
      CREATE OBJECT G_CUSTOM_CONTAINER
             EXPORTING CONTAINER_NAME = G_CONTAINER1.
      CREATE OBJECT G_GRID
             EXPORTING I_PARENT = G_CUSTOM_CONTAINER.
    "Second Grid
      CREATE OBJECT G_CUSTOM_CONTAINER1
             EXPORTING CONTAINER_NAME = G_CONTAINER2.
      CREATE OBJECT G_GRID1
             EXPORTING I_PARENT = G_CUSTOM_CONTAINER1.
    * Set a titlebar for the grid control
      CLEAR GS_LAYOUT.
      GS_LAYOUT-GRID_TITLE = TEXT-003.
      GS_LAYOUT-ZEBRA = SPACE.
      GS_LAYOUT-CWIDTH_OPT = 'X'.
      GS_LAYOUT-NO_ROWMARK = 'X'.
      GS_LAYOUT-BOX_FNAME = 'BOX'.
      GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
      GS_LAYOUT-STYLEFNAME = 'HANDLE_STYLE'.
      CALL METHOD G_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
      CREATE OBJECT G_HANDLER.
      SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
    *  SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
      SET HANDLER G_HANDLER->HANDLE_DATA_CHANGED FOR G_GRID.
    data: ls_outatb like line of itab,
          v_index type sy-tabix.
    DATA: LS_EDIT TYPE LVC_S_STYL,
            LT_EDIT TYPE LVC_T_STYL.
    LOOP AT ITAB INTO ls_outatb WHERE POSNR = '000010'.
        V_INDEX = SY-TABIX.
        LS_EDIT-FIELDNAME = 'VBELN'.
        LS_EDIT-STYLE = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
        LS_EDIT-STYLE2 = SPACE.
        LS_EDIT-STYLE3 = SPACE.
        LS_EDIT-STYLE4 = SPACE.
        LS_EDIT-MAXLEN = 8.
        INSERT LS_EDIT INTO TABLE LT_EDIT.
        INSERT LINES OF LT_EDIT INTO TABLE ls_outatb-handle_style.
        MODIFY ITAB INDEX V_INDEX FROM ls_outatb  TRANSPORTING
                                          HANDLE_STYLE.
      ENDLOOP.
    * setting focus for created grid control
      CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
        EXPORTING
          CONTROL = G_GRID.
    * Build fieldcat and set editable for date and reason code
    * edit enabled. Assign a handle for the dropdown listbox.
      PERFORM BUILD_FIELDCAT.
    * Optionally restrict generic functions to 'change only'.
    *   (The user shall not be able to add new lines).
      PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
    **Vaiant to save the layout
      LS_VARI-REPORT      = SY-REPID.
      LS_VARI-HANDLE      = SPACE.
      LS_VARI-LOG_GROUP   = SPACE.
      LS_VARI-USERNAME    = SPACE.
      LS_VARI-VARIANT     = SPACE.
      LS_VARI-TEXT        = SPACE.
      LS_VARI-DEPENDVARS  = SPACE.
      CALL METHOD G_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_MODIFIED.
    **Calling the Method for ALV output for First Grid
      CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
          IS_VARIANT           = LS_VARI
          IS_LAYOUT            = GS_LAYOUT
          I_SAVE               = 'A'
        CHANGING
          IT_FIELDCATALOG      = IT_FIELDCAT
          IT_OUTTAB            = ITAB[].
    **Calling the Method for ALV output for Second Grid
       CALL METHOD G_GRID1->SET_TABLE_FOR_FIRST_DISPLAY
    *    EXPORTING
    *      IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
        CHANGING
          IT_FIELDCATALOG      = IT_FIELDCAT
          IT_OUTTAB            = ITAB[].
    * Set editable cells to ready for input initially
      CALL METHOD G_GRID->SET_READY_FOR_INPUT
        EXPORTING
          I_READY_FOR_INPUT = 1.
    ENDFORM.                               "CREATE_AND_INIT_ALV
    *&      Form  EXCLUDE_TB_FUNCTIONS
    *       text
    *      -->PT_EXCLUDE text
    FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
    * Only allow to change data not to create new entries (exclude
    * generic functions).
      DATA LS_EXCLUDE TYPE UI_FUNC.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
      LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
      APPEND LS_EXCLUDE TO PT_EXCLUDE.
    ENDFORM.                               " EXCLUDE_TB_FUNCTIONS
    *&      Form  build_fieldcat
    *       Fieldcatalog
    FORM BUILD_FIELDCAT .
      DATA: L_POS TYPE I.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
      X_FIELDCAT-FIELDNAME = 'VBELN'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-NO_ZERO    = 'X'.
      X_FIELDCAT-EDIT      = 'X'.
      X_FIELDCAT-OUTPUTLEN = '10'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
      X_FIELDCAT-SCRTEXT_M = 'Item'(025).
      X_FIELDCAT-FIELDNAME = 'POSNR'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '5'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
        L_POS = L_POS + 1.
        X_FIELDCAT-SCRTEXT_M = 'Del Date'(015).
      X_FIELDCAT-FIELDNAME = 'LFDAT'.
      X_FIELDCAT-TABNAME = 'ITAB'.
      X_FIELDCAT-COL_POS    = L_POS.
      X_FIELDCAT-OUTPUTLEN = '10'.
      APPEND X_FIELDCAT TO IT_FIELDCAT.
      CLEAR X_FIELDCAT.
      L_POS = L_POS + 1.
    ENDFORM.                    " build_fieldcat
    *&      Module  STATUS_0100  OUTPUT
    *       text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'MAIN100'.
      SET TITLEBAR 'MAIN100'.
      IF G_CUSTOM_CONTAINER IS INITIAL.
    **Initializing the grid and calling the fm to Display the O/P
        PERFORM CREATE_AND_INIT_ALV.
      ENDIF.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    *       text
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    Regards
    vijay

Maybe you are looking for

  • Volume & Brightness Controls do not work on Keyboard

    I have a five and a half year old Mac (purchased January 2009) running OS X 10.5.8.  My keyboard recently became faulty, so I went to the Apple store and bought the exact same thing as a replacement.  The keys all appeared to work fine and I was very

  • Command+Tab

    Hello, I've my dock on the left side of the screen and "hiding" is turned "on". If any window, lets say Safari, has been minimized onto a dock, and then, if I do Command+Tab to bring Safari up, it fails to bring the window up to front, instead only S

  • Intercompany Sales for 3 companies

    Hi All Expert, I am now facing big problem in setting of Intercompany sales. Now I want to set a new Company C, with Sales and Bill to Oversea customer, but goods are purchased from Company B, and the goods are produced by Company A and Ship to Custo

  • Rosettanet PIPS download

    Hi All, I am working on interfacing between Rosettanet and XI and i need to do the mapings. I need to import these PIPS into XI to start mapping and would like to know where i can download them from. Below are the PIPS and version i need to download.

  • Weblogic redeploys EJB despite warning

    I have my EJB Home and Remote classes in Weblogic's classpath while the EJB Jar (which contains Home , Remote and Bean) in the "applications" directory. When I start up the server , Weblogic deploys the EJB but gives the warning : <Warning> <EJB> <EJ