Field catalog update in ALV grid

Hi All,
When you're changing an existing field catalog in an ALV grid, there's a possibility this change will not appear immediately in the list display.
Can anyone explain this,
Kind regards,
Rob Makelaar.
The Netherlands

Hi Rob
ALV as an encapsulated object uses some kind of buffer for the field catalog. You can switch buffer capabilities with the parameter <b>"I_BUFFER_ACTIVE"</b> of the method <b>"set_table_for_first_display"</b>.
The use of this parameter is explained as follows:
<i>Flag to be set by the application if the method call is static. This means the method is always called with the same field catalog. In this case, the field catalog can be held in a special buffer. This accelerates the display of small lists, in particular.</i>
And as an additional point, you should have marked this thread as a question thread since you require some answer. If you want so, you can do this by editing your original post and check relevant checkbox under the editbox. This way you can reward points to helpful posts using the scala at the left of each particular post and you can mark a question as solved to save SDNers's times.
Regards
*--Serdar <a href="https://www.sdn.sap.com:443http://www.sdn.sap.comhttp://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.sdn.businesscard.sdnbusinesscard?u=qbk%2bsag%2bjiw%3d">[ BC ]</a>

Similar Messages

  • 'Field Catalog not Found' - ALV Grid using CustomContainer+Fcat

    The Following piece of code throws 'Field Catalgo not found'
    Please give me necessary changes in the code.
    Thanks & Regards
    Harsha Ch.
    *& Report  ZCHK_ALV_CUSCONT1                                           *
    REPORT  zchk_alv_cuscont1                       .
    DATA itab LIKE STANDARD TABLE OF mara WITH HEADER LINE.
    SELECT matnr meins mbrsh  FROM mara INTO CORRESPONDING FIELDS OF TABLE itab UP TO 10 ROWS.
    CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE status_0100 OUTPUT.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
      DATA fcat1 TYPE lvc_t_fcat WITH HEADER LINE.
      DATA  fcat TYPE STANDARD TABLE OF  lvc_s_fcat.
      DATA: c1 TYPE REF TO cl_gui_custom_container.
      DATA: a1 TYPE REF TO cl_gui_alv_grid.
      CREATE OBJECT c1 EXPORTING container_name = 'CC_ALV'.
      CREATE OBJECT a1 EXPORTING i_parent = c1.
      PERFORM populate_fcat.
      PERFORM generate_grid.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Form  POPULATE_FCAT
          text
    -->  p1        text
    <--  p2        text
    FORM populate_fcat .
      fcat1-reptext = 'MATNR'.
      fcat1-fieldname = 'MATNR'.
      fcat1-col_pos = '1'.
      APPEND fcat1.
      CLEAR fcat1.
      fcat1-reptext = 'MEINS'.
      fcat1-fieldname = 'MEINS'.
      fcat1-col_pos = '2'.
      APPEND fcat1.
      CLEAR fcat1.
      fcat1-reptext = 'MBRSH'.
      fcat1-fieldname = 'MBRSH'.
      fcat1-col_pos = '3'.
      APPEND fcat1.
      CLEAR fcat1.
    ENDFORM.                    " POPULATE_FCAT
    *&      Form  GENERATE_GRID
          text
    -->  p1        text
    <--  p2        text
    FORM generate_grid .
    CALL METHOD a1->set_table_for_first_display
    EXPORTING
       I_BUFFER_ACTIVE               =
       I_BYPASSING_BUFFER            =
       I_CONSISTENCY_CHECK           =
         I_STRUCTURE_NAME              = 'MARA'
       IS_VARIANT                    =
       I_SAVE                        =
       I_DEFAULT                     = 'X'
       IS_LAYOUT                     =
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
       IT_HYPERLINK                  =
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
      CHANGING
        it_outtab                     = itab[]
       IT_FIELDCATALOG               = fcat
       IT_SORT                       =
       IT_FILTER                     =
    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.
    ENDFORM.                    " GENERATE_GRID

    Hi
    This works fine:
    *& Report ZCHK_ALV_CUSCONT1 *
    DATA ITAB LIKE STANDARD TABLE OF MARA WITH HEADER LINE.
    DATA FCAT1 TYPE LVC_T_FCAT WITH HEADER LINE.
    DATA FCAT TYPE STANDARD TABLE OF LVC_S_FCAT.
    DATA: C1 TYPE REF TO CL_GUI_CUSTOM_CONTAINER.
    DATA: A1 TYPE REF TO CL_GUI_ALV_GRID.
    START-OF-SELECTION.
      SELECT MATNR MEINS MBRSH FROM MARA INTO CORRESPONDING FIELDS OF TABLE
      ITAB UP TO 10 ROWS.
      CALL SCREEN 100.
    *& Module STATUS_0100 OUTPUT
    * TEXT
    MODULE STATUS_0100 OUTPUT.
    *  PERFORM POPULATE_FCAT.
      PERFORM GENERATE_GRID.
    ENDMODULE. " STATUS_0100 OUTPUT
    *       FORM POPULATE_FCAT                                            *
    FORM POPULATE_FCAT .
      FCAT1-REPTEXT = 'MATNR'.
      FCAT1-FIELDNAME = 'MATNR'.
      FCAT1-COL_POS = '1'.
      APPEND FCAT1.
      CLEAR FCAT1.
      FCAT1-REPTEXT = 'MEINS'.
      FCAT1-FIELDNAME = 'MEINS'.
      FCAT1-COL_POS = '2'.
      APPEND FCAT1.
      CLEAR FCAT1.
      FCAT1-REPTEXT = 'MBRSH'.
      FCAT1-FIELDNAME = 'MBRSH'.
      FCAT1-COL_POS = '3'.
      APPEND FCAT1.
      CLEAR FCAT1.
    ENDFORM. " POPULATE_FCAT
    *       FORM GENERATE_GRID                                            *
    FORM GENERATE_GRID .
      CHECK C1 IS INITIAL.
      CREATE OBJECT C1 EXPORTING CONTAINER_NAME = 'CC_ALV'.
      CREATE OBJECT A1 EXPORTING I_PARENT = C1.
      CALL METHOD A1->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME = 'MARA'
        CHANGING
          IT_OUTTAB = ITAB[].
    ENDFORM. " GENERATE_GRID
    Max

  • Update all alv (grid) displayed records to internal table

    Hi all,
    i want to update the records into the internal table which are changed by the user in the edit field.
    after he select save button.
    i  have to save the ALV grid displayed records in the internal table.
    hw can i do this ?

    ALV with EDIT and SAVE functionality
    Code: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

  • To update an alv grid..

    Hello everyone,
    I have a requirement.
      update button in selection-screen.
    I have an alv grid display and I have to maintain last 2 fields in editable mode in the output and the user will enter the values after executing the report in the output screen and will save it.
    and when he will select  display radiobutton in the selection-screen ,,
    the entries which he entered above has to display ,,( all the entries should display in the output ).
    is it possible ? if yes, then let me know the procedure.
    will be rewarded..

    Hi,
           yes it is possible 
    all u need to do is call a new alv with same funtion modules and pass the updated internal table to these function modules
    i have the same req for 'SAVE' button in menu , u just change it by your radio button in the sample code below
    type-pools : slis.
    types : begin of t_mat,
            matnr type matnr,
            werks type werks_d,
            lgort type lgort_d,
            labst type labst,
            meins type meins,
            maktx type maktx,
            name1 type name1,
            lgobe type lgobe,
            msehl type msehl,
            v_lights type c,
            v_row type c length 4,     "FOR ROW COLOR
            v_col type slis_t_specialcol_alv,
            end of t_mat,
            begin of t_makt,
            matnr type matnr,
            maktx type maktx,
            end of t_makt,
            begin of t_marc,
            matnr type matnr,
            werks type werks_d,
            end of t_marc,
            begin of t_mard,
            matnr type matnr,
            werks type werks_d,
            lgort type lgort_d,
            labst type labst,
            end of t_mard,
            begin of t_t001l,
            werks type werks_d,
            lgort type lgort_d,
            lgobe type lgobe,
            end of t_t001l,
            begin of t_t001w,
            werks type werks_d,
            name1 type name1,
            end of t_t001w.
    types : begin of wa_mat,
            werks type werks,
            end of wa_mat.
    data : flag type i value 0.
    ******VARIABLE DECLARATION********
    data:v_prog_name type sy-repid,      "VARIABLE FOR PROG NAME
         v_grid_title type lvc_title. "VARIABLE FOR GRID TITLE
    *****INTERNAL TABLE DECLARATION***
    data:  it_mat type standard table of t_mat,
           it_marc type standard table of t_marc,
           it_mard type standard table of t_mard,
           it_t001l type standard table of t_t001l,
           it_t001w type standard table of t_t001w,
           it_makt type standard table of t_makt,
           it_fieldcat  type slis_t_fieldcat_alv,
           it_sortinfo   type slis_t_sortinfo_alv,
           it_eventcat   type slis_t_event,
           it_listheader type slis_t_listheader,
           t_color type slis_specialcol_alv.
    data : it_werks type standard table of wa_mat.
    *****WORK AREA DECLARATION*********
    data:  wa_mat type t_mat,
           wa_mard type t_mard,
           wa_t001l type t_t001l,
           wa_t001w type t_t001w,
           wa_makt type t_makt,
           wa_layout type slis_layout_alv.
    data : wa_werks type wa_mat.
    data : wa_variant1          like disvariant,
           wa_variant2          like disvariant.
               Selection-Screen                        *
    selection-screen begin of block plant with frame title text-001.
    select-options:  s_plant for wa_mat-werks,
                     s_stor for wa_mat-lgort.
    parameters     : p_var like disvariant-variant.
    selection-screen end of block plant.
    selection-screen begin of block output with frame title text-002.
    parameter:  p_rb_01 radiobutton group rd1 default 'X',  " list
                p_rb_02 radiobutton group rd1.              " grid
    selection-screen end of block output.
                   Initialization                      *
    perform zf_initialization.
                 At Selection Screen                   *
    at selection-screen on value-request for p_var.
      wa_variant1-report = sy-repid.
      call function 'REUSE_ALV_VARIANT_F4'
        exporting
          is_variant                = wa_variant1
      I_TABNAME_HEADER          =
      I_TABNAME_ITEM            =
      IT_DEFAULT_FIELDCAT       =
         i_save                    = 'A'
       i_display_via_grid        = 'X'
    importing
        e_exit                    = v_exit
         es_variant                = wa_variant2
       exceptions
         not_found                 = 1
         program_error             = 2
         others                    = 3
      if sy-subrc = 0.
        p_var = wa_variant2-variant.
      else.
        clear wa_variant2.
      endif.
    at selection-screen.
      perform zf_validate_sel_screen.
                Start of Selection                     *
    start-of-selection.
      perform zf_get_data.
              End of Selection                         *
    end-of-selection.
      perform zf_display_data.
    *&      Form  zf_initialization
      This will intialize all the variables, work area & subroutines
    -->  p1        text
    <--  p2        text
    form zf_initialization .
      clear :   wa_mat,
                wa_mard,
                wa_t001l,
                wa_t001w,
                wa_makt,
                wa_layout.
      refresh : it_mat,
                it_marc,
                it_mard,
                it_t001l,
                it_t001w,
                it_makt,
                it_fieldcat,
                it_sortinfo,
                it_eventcat,
                it_listheader.
      v_prog_name = sy-repid.
      wa_variant2-report = sy-repid.
      call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
        exporting
          i_save        = 'A'
        changing
          cs_variant    = wa_variant2
        exceptions
          wrong_input   = 1
          not_found     = 2
          program_error = 3
          others        = 4.
      if sy-subrc = 0.
        p_var = wa_variant2-variant.
      else.
        p_var = '/DEFAULT'.
      endif.
    endform.                    " zf_initialization
    *&      Form  zf_validate_sel_screen
      This is to validate the inputs on the selction screen
    -->  p1        text
    <--  p2        text
    form zf_validate_sel_screen .
      if not p_var is initial.
        wa_variant1-report = sy-repid.
        wa_variant1-variant = p_var.
        call function 'REUSE_ALV_VARIANT_EXISTENCE'
          exporting
            i_save        = 'A'
          changing
            cs_variant    = wa_variant1
          exceptions
            wrong_input   = 1
            not_found     = 2
            program_error = 3
            others        = 4.
        if sy-subrc = 0.
          clear wa_variant2.
          move p_var to wa_variant2-variant.
          move sy-repid to wa_variant2-report.
        else.
          message e006. "No such variant exists
        endif.
      else.
        clear wa_variant1.
      endif.
      select werks from marc into wa_mat-werks where werks in s_plant.
        exit.
      endselect.
      if sy-subrc <> 0.
        message e002.
        clear wa_mat.
      endif.
      select lgort from mard into wa_mat-lgort where lgort in s_stor.
        exit.
      endselect.
      if sy-subrc <> 0.
        message e003.
        clear wa_mat.
      endif.
    endform.                    " zf_validate_sel_screen
    *&      Form  zf_get_data
      This will fetch data from the database tables & finally merge them
         into a single internal table, to pass it to alv
    -->  p1        text
    <--  p2        text
    form zf_get_data .
      select matnr werks into table it_marc from marc where werks in s_plant
      if sy-subrc = 0.
        sort it_marc by matnr werks.
      endif.
      if it_marc[] is not initial.
        select matnr maktx into table it_makt from makt
                          for all entries in it_marc
                          where matnr = it_marc-matnr
                            and spras = sy-langu.
        if sy-subrc = 0.
          sort it_makt by matnr.
        endif.
        select matnr werks lgort labst into table it_mard from mard
                                       for all entries in it_marc
                                       where matnr = it_marc-matnr
                                             and werks = it_marc-werks
                                             and lgort in s_stor.
        if sy-subrc = 0.
          sort it_mard by matnr werks lgort.
        endif.
        select werks name1 into table it_t001w from t001w
                           for all entries in it_marc
                           where werks = it_marc-werks.
        if sy-subrc = 0.
          sort it_t001w by werks.
        endif.
      endif.
      if it_mard[] is not initial.
        select werks lgort lgobe into table it_t001l from t001l
                                 for all entries in it_mard
                                 where werks = it_mard-werks
                                   and lgort = it_mard-lgort.
        if sy-subrc = 0.
          sort it_t001l by werks lgort.
        endif.
      endif.
      clear : wa_mat,
              wa_mard,
              wa_t001l,
              wa_t001w,
              wa_makt.
      loop at it_mard into wa_mard.
        wa_mat-matnr = wa_mard-matnr.
        wa_mat-werks = wa_mard-werks.
        wa_mat-lgort = wa_mard-lgort.
        wa_mat-labst = wa_mard-labst.
        read table it_makt into wa_makt with key matnr = wa_mard-matnr
    binary search.
        if sy-subrc = 0.
          wa_mat-maktx = wa_makt-maktx.
        endif.
        read table it_t001l into wa_t001l with key werks = wa_mard-werks
    lgort = wa_mard-lgort binary search.
        if sy-subrc = 0.
          wa_mat-lgobe = wa_t001l-lgobe.
        endif.
        read table it_t001w into wa_t001w with key werks = wa_mard-werks
    binary search.
        if sy-subrc = 0.
          wa_mat-name1 = wa_t001w-name1.
        endif.
        append wa_mat to it_mat.
      endloop.
      sort it_mat by matnr werks lgort.
      loop at it_mat into wa_mat.
        clear t_color.
        if wa_mat-labst < 100.
          wa_mat-v_lights = '1'.
          t_color-fieldname = 'LABST'.
          t_color-color-col = 6.
          append t_color to wa_mat-v_col.
          wa_mat-v_row = 'C610'.
          modify it_mat from wa_mat.
        elseif wa_mat-labst < 1000.
          wa_mat-v_lights = '2'.
          t_color-fieldname = 'LABST'.
          t_color-color-col = 3.
          append t_color to wa_mat-v_col.
          wa_mat-v_row = 'C510'.
          modify it_mat from wa_mat.
        else.
          wa_mat-v_lights = '3'.
          t_color-fieldname = 'LABST'.
          t_color-color-col = 5.
          append t_color to wa_mat-v_col.
          wa_mat-v_row = 'C210'.
          modify it_mat from wa_mat.
        endif.
        clear wa_mat.
      endloop.
    endform.                    " zf_get_data
    *&      Form  zf_display_data
    -->  p1        text
    <--  p2        text
    form zf_display_data .
    *If Internal Table Is Populated Then Only Display Alv Report.
      if not it_mat[] is initial.
    &---Prepare fieldcatalog .
        perform zf_build_fieldcat using it_fieldcat.
    &---Build event catalog.
        perform zf_eventcat using it_eventcat.
    &---Build Listheader for TOP OF PAGE EVENT.
        perform zf_build_listheader using it_listheader.
    &---Build layout.
        perform zf_layout.
    &---Build sorting.
        perform zf_sorting using it_sortinfo.
    &---Initializating Grid Title
        perform zf_build_grid_title.
    IF GRID RADIO button (ALV GRID) IS selected .
        if p_rb_02 is not initial.
    DISPLAY ALV GRID.
          perform zf_display_alv_grid.
        else.
    DISPLAY ALV LIST.
          perform zf_display_alv_list.
        endif.
      else.
    *&---If Table is not Populated ie Records Does not exist
        message s001.
      endif.
    endform.                    " zf_display_data
    *&      Form  ZF_BUILD_FIELDCAT
          text
         -->P_IT_FIELDCAT  text
    form zf_build_fieldcat  using    p_it_fieldcat type slis_t_fieldcat_alv.
    *Declaring Local Variable
      data: l_fieldcat type slis_fieldcat_alv.
      clear l_fieldcat.
    for First field
      l_fieldcat-col_pos     = '1'.          "POSITION OF THE COLUMN.
      l_fieldcat-fieldname   = 'WERKS'.      "FIELD FOR WHICH CATALOG
      l_fieldcat-tabname     = 'IT_MAT'.     "NAME OF INTERNAL TABLE
      l_fieldcat-ref_tabname = 'MARC'.       "FOR F1 & F4 HELP AS REFERNCED
      l_fieldcat-key         = 'X'.          "MAKING FIELD AS KEY FIELD
      l_fieldcat-outputlen   =  4.           "SET THE OUTPUT LENGTH.
      l_fieldcat-seltext_l   = text-003.  "Long text for header.
      l_fieldcat-seltext_m   = text-003.    "Medium text for header.
      l_fieldcat-seltext_s   = text-003.           "Short text for header.
      append l_fieldcat to p_it_fieldcat.
      clear l_fieldcat.
    for Second field
      l_fieldcat-col_pos     = '2'.          "POSITION OF THE COLUMN.
      l_fieldcat-fieldname   = 'LGORT'.      "FIELD FOR WHICH CATALOG
      l_fieldcat-tabname     = 'IT_MAT'.     "NAME OF INTERNAL TABLE
      l_fieldcat-ref_tabname = 'MARD'.       "FOR F1 & F4 HELP AS REFERNCED
      l_fieldcat-key         = 'X'.          "MAKING FIELD AS KEY FIELD
      l_fieldcat-outputlen   =  4.           "SET THE OUTPUT LENGTH.
      l_fieldcat-seltext_l   = text-004.  "Long text for header.
      l_fieldcat-seltext_m   = text-005.    "Medium text for header.
      l_fieldcat-seltext_s   = text-006.           "Short text for header.
      append l_fieldcat to p_it_fieldcat.
      clear l_fieldcat.
    for third field
      l_fieldcat-col_pos     = '3'.          "POSITION OF THE COLUMN.
      l_fieldcat-fieldname   = 'MATNR'.      "FIELD FOR WHICH CATALOG
      l_fieldcat-tabname     = 'IT_MAT'.     "NAME OF INTERNAL TABLE
      l_fieldcat-ref_tabname = 'MARA'.       "FOR F1 & F4 HELP AS REFERNCED
    l_fieldcat-key         = 'X'.          "MAKING FIELD AS KEY FIELD
      l_fieldcat-outputlen   =  18.           "SET THE OUTPUT LENGTH.
      l_fieldcat-seltext_l   = text-007.  "Long text for header.
      l_fieldcat-seltext_m   = text-008.    "Medium text for header.
      l_fieldcat-seltext_s   = text-009.           "Short text for header.
      append l_fieldcat to p_it_fieldcat.
      clear l_fieldcat.
    for fourth field
      l_fieldcat-col_pos     = '4'.          "POSITION OF THE COLUMN.
      l_fieldcat-fieldname   = 'LABST'.      "FIELD FOR WHICH CATALOG
      l_fieldcat-tabname     = 'IT_MAT'.     "NAME OF INTERNAL TABLE
      l_fieldcat-ref_tabname = 'MARD'.       "FOR F1 & F4 HELP AS REFERNCED
      l_fieldcat-outputlen   =  16.           "SET THE OUTPUT LENGTH.
      l_fieldcat-seltext_l   = text-010.  "Long text for header.
      l_fieldcat-seltext_m   = text-011.    "Medium text for header.
      l_fieldcat-seltext_s   = text-012.           "Short text for header.
      l_fieldcat-do_sum = 'X'.
      l_fieldcat-input       = 'X'.          "Making the field editable
      l_fieldcat-edit        = 'X'.
      append l_fieldcat to p_it_fieldcat.
      clear l_fieldcat.
    endform.                    " ZF_BUILD_FIELDCAT
    *&      Form  zf_eventcat
          text
         -->P_IT_EVENTCAT  text
    form zf_eventcat  using    p_it_eventcat type slis_t_event.
      data l_eventcat type slis_alv_event.
      clear l_eventcat.
    *Get all the events.
      call function 'REUSE_ALV_EVENTS_GET'
        exporting
          i_list_type     = 0
        importing
          et_events       = p_it_eventcat
        exceptions
          list_type_wrong = 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.
    TOP-OF-PAGE FORM
      clear l_eventcat.
      read table p_it_eventcat into l_eventcat with key
                              name = slis_ev_top_of_page.
      if sy-subrc = 0.
        move 'ZF_TOP_OF_PAGE' to l_eventcat-form.
        modify p_it_eventcat from l_eventcat index sy-tabix
                                             transporting form.
      endif.
    PF_STATUS_SET FORM
      clear l_eventcat.
      read table p_it_eventcat into l_eventcat with key
                              name = slis_ev_pf_status_set.
      if sy-subrc = 0.
        move 'ZF_PF_STATUS_SET' to l_eventcat-form.
        modify p_it_eventcat from l_eventcat index sy-tabix
                                          transporting form.
      endif.
    USER_COMMAND FORM
      clear l_eventcat.
      read table p_it_eventcat into  l_eventcat with key
                               name = slis_ev_user_command.
      if sy-subrc = 0.
        move 'ZF_USER_COMMAND' to  l_eventcat-form.
        modify p_it_eventcat from l_eventcat index sy-tabix
                                          transporting form.
      endif.
    endform.                    " zf_eventcat
    *&      Form  ZF_BUILD_LISTHEADER
          text
         -->P_IT_LISTHEADER  text
    form zf_build_listheader  using  p_it_listheader type slis_t_listheader.
      data: l_listheader type slis_listheader.
      refresh p_it_listheader.
      clear l_listheader.
      l_listheader-typ = 'H'.   "Header
    l_listheader-key = 'FCIL,INDIA'. "Ignored for "Header" Type
      l_listheader-info = text-013.
      append l_listheader to p_it_listheader.
      clear l_listheader.
      data : lv_date(10) type c .
      write sy-datum to lv_date .
      l_listheader-typ = 'S'.
      l_listheader-key = 'DATE'.
      l_listheader-info = lv_date.
      append l_listheader to p_it_listheader.
      clear l_listheader.
      l_listheader-typ = 'A'.
    l_listheader-key = 'COMMENT'.    " key is ignored
      l_listheader-info = text-014.
      append l_listheader to p_it_listheader.
      clear l_listheader.
      l_listheader-typ = 'S'.
      l_listheader-key = text-016.
    l_listheader-info = 'Input Plant'.
      append l_listheader to p_it_listheader.
      clear l_listheader.
      l_listheader-typ = 'S'.
      l_listheader-key = text-017.
    l_listheader-info = 'Plant'.
      append l_listheader to p_it_listheader.
      select werks from marc into  table it_werks where werks in s_plant.
      sort it_werks by werks.
      delete adjacent duplicates from it_werks comparing werks.
      loop at it_werks into wa_werks.
        clear l_listheader.
        l_listheader-typ = 'S'.
       l_listheader-key = 'X'.
        l_listheader-info = wa_werks-werks.
        append l_listheader to p_it_listheader.
      endloop.
    endform.                    " ZF_BUILD_LISTHEADER
    *&      Form  ZF_LAYOUT
          text
    -->  p1        text
    <--  p2        text
    form zf_layout .
      clear wa_layout.
      wa_layout-zebra = 'X'.
      wa_layout-lights_fieldname = 'V_LIGHTS'.
      wa_layout-lights_tabname   = 'IT_MAT'.
      wa_layout-info_fieldname = 'V_ROW'. " infofield for listoutput
      wa_layout-coltab_fieldname = 'V_COL'. " colors
    endform.                    " ZF_LAYOUT
    *&      Form  ZF_SORTING
          text
         -->P_IT_SORTINFO  text
    form zf_sorting  using    p_it_sortinfo type slis_t_sortinfo_alv.
      data l_sortinfo type slis_sortinfo_alv.
      clear l_sortinfo.
      l_sortinfo-spos = '1'.
      l_sortinfo-fieldname = 'WERKS'.
      l_sortinfo-tabname = 'IT_MAT'.
      l_sortinfo-up = 'X'.
      l_sortinfo-group = 'UL'.              "UNDERLINE AFTER EVERY GROUP
      l_sortinfo-subtot = 'X'.
      append l_sortinfo to p_it_sortinfo.
    endform.                    " ZF_SORTING
    *&      Form  ZF_BUILD_GRID_TITLE
          text
    -->  p1        text
    <--  p2        text
    form zf_build_grid_title .
      v_grid_title = text-015.
    endform.                    " ZF_BUILD_GRID_TITLE
    *&      Form  ZF_DISPLAY_ALV_GRID
          text
    -->  p1        text
    <--  p2        text
    form zf_display_alv_grid .
      call function 'REUSE_ALV_GRID_DISPLAY'
       exporting
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
         i_callback_program                = v_prog_name
       i_callback_pf_status_set          = 'ZF_PF_STATUS_SET'
       i_callback_user_command           = 'ZF_USER_COMMAND'
       i_callback_top_of_page            = 'ZF_TOP_OF_PAGE'
      I_CALLBACK_HTML_TOP_OF_PAGE       = ' '
      I_CALLBACK_HTML_END_OF_LIST       = ' '
      I_STRUCTURE_NAME                  =
      I_BACKGROUND_ID                   = ' '
         i_grid_title                      = v_grid_title
      I_GRID_SETTINGS                   =
         is_layout                         = wa_layout
         it_fieldcat                       = it_fieldcat
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
       it_sort                           = it_sortinfo
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
       i_save                            = 'A'
       is_variant                        = wa_variant2
       it_events                         = it_eventcat
      IT_EVENT_EXIT                     =
      IS_PRINT                          =
      IS_REPREP_ID                      =
      I_SCREEN_START_COLUMN             = 0
      I_SCREEN_START_LINE               = 0
      I_SCREEN_END_COLUMN               = 0
      I_SCREEN_END_LINE                 = 0
      IT_ALV_GRAPHICS                   =
      IT_HYPERLINK                      =
      IT_ADD_FIELDCAT                   =
      IT_EXCEPT_QINFO                   =
      I_HTML_HEIGHT_TOP                 =
      I_HTML_HEIGHT_END                 =
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
        tables
          t_outtab                          = it_mat
    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.                    " ZF_DISPLAY_ALV_GRID
    *&      Form  zf_display_alv_list
          text
    -->  p1        text
    <--  p2        text
    form zf_display_alv_list .
      call function 'REUSE_ALV_LIST_DISPLAY'
       exporting
      I_INTERFACE_CHECK              = ' '
      I_BYPASSING_BUFFER             =
      I_BUFFER_ACTIVE                = ' '
         i_callback_program             = v_prog_name
       i_callback_pf_status_set       = 'ZF_PF_STATUS_SET'
       i_callback_user_command        = 'ZF_USER_COMMAND'
      I_STRUCTURE_NAME               =
         is_layout                      = wa_layout
         it_fieldcat                    = it_fieldcat
      IT_EXCLUDING                   =
      IT_SPECIAL_GROUPS              =
       it_sort                        = it_sortinfo
      IT_FILTER                      =
      IS_SEL_HIDE                    =
      I_DEFAULT                      = 'X'
      I_SAVE                         = 'A'
      IS_VARIANT                     = WA_VARIANT2
       it_events                      = it_eventcat
      IT_EVENT_EXIT                  =
      IS_PRINT                       =
      IS_REPREP_ID                   =
      I_SCREEN_START_COLUMN          = 0
      I_SCREEN_START_LINE            = 0
      I_SCREEN_END_COLUMN            = 0
      I_SCREEN_END_LINE              = 0
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER        =
      ES_EXIT_CAUSED_BY_USER         =
        tables
          t_outtab                       = it_mat
       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.                    " zf_display_alv_list
    *&      Form  zf_top_of_page
          text
    -->  p1        text
    <--  p2        text
    form zf_top_of_page .
      call function 'REUSE_ALV_COMMENTARY_WRITE'
        exporting
          it_list_commentary       = it_listheader
         i_logo                   = 'ENJOYSAP_LOGO'
      I_END_OF_LIST_GRID       =
    endform.                    " zf_top_of_page
    *&      Form  zf_pf_status_set
          text
    -->  p1        text
    <--  p2        text
    form zf_pf_status_set using rt_extab type slis_t_extab.
      set pf-status  'ALV_MENU_MAT' excluding  'BACK'.
      case sy-ucomm.
        when 'SAVE'.
    IF flag <> 0.
          set pf-status  'ALV_MENU_MAT' .
    ENDIF.
      endcase.
    endform.                    " zf_pf_status_set
    *&      Form  zf_user_command
          text
    -->  p1        text
    <--  p2        text
    form zf_user_command using r_ucomm like sy-ucomm
                            rs_selfield type slis_selfield.
    sy-ucomm = r_ucomm.
      case r_ucomm.
        when 'SAVE'.
          flag = flag + 1.
          read table it_mat index rs_selfield-tabindex into wa_mat.
          wa_mat-labst = rs_selfield-value.
          if rs_selfield-value < 100.
            wa_mat-v_lights = '1'.
            t_color-fieldname = 'LABST'.
            t_color-color-col = 6.
            wa_mat-v_row = 'C610'.
            clear wa_mat-v_col.
            append t_color to wa_mat-v_col.
          elseif rs_selfield-value < 1000.
            wa_mat-v_lights = '2'.
            t_color-fieldname = 'LABST'.
            t_color-color-col = 3.
            wa_mat-v_row = 'C510'.
            clear wa_mat-v_col.
            append t_color to wa_mat-v_col.
          else.
            wa_mat-v_lights = '3'.
            t_color-fieldname = 'LABST'.
            t_color-color-col = 5.
            wa_mat-v_row = 'C210'.
            clear wa_mat-v_col.
            append t_color to wa_mat-v_col.
          endif.
          modify it_mat from wa_mat index rs_selfield-tabindex.
    IF GRID RADIO button (ALV GRID) IS selected .
          if p_rb_02 is not initial.
           SET PF-STATUS  'ALV_MENU_MAT'.
    DISPLAY ALV GRID.
            perform zf_display_alv_grid.
          else.
           SET PF-STATUS  'ALV_MENU_MAT'.
    DISPLAY ALV LIST.
            perform zf_display_alv_list.
          endif.
          set screen 0.
        when 'BACK'.
          leave screen.
        when others.
          message i004.
      endcase.
       WHEN 'BACK'.
    CASE sy-ucomm.
       WHEN 'BACK'.
         LEAVE SCREEN.
    ENDCASE.
    endform.                    " zf_user_command
    reward points if helpful

  • Checkbox cant be updated in ALV Grid

    Hi in my requirement, ALV Grid contains checkbox, when I check that, the internal table for checkbox is not updated.
    In code I am writting:
    Final Internal Tbale:
    Data:   BEGIN OF T_FINAL occurs 0,
            CHK_BOX,
            END OF T_FINAL.
      LS_FIELDCAT-TABNAME = t_final.
      LS_FIELDCAT-COL_POS = 1.
      LS_FIELDCAT-FIELDNAME = 'CHK_BOX'.
      LS_FIELDCAT-SELTEXT_S = ‘check box’.
      LS_FIELDCAT-INPUT = 'X'.
      LS_FIELDCAT-OUTPUTLEN = 1.
      LS_FIELDCAT-CHECKBOX = 'X'.
      LS_FIELDCAT-EDIT = 'X'.
      APPEND LS_FIELDCAT TO LT_FIELDCAT.
      CLEAR LS_FIELDCAT.
    DATA: I_CHECK TYPE TABLE OF T_FINAL,
             WA_CHECK TYPE T_FINAL.
      LOOP AT I_FINAL INTO WA_FINAL.
        IF WA_FINAL-CHK_BOX = 'X'.
          APPEND WA_FINAL TO I_CHECK.
    { APPEND WA_FINAL TO I_CHECK[]      also I try}
        ENDIF.
      ENDLOOP.
    In layout:
    LS_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
    LS_LAYOUT-BOX_FIELDNAME = 'CHK_BOX'.

    try this its working for me......
    *& Report  ZHR_REPT_EMP_NOT_PBOOKED
    *& Program title:    List of employees who have not done Pre-Booking and
                        Provision to send E mail to such employees
    *& Description:      To display a list of emloyees in report and then sending mails to them
    *& Business analyst: Vinay Kale/Abhijeet More
    *& Developed by:     Vivek Jain
    REPORT  ZHR_REPT_EMP_NOT_PBOOKED.
    TYPE-POOLS slis.
    tables
    TABLES: pernr,
            pa0001,
            hrp1001,
            hrp1000,
            zodtab,
            zcstab,
            zsbutab.
    Infotypes
    INFOTYPES :0001,  "org assignment,
               1001,
               1000,
               0105.
    TYPES : BEGIN OF i_conf,
              checkbox ,
              pernr TYPE pa0001-pernr,                  "personnel Number.
              ename TYPE pa0001-ename,                  "Name of Employee.
              zzbtc TYPE pa0001-zzbtc,                  "Band.
              btrtl  TYPE pa0001-btrtl,                 "Grade
              Location type string,
              persk type string,
              ptext type string,
              werks TYPE p0001-werks,
              zzod_txt type string,                         "OD name
              zzod type pa0001-zzod,
              zzcs type string,                         "cluster/sector
              vertical type string,
              sbu LIKE pa0001-zzsbu,                    "SBU
              sbutxt LIKE zsbutab-zsbutxt,              "SBUTXT
              orgeh LIKE pa0001-orgeh,                  "Vertical
              org_text type string,
              zzbloc LIKE pa0001-zzbloc,                "base location
              dept_loc type string,                     "dept loc
              ename_s LIKE pa0001-ename,                "Department
              zztc LIKE pa0001-zztc,
              endda type p0001-endda,
             celltab type lvc_t_styl,
            tc_name type string,
           tc_num type string,
            END OF i_conf.
    DATA : it_conf TYPE STANDARD TABLE OF i_conf WITH HEADER LINE,
           wa_conf TYPE i_conf.
    *data: begin of gs_outtab.
    *data: checkbox type c.                "field for checkbox
    §B1.Extend your output table by a field to dis- or enable
        cells for input.
    *data: celltab type lvc_t_styl.        "field to switch editability
           include structure i_conf.
    *data: end of gs_outtab.
    *data: gt_outtab type gs_outtab occurs 0 with header line.
    *& DATA DECLARATION FOR EMAIL
    DATA: docdata    TYPE sodocchgi1,
          objpack    TYPE STANDARD TABLE OF sopcklsti1 WITH HEADER LINE,
          objhead    TYPE STANDARD TABLE OF solisti1   WITH HEADER LINE,
          objtxt     TYPE STANDARD TABLE OF solisti1   WITH HEADER LINE,
          objbin     TYPE STANDARD TABLE OF solisti1   WITH HEADER LINE,
          reclist    TYPE STANDARD TABLE OF somlreci1  WITH HEADER LINE.
    DATA: tab_lines  TYPE sy-tabix.
    DATA : p_1001 TYPE TABLE OF p1001 WITH HEADER LINE.
    DATA : p_0001 TYPE TABLE OF p0001 WITH HEADER LINE.
    DATA : p_0105 TYPE TABLE OF p0105 WITH HEADER LINE.
    DATA : od TYPE p0001-zzod.
    DATA : new_pernr type p0001-pernr.
    DATA : pernr_s type p0001-pernr.
    DATA : email_s type p0105-USRID_LONG.
    DATA : email type p0105-USRID_LONG.
    DATA : tc_name type string.
    DATA : tc_num type string.
    DATA : emails type string.
    DATA : sel_all type string.
    DATA: REF_GRID TYPE REF TO CL_GUI_ALV_GRID.
    DATA : flag type i.
    DATA : title TYPE string.
    DATA : pernr_temp tYPE p0001-pernr.
    DATA : rel type string.
    DATA : stat type string.
    DATA : count type i.
    DATA :   v_dynnr type sy-dynnr.
    DATA : g_grid  type ref to cl_gui_alv_grid.
    DATA : g_custom_container type ref to cl_gui_custom_container,
          g_container type scrfname value 'CC'.
    ************field cat*******************************
    DATA:  fieldcat TYPE  lvc_t_fcat,
           wa_fieldcat LIKE LINE OF fieldcat.
    DATA:  gd_layout TYPE lvc_s_layo,
          gd_repid TYPE sy-repid.
    DATA:gt_events TYPE slis_t_event,
          gt_list_top_of_page TYPE slis_t_listheader.
    DATA rec_fetched TYPE sy-tabix.
    CONSTANTS g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
    SELECTION-SCREEN BEGIN OF  BLOCK b1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:   s_zzod    FOR   zsbutab-zod       NO INTERVALS ,
                      s_btrtl  FOR   pa0001-btrtl     NO INTERVALS.
    SELECTION-SCREEN END OF BLOCK b1.
    start-of-selection.
      if pn-begda is initial.
        pn-begda = '18000101'.
      endif.
      if pn-endda is initial.
        pn-begda = '99991230'.
      endif.
      clear : it_conf,it_conf[].
    get pernr.
      clear new_pernr.
      move pernr-pernr to new_pernr.
    *************checking whether employee has booked or prebooked for any event***************
      clear: p_1001,p_1001[].
      perform read_info tables p_1001 using  new_pernr '1' 'B027' .
      IF SY-SUBRC <> 0.
        clear: p_1001,p_1001[].
        perform read_info tables p_1001 using  new_pernr '1' 'B023' .
        IF SY-SUBRC <> 0.
          clear: p_1001,p_1001[].
          perform read_info tables p_1001 using  new_pernr '2' 'B027' .
          IF SY-SUBRC <> 0.
            clear: p_1001,p_1001[].
            perform read_info tables p_1001 using  new_pernr '2' 'B023' .
            IF SY-SUBRC <> 0.
              clear : p_0001,p_0001[].
              CALL FUNCTION 'HR_READ_INFOTYPE'
                EXPORTING
                  pernr           = new_pernr
                  infty           = '0001'
                  BEGDA           = pn-begda
                  ENDDA           = pn-endda
                TABLES
                  infty_tab       = p_0001
                EXCEPTIONS
                  infty_not_found = 1
                  OTHERS          = 2.
              sort p_0001 descending by begda.
              read table p_0001 index 1.
              move p_0001-pernr to wa_conf-pernr.
              move p_0001-ename to wa_conf-ename.
              move p_0001-zzbtc to wa_conf-zzbtc.
              move p_0001-btrtl to wa_conf-btrtl.
              move p_0001-werks to wa_conf-werks.
              move p_0001-zzsbu to wa_conf-sbu.
              move p_0001-orgeh to wa_conf-orgeh.
              move p_0001-zzbloc to wa_conf-zzbloc.
              move p_0001-zztc to wa_conf-zztc.
              move p_0001-zzod to wa_conf-zzod.
              move p_0001-endda to wa_conf-endda.
              move p_0001-btrtl to wa_conf-btrtl.
    ***************************sending mail to employee and his/her superior***********************************
             select single  sachn  telnr  into (wa_conf-tc_name , wa_conf-tc_num) from t526
            where SACHX = it_conf-zztc
            and werks = it_conf-werks .
    **************clustor txt*********************
              select single zcstxt into wa_conf-zzcs from zcstab
                                                    where  zcs = p_0001-zzcs
                                                    and zod = p_0001-zzod.
    **********operating division******************************
              select single ZODLTXT into  wa_conf-zzod_txt from zodtab
                                                 where zod = wa_conf-zzod.
    **********sbu txt**************************************************************
              select single zsbutxt into wa_conf-sbutxt from zsbutab
                                            where zsbu = wa_conf-sbu.
    **********location*************************************
              select single btext into wa_conf-location from t001p
                                                 where  btrtl = wa_conf-btrtl
                                                 and werks = wa_conf-werks.
    **********Dept********************************************
              select single orgtx into wa_conf-org_text from t527x
                                                  where sprsl = 'EN'
                                                  and orgeh = wa_conf-orgeh
                                                  and  begda <= p_0001-begda
                                                  and endda >= p_0001-begda.
    **************grade*****************************************
              SELECT SINGLE ptext FROM t503t INTO  wa_conf-persk
                                              WHERE sprsl = 'EN'
                                              AND persk = p_0001-persk .
    *******************vertical****************************
    select single zverttxt into wa_conf-vertical from zvtab
                                 where zvert = p_0001-zzvert.
    *******deputation location*****************
      if p_0001-ZZDEPFLG = 'X'.
         select single zdltxt into wa_conf-dept_loc from zdltab where zdl = p_0001-zzdploc.
    endif.
    ***get imm superior
              CALL FUNCTION 'ZHR_GET_IMMMED_SUPERIOR'
               EXPORTING
                 pernr     =  new_pernr
             begda     = '18000101'
             endda     = '99991231'
               IMPORTING
                 v_pernr   = pernr_s
               EXCEPTIONS
                 not_found = 1
                 OTHERS    = 2.
              if sy-subrc = 0.
    find the email of the immed. superiors personal number..
                clear : p_0001,p_0001[].
                CALL FUNCTION 'HR_READ_INFOTYPE'
                  EXPORTING
                    pernr           = pernr_s
                    infty           = '0001'
                    BEGDA           = pn-begda
                    ENDDA           = pn-endda
                  TABLES
                    infty_tab       = p_0001
                  EXCEPTIONS
                    infty_not_found = 1
                    OTHERS          = 2.
                read table p_0001 index 1.
                move p_0001-ename to wa_conf-ename_s.
              endif.
              if wa_conf-btrtl in s_btrtl and wa_conf-zzod in s_zzod .
                append wa_conf to it_conf.
              endif.
            endif.
          endif.
        endif.
      endif.
      clear wa_conf.
    end-of-selection.
       if it_conf[] is initial.
          MESSAGE i501(zmod).
          exit.
          endif.
      CALL SCREEN 100.
    *&      Module  STATUS_0100  OUTPUT
          text
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'USER'.
    SET TITLEBAR 'xxx'.
      if g_custom_container is  initial.
        data: lt_exclude type ui_functions.
        create object g_custom_container
          EXPORTING
            container_name = g_container.
        create object g_grid
          EXPORTING
            i_parent = g_custom_container.
        perform fieldcat_build .
    Exclude all edit functions in this example since we do not need them:
        perform exclude_tb_functions changing lt_exclude.
    perform build_data.
    *§ B3.Use the layout structure to aquaint additional field to ALV.
        gd_layout-stylefname = 'CELLTAB'.
        PERFORM build_layout.
        if it_conf[] is initial.
         MESSAGE i501(zmod).                    "No data exists
        else.
          call method g_grid->set_table_for_first_display
            EXPORTING
              is_layout            = gd_layout
              it_toolbar_excluding = lt_exclude
            CHANGING
              it_fieldcatalog      = fieldcat
              it_outtab            = it_conf[].
    create object g_event_receiver.
    set handler g_event_receiver->catch_doubleclick for g_grid.
    Set editable cells to ready for input initially
          call method g_grid->set_ready_for_input
            EXPORTING
              i_ready_for_input = 1.
        endif.
      endif.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *call screen 100.
    *&      Form  build_layout
    FORM build_layout.
      CLEAR gd_layout.
      v_dynnr = 100.
      gd_layout-cwidth_opt = 'X'.
    gd_layout-zebra      = 'X'.
    gd_layout-grid_title = text-002.
    ENDFORM.                    "build_layout
    *&      Form  exclude_tb_functions
          text
         -->PT_EXCLUDE text
    form exclude_tb_functions changing pt_exclude type ui_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  field_cat
          text
    FORM fieldcat_build .
      wa_fieldcat-fieldname  = 'CHECKBOX'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      wa_fieldcat-checkbox   = 'X'.
      wa_fieldcat-edit   = 'X'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'PERNR'.
      wa_fieldcat-coltext = 'P.S. No'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'ENAME'.
      wa_fieldcat-coltext = 'Employee Name'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'ZZBTC'.
      wa_fieldcat-coltext = 'Band'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'PERSK'.
      wa_fieldcat-coltext = 'Grade'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'ZZOD_TXT'.
      wa_fieldcat-coltext = 'OD Name'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'ZZCS'.
      wa_fieldcat-coltext = 'Cluster / Sector '.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
       wa_fieldcat-fieldname  = 'VERTICAL'.
      wa_fieldcat-coltext = 'Vertical'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'SBUTXT'.
      wa_fieldcat-coltext = 'SBU'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'ORG_TEXT'.
      wa_fieldcat-coltext = 'Dept.'.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'LOCATION'.
      wa_fieldcat-coltext = 'Empl. Base Location '.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
       wa_fieldcat-fieldname  = 'DEPT_LOC'.
      wa_fieldcat-coltext = 'Empl. Deputation Location '.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
      wa_fieldcat-fieldname  = 'ENAME_S'.
      wa_fieldcat-coltext = 'IS Name '.
      wa_fieldcat-tabname   = 'IT_CONF'.
      APPEND wa_fieldcat TO fieldcat.
      clear wa_fieldcat.
    endform.                    "field_cat
    *&      Form  check_lock
          text
         -->PS_OUTTAB  text
         -->P_LOCKED   text
    form check_lock using    ps_outtab type i_conf
                    changing p_locked.
      data ls_celltab type lvc_s_styl.
      loop at ps_outtab-celltab into ls_celltab.
        if ls_celltab-fieldname = 'CHECKBOX'.
          if ls_celltab-style eq cl_gui_alv_grid=>mc_style_disabled.
            p_locked = 'X'.
          else.
            p_locked = space.
          endif.
        endif.
      endloop.
    endform.                    "check_lock
    *&      Module  USER_COMMAND_0100  INPUT
          text
    MODULE USER_COMMAND_0100 INPUT.
      IF sy-ucomm = 'EMAIL'.
        clear it_conf.
       CALL METHOD g_grid->refresh_table_display.
        data: ls_outtab type i_conf.
        data: l_valid type c,
              l_locked type c.
    *§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
          you must check the input cells.
    If all entries are ok, ALV transferes new values to the output
    table which you then can modify.
        call method g_grid->check_changed_data
          IMPORTING
            e_valid = l_valid.
        if l_valid eq 'X'.
          loop at it_conf  into ls_outtab.
            if     not ls_outtab-checkbox is initial
               and not ls_outtab-checkbox eq '-'.
    ***************************sending mail to employee and his/her superior***********************************
              select single  sachn  telnr  into (tc_name , tc_num) from t526
             where SACHX = ls_outtab-zztc
             and werks = ls_outtab-werks .
      ******find the emil of employee.
              clear : p_0105,p_0105[].
              CALL FUNCTION 'HR_READ_INFOTYPE'
                EXPORTING
                  pernr           = ls_outtab-pernr
                  infty           = '0105'
                  BEGDA           = pn-begda
                  ENDDA           = pn-endda
                TABLES
                  infty_tab       = p_0105
                EXCEPTIONS
                  infty_not_found = 1
                  OTHERS          = 2.
              if sy-subrc = 0.
                read table p_0105 with key subty = '0010'.
                move p_0105-USRID_LONG to email.
              endif.
    find immediate superior by Z FM.
              clear pernr_s.
              CALL FUNCTION 'ZHR_GET_IMMMED_SUPERIOR'
                EXPORTING
                  pernr     = ls_outtab-pernr
                IMPORTING
                  v_pernr   = pernr_s
                EXCEPTIONS
                  not_found = 1
                  OTHERS    = 2.
              if sy-subrc = 0.
    find the email of the immed. superiors personal number..
                clear : p_0105,p_0105[].
                CALL FUNCTION 'HR_READ_INFOTYPE'
                  EXPORTING
                    pernr           = pernr_s
                    infty           = '0105'
                    BEGDA           = pn-begda
                    ENDDA           = pn-endda
                  TABLES
                    infty_tab       = p_0105
                  EXCEPTIONS
                    infty_not_found = 1
                    OTHERS          = 2.
                read table p_0105 with key subty = '0010'.
                move p_0105-USRID_LONG to email_s.
              endif.
              if email <> ' '.
                count = 1.
                perform send_mail using ls_outtab-ename email email_s tc_name tc_num count .
              endif.
              if email_s <> ' '.
                count = 2.
                perform send_mail using ls_outtab-ename email email_s tc_name tc_num count.
              endif.
              call method g_grid->refresh_table_display.
              modify it_conf  from ls_outtab.
            endif.
          endloop.
          call method g_grid->refresh_table_display.
        endif.
        set screen 100.
      endif.
    **************************end of sending mail****************************************************
      IF sy-ucomm = 'SELECT'.
    CALL METHOD g_grid->refresh_table_display.
    *§A4ad. Before you (a)set, reset or (d)evaluate checkboxes,
          you must check the input cells.
    If all entries are ok, ALV transferes new values to the output
    table which you then can modify.
        call method g_grid->check_changed_data
          IMPORTING
            e_valid = l_valid.
        if l_valid eq 'X'.
          loop at it_conf into ls_outtab.
            perform check_lock using    ls_outtab
                               changing l_locked.
            if l_locked is initial
               and not ls_outtab-checkbox eq '-'.
              ls_outtab-checkbox = 'X'.
            endif.
            modify it_conf from ls_outtab.
          endloop.
          call method g_grid->refresh_table_display.
        endif.
        set screen 100.
      endif.
      IF sy-ucomm = 'BCK'  and v_dynnr = 100.
        clear v_dynnr.
        set screen 1000.
        leave screen.                                           " 0."1000.
    **call selection-screen 1000.
    *call screen 1000.
      endif.
      IF sy-ucomm = 'EXIT'  and v_dynnr = 100.
        clear v_dynnr.
        leave program.
      endif.
      IF sy-ucomm = 'CANC'  and v_dynnr = 100.
        clear v_dynnr.
        leave program.
      endif.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  send_mail
          text
         -->EMAIL_S    text
         -->EMAIL      text
         -->TC_NAME    text
         -->TC_NUM     text
    form send_mail using  ename email email_s tc_name tc_num count.
    *Body of mail
      CLEAR objtxt.
      CLEAR objtxt[].
      objtxt = text-005.
      concatenate objtxt ename into objtxt separated by space.
      append objtxt.
      clear objtxt.
      objtxt = text-006.
      concatenate objtxt email_s into objtxt separated by space.
      append objtxt.
      clear objtxt.
      append objtxt.
      objtxt = text-002.
      append objtxt.
      clear objtxt.
      objtxt = text-003.
      append objtxt.
      clear objtxt.
      append objtxt.
      objtxt = text-004.
      concatenate objtxt tc_name 'at' tc_num into objtxt separated by space.
      append objtxt.
      clear objtxt.
      DESCRIBE TABLE objtxt LINES tab_lines.
      READ TABLE objtxt INDEX tab_lines.
    *Mail description
      CLEAR docdata.
      docdata-doc_size  = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
      docdata-obj_name  = 'Reminder'.
      docdata-obj_descr = 'REMINDER TO DO PRE-BOOKING'.
      docdata-obj_langu = sy-langu.
    *Packing list for main document
      CLEAR objpack.
      CLEAR objpack[].
      objpack-head_start = 1.
      objpack-head_num   = 0.
      objpack-body_start = 1.
      objpack-body_num   = tab_lines.
      objpack-doc_type   = 'RAW'.
      APPEND objpack.
    *Email receiver's list
      CLEAR reclist.
      CLEAR reclist[].
      if count = 1.
    reclist-receiver = '[email protected]'.
        reclist-receiver = email.
      else.
        reclist-receiver = email_s.
      endif.
      reclist-rec_type = 'U'.
      APPEND reclist.
      IF SY-SUBRC <> 0.
        MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
        EXPORTING
          document_data              = docdata
          document_type              = 'RAW'
          put_in_outbox              = 'X'
          commit_work                = 'X'
        TABLES
          object_content             = objtxt
          receivers                  = reclist
        EXCEPTIONS
          TOO_MANY_RECEIVERS         = 1
          DOCUMENT_NOT_SENT          = 2
          DOCUMENT_TYPE_NOT_EXIST    = 3
          OPERATION_NO_AUTHORIZATION = 4
          PARAMETER_ERROR            = 5
          X_ERROR                    = 6
          ENQUEUE_ERROR              = 7
          OTHERS                     = 8.
      IF sy-subrc <> 0.
        MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
                WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
      else.
       message 'mail(s) sent successfully' type 'S'.
      ENDIF.
    endform.                    "send_mail
    *&      Form  eventtab_build
    FORM eventtab_build USING rt_events TYPE slis_t_event.
    *Registration of events to happen during list display
      DATA: ls_event TYPE slis_alv_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type = 0
        IMPORTING
          et_events   = rt_events.
      READ TABLE rt_events WITH KEY name = slis_ev_top_of_page INTO ls_event.
      IF sy-subrc = 0.
        MOVE g_top_of_page TO ls_event-form.
        APPEND ls_event TO rt_events.
      ENDIF.
    ENDFORM.                    "eventtab_build
    *&      Form  top_of_page
    FORM top_of_page.
      CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
        EXPORTING
          it_list_commentary = gt_list_top_of_page.
    ENDFORM.                    "top_of_page
    *&      Form  COMMENT_BUILD
    FORM comment_build USING lt_top_of_page TYPE slis_t_listheader.
      DATA: ls_line TYPE slis_listheader,
              rp_date TYPE string.              "report date
    LIST HEADING LINE: TYPE H
      CLEAR ls_line.
      ls_line-typ  = 'H'.
      ls_line-info = text-007.
      APPEND ls_line TO lt_top_of_page.
      CONCATENATE sy-datum6(2) sy-datum4(2) sy-datum(4) INTO rp_date SEPARATED BY '.'.
    STATUS LINE: TYPE S
      CLEAR ls_line.
      ls_line-typ  = 'S'.
      ls_line-key  = text-008.
      ls_line-info = rp_date.
      APPEND ls_line TO lt_top_of_page.
    ENDFORM.                    "comment_build
    *&      Form  read_info
          text
         -->P_1001     text
         -->PERNR      text
         -->STAT       text
         -->REL        text
    form read_info tables p_1001 using  pernr stat rel.
      CALL FUNCTION 'RH_READ_INFTY_1001'
        EXPORTING
          AUTHORITY        = 'DISP'
          WITH_STRU_AUTH   = 'X'
          PLVAR            = '01'
          OTYPE            = 'P'
          OBJID            = pernr
          ISTAT            = stat
          SUBTY            = rel
          BEGDA            = pn-begda
          ENDDA            = pn-endda
        TABLES
          I1001            = p_1001
        EXCEPTIONS
          NOTHING_FOUND    = 1
          WRONG_CONDITION  = 2
          WRONG_PARAMETERS = 3
          OTHERS           = 4.
    endform.                    "read_info
    *&      Module  BACK  INPUT
          text
    MODULE BACK INPUT.
      IF SY-UCOMM = 'E'.
        leave program.
      endif.
      IF SY-UCOMM = 'ENDE'.
        leave program.
      endif.
      IF SY-UCOMM = 'ECAN'.
        leave program.
      endif.
    ENDMODULE.                 " BACK  INPUT

  • Average value for a Date Field in an OO Alv Grid.

    Hi Abapers.
    I've been searching for some info about averages in OO Alv grid lists but cannot find an answer to what I'm really need. The question is that, for getting an average, a 'C' value must be set in the field DO_SUM of the fieldcatalog structure for a field.
    Now, the problem is that I need the average of a date field (in 'normal' date format). I've tried it several times and read a lot of things but cannot find a real answer: Could it be done the average of a date field (e.g. for dates 01.05.2009, 02.05.2009 and 03.05.2009 the average is 02.05.2009).
    Best Regards.

    Hi,
    It will come along with the standard tool bar.For number fields, you can see it(Mean).

  • How to Restrict the values of Field TASKTYPE on a ALV Grid.?

    Hi;
    Let me explain my problem. I have report written by another abap developer who has gone now.
    On the ALV Grid there is a field called "Activity Process". By F1 F9 I can read that field depends on table TCATX_TASKTYPES and field TASKTYPE   . From se11 I can see that there is no search help related with the field.
    When the user press F4 all the data in the table is listed . The user want to filter some of the listed data according to same logic .
    When I debug the code after F4 on the field I found that the system finds Search Help: TCATX_TASKTYPES of type 'CT'. But unfortunately SE11 says that there in  no search help such as TCATX_TASKTYPES.
    The previous abap developer used BADI NETW_USER_FIELDS_F4 AT_F4 with class ZCL_IM_NETW_USER_FIELDS_F4 and interface IF_EX_NETW_USER_FIELDS_F4  for the transaction cj20n to filter the same field but this is not triggered by the F4 on the ALV Grid.
    What can I do ?
    Would you please help me ?

    I know i can do this using ADF Business Components as the business service but the problem is that the initial value for that attribute will be changed depending on the screen ... ill give u a simple example : lets say that I have employee table ( which include dept column) and under that table I have a table called "Emp_dept_movements" now in the main ADF page "employee entry" I have two blocks Employee data ( master view) employee dept data ( detail view ) now when the user press the create-insert button on the employee dept view the system should copy the dept no from the employee view to the dept no on the emp_dept_movements view... and the "Emp_dept_movements" will be used in another screen called " employee departement movements" without any initial value for the DeptNo
    I dont want to create more than one view and cant set the initial value for that attribute in the view , Can this be done through the UI by adding set action listener on that button and specifying from ( binding master_view.dept ) - to (binding of detail_view.dept) ..
    hope that am clear this time,
    Edited by: Delta on Jul 5, 2010 11:21 PM

  • How to make a field mendatory input in ALV grid

    Hi All,
    I am using   CALL METHOD g_alv_grid_0200->set_table_for_first_display for diplay in an ALV Grid.
    I have made few fields in the ALV grid as EDITABLE. Now I want to make them as MENDATORY FOR INPUT.
    Can somebody please suggest me how can I do it using any field of field catalogue or any other way !
    Timely inputs will be highly appreciated.
    Thanks in Advance!!
    Chandan

    hi
    we the option of making the field as not mandatory or making the field ready for input or edit
    but dont have the option to make the edited field as mandatory.
    types: begin of slis_fieldcat_alv_spec,
             key_sel(1)     type c,        " field not obligatory
             input(1)       type c,        " input
             edit(1)        type c,        " internal use only
           end of slis_fieldcat_alv_spec.
    Regards

  • Displaying the field symbol result in ALV GRID

    hi.
        I have a requirement to display the field symbol in ALV GRID. I am getting a error 'FIELD SYMBOL NOT YET BEEN ASSIGNED'  when i am calling the 'REUSE ALV GRID DISPLAY'. Can any one help me out..

    I have a requirement that i have to display all the GL indicators as a field.
    For that i have created a dynamic internal table so that based upon the GL indicators available in the database table i can create a dynamic internal table with GL indicators as the fieldnames.
    Now i want to populate the corresponding amount with respect to the GL indicators in the dynamic internal table.
    For ex.
    I have a database table as follows:
    Vendor Id GL indicators Amount
    1000 A 2000
    1000 S 3000
    I have to created a field symbol as follows
    Vendor Id A S
    1000 2000 3000.
    Now my requirement is that i want this values to be displayed in ALV GRID.
    At the point of calling REUSE ALV GRID DISPLAY  i am getting the error field symbol is not yet been assigned..

  • When do we need field catalog merge in ALV

    Hi all,
    When do we actually need fieldcatalog merge in ALV's
    Regards
    Saroja.

    Hi
    When you want the field catalog to be populated directly from the internal table or a structure, you can use this function module. If you are populating the field catalog from an internal table in an include other than your top include, then the include name also has to be passed to the function module.
    reward if helpful
    regards,
    madhu

  • Mark fields (columns) in editable ALV Grid as mandatory

    Hi,
    could you please help me to set up a column in an editable alv grid as mandatory? I had a look in several references and also did not find anything in the fieldcatalog structure.
    Best regards,
    Fabian

    Hello Fabian
    Here is some coding to explain what I meant.
    *& Report  ZUS_SDN_ALV_ERROR_LOG
    REPORT  zus_sdn_alv_error_log.
    DATA:
      er_data_changed    TYPE REF TO cl_alv_changed_data_protocol.
    START-OF-SELECTION.
    * Dynpro is empty (contains no elements)
      CALL SCREEN '0100'.
    END-OF-SELECTION.
    *&      Module  PBO_0100  OUTPUT
    *       text
    MODULE pbo_0100 OUTPUT.
    * Event DATA_CHANGED was fired due to changes in the editable ALV grid
      IF ( er_data_changed IS BOUND ).
    * User did not change any values
      ELSE.
        CREATE OBJECT er_data_changed
    *      EXPORTING
    *        I_CONTAINER =
    *        I_CALLING_ALV = <your ALV grid instance>
      ENDIF.
    * That is how your code probably looks like
    *  LOOP AT gt_outtab INTO gs_outtab.
    *    IF ( gs_outtab-obligatory IS INITIAL ).
    *      CALL METHOD go_alvlog->add_protocol_entry
    *        EXPORTING
    *          i_msgid     = '00'
    *          i_msgty     = 'E'
    *          i_msgno     = '398'
    *          I_MSGV1     = 'Field OBLIGATORY must not be empty'
    **          I_MSGV2     =
    **          I_MSGV3     =
    **          I_MSGV4     =
    *          i_fieldname = 'OBLIGATORY'
    **          I_ROW_ID    =
    *          I_TABIX     = syst-tabix
    *    ENDIF.
    *  ENDLOOP.
    * Generate a protocol for testing purposes
      DO 5 TIMES.
        CALL METHOD er_data_changed->add_protocol_entry
          EXPORTING
            i_msgid     = '00'
            i_msgty     = 'E'
            i_msgno     = '398'
            i_msgv1     = 'Field OBLIGATORY must not be empty'
    *          I_MSGV2     =
    *          I_MSGV3     =
    *          I_MSGV4     =
            i_fieldname = 'OBLIGATORY'
            i_row_id    = syst-index
            i_tabix     = syst-index
      ENDDO.
      CALL METHOD er_data_changed->display_protocol
    *    EXPORTING
    *      I_CONTAINER =
    ENDMODULE.                 " PBO_0100  OUTPUT
    Please note that this report dumps as soon as you close the log popup. However, this will not happen within your event handler method.
    Regards
      Uwe

  • Field Catalog in the ALV reports...

    Hi Friends,
    When we set a field catalog for a field, it will carry same properties for all the records in the list under that field. My question is whether we can have a record or some records without the properties of that field catalog. Hope you guys understood my question.
    Thanx in advance,
    Ram

    Hi Ram ,
    you can make your fieldcatalog for that field by only giving the name of field and rest of the required field property  as blank '' or as per your requirement.
    regards
    Saj

  • Price condition creation & fields catalog update

    Hello all SAP experts,
    I am trying to create a pricing condition that will be applied in stock transport order based on shipping conditions. Depending on the shipping conditions used in the STO, the amount of this condition will change.
    The thing is, I cannot get it to work.
    <b>What I did:</b>
      - created a new condition type
      - included this condition in the current calculation schema
      - added the shipping condition field (VSBED) in the field catalog for condition tables (it was not in standard field list)
      - created a condition table with the shipping condition field embedded
      - created an access sequence with reference to the above condition table
      - linked the access sequence to the condition
      - created a few condition records for the new condition type
    <b>Result:</b>
    When creating a STO, the system tries to populate but it is not working. When I look at the price deter;ination analysis, the system that the value of the shipping condition was not found, though it is defined in the STO.
    <b>One step further</b>
    I tried to change several things, but it isn't working. Looking at the access sequence, I noticed that the field for shipping conditions (VSBED) was stored in an internal document structure valid for document header (so-called 'KOMK' in the document structure column). I am a bit surprised because the system should look for the information at item level, not at header level. I tried to change the value to 'KOMP' (item level), but I don't know how to do it.
    I realize my post is a bit lon and might get a bit confusing, but would you have any hint / idea on how to retrive the shipping conditions infomation properly?
    Any info highly appreciated!
    Thanks in advance,
    Morgan

    Please go through the steps below
    - created a new condition type
    This is file
    - included this condition in the current calculation schema
    this is fine
    - added the shipping condition field (VSBED) in the field catalog for condition tables (it was not in standard field list)
    This is fine
    - created a condition table with the shipping condition field embedded
    make sure the table is created properly
    - created an access sequence with reference to the above condition table
    Make sure the access sequence is created based on the way you want to defualt the condition in PO
    like if you access seq should contian
    e.g. your criteria is suppose STO type ST and vendor X and shipping condition is 01 then insert that condition in the PO
    - linked the access sequence to the condition
    check the access sequence in the condition record bu hitting Record for Access and here you should able see the value as per the criteria
    - created a few condition records for the new condition type
    This is fine
    Now check you calculation schema that this condition should not checked as Manual determination in schema.
    Hope this will help you to resolve ur problems

  • Field Catelog Issue for ALV Grid

    Hi,
    I have generated the ALV Dynamically based on the Date Range entered on the selection screen, now I am able to fill the values into the structure also, here my problem is date is like S858-spbup ( mm/yyyy format), what ever the values I have moved is S858-umwavwr(Currency values), now I want to sub total these values. Since my field catelog is date format that is why it is not doing subtotals.
    code is
        gs_fc-seltext_l = date.
        gs_fc-seltext_m = date.
        gs_fc-seltext_s = date.
        gs_fc-ref_fieldname = 'umwavwr'.
        gs_fc-ref_tabname = 'S858'.
        gs_fc-do_sum = 'X'.
        gs_fc-outputlen = 20.
        APPEND gs_fc TO gt_fc.
    it is doing subtotal but the issue is in ALV header it is not displaying like date (for example 06/2005),instead it is displaying the name as ref_fieldname text. How to resolve this issue. Please help me.
    Thanks & Regards,
    Sivaram Kandula

    Hi Rich,
    Thanks for your speedy reply. But in my case scenario is different.
    if i remove the ref_fieldname = date means it is dumping bcz,
    output is like this
    suppose my input is 06/2005 to 08/2005
    CSR   District  06/2005 07/2005 08/2005 totals
    xxx   newyork    30.00    3.00   5.00    38.00
    xxx   newyork    40.00    5.00   6.00    20.00
    xxx              70.00    8.00  11.00    58.00
    now I am able to display the output like this, but the problem here is i am unable to subtotal these, bcz my field catelog is date type that is why do_sum is not working, that is why I took ref_feield name as UMWAVWR and S858, it is subtotaling but I am unable to see the header like above, instead it is displaying like
    CSR  District   invoice:Cost  invoice:Cost Invoice:cost tot
    so please advise me how to proceed further.
    Thanks & Regards,
    Sivaram Kandula

  • Updating editbale ALV grid

    I have a requirement that when a user changes a value in a column of the ALV that I then lookup a table to find a value that can be populated in another column in in my alv.  So for example if the user choose a material I need to default the price in.  But in the handle_data_change method I don't actually have visibility of my internal table.  What i have is an empty table, I enter the material number but it is not recognised as a value in my internal table, so I can tehn add the price to the table.  Any ideas?

    Hi,
    With in HANDLE_DATA_CHANGED event, your internal table will be visible and can be accessed. I have done a similar requirement.
    In the Class definition, the event is as follows:
    HANDLE_DATA_CHANGED FOR EVENT DATA_CHANGED
                          OF CL_GUI_ALV_GRID
                          IMPORTING ER_DATA_CHANGED.
    In the Class Implementation, write a subroutine to handle your code.
    Within your subroutine, you can use this ER_DATA_CHANGED. This actually refers to your alv.
    Hope this helps.
    Regards,
    Sindhu.

Maybe you are looking for

  • Scenario data seems to be deleted unknowingly.

    Hello, Last week I had to make "Loacation" dimension in database-A to be identical to database-B. I deleted all the children of "Location" dimension in database-A and then copy/pasted the children from database-B. I restructured and rebuilt the cube

  • Nokia Music - UAE (MENA) - Misleading/False Nokia ...

    </body> I am so much annoyed for the past many years (since the release of N8) that music can't be bought or vouchers are not available for Nokia Store in UAE. Now after buying Lumia 920, the Music App is not available in UAE, thus we can't buy/strea

  • Hdmi was working fine , now I am getting no signal, please someone help!!

    I Moved my tv and Macbook pro to another room and now my Hdmi will not work. It keeps saying no signal. Please help!

  • Very urgent:about deployment kit or executable option

    hay programmers i have a very urgent problem i want to make my developer project as executable is this possible the next thing is that is there any deployment kit available for developer 6i so that it will automatically install the application as wel

  • Authorization check on Z report

    Hello Experts, We had a requirement to develop a report which would combine the features of V.14 and V23 with some additional features like removing delivery blocks and billing blocks. We want to add some authorization checks so that some people are