In ALV report doubt

Hi Expart,
In ALV report ,what is the work of
1) REUSE_ALV_VARIANT_DEFAULT_GET function module
2) SLIS_LAYOUT_ALV
Regards
Bhabani

Hi,
1.SELECTING THE VARIANTS FOR INITIAL LIST DISPLAY (DEFAULT VARIANT)
The variants in the list display can be both user-specific and general. The user can programmatically set the initial (default) variant for list display.
The default variant can be found using the function module 'REUSE_ALV_VARIANT_DEFAULT_GET'.
Sample code:
CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
       EXPORTING
            i_save     = variant save condition ( A=all, U = user-specific )
       CHANGING
            cs_variant = internal table containing the program name (and the default variant---optional )
       EXCEPTIONS
            not_found  = 2.
2.A layout is build for the report output list description USING the internal table declared above (I_LAYOUT).
Output list description structure.
     The parameters are described under the following heads:
•     Display options
•     Exceptions
•     Totals
•     Interaction
•     Detail screen
•     Display variants (only for hierarchical-sequential lists)
•     Color
•     Other
The layout table is of type slis_layout_alv_spec and has the following fields:
Reward,if useful.
Thanks,
Chandu

Similar Messages

  • ALV Report doubt

    Hi All
    I am creating a ALV report and had realized that we can use REUSE_ALV_FIELDCATALOG_MERGE to create a fieldcatalog.
    However in I_STRUCTURE_NAME parameters I have to pass only structure that are defined in DDIC. I can"t pass my internal table defined for output.
    So this option maynot be much useful. instead I can build fieldcatalog manually.
    Am I right ? also at this time I am only concentrating on ALV using Functional Modules. Please let me know.
    Regards
    Madhu.

    Hi ERIC and others,
    Thanks you once again.
    Can you please let me know where I am doing mistake, i am not getting totals on price but I getting sort on carrid and they are grouping.
    Please help me.
    REPORT  ZALV_REPORT_SFLIGHT.
    TABLES : SFLIGHT.
    TYPE-POOLS : SLIS.
    DATA :   IT_SFLIGHT TYPE TABLE OF SFLIGHT.
    **DATA DECLARTION
    DATA: FIELDCATALOG TYPE SLIS_T_FIELDCAT_ALV WITH HEADER LINE,
          GD_sort type STANDARD TABLE OF slis_sortinfo_alv WITH HEADER LINE,
          I_REPID      LIKE SY-REPID.
    i_repid = sy-repid.
    perform get_data.
    perform build_fieldcat.
    perform display.
    *&      Form  get_data
    form get_data .
    select * from sflight into table it_sflight.
    endform.                    " get_data
    *&      Form  build_fieldcat
    form build_fieldcat .
    CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
    EXPORTING
       I_PROGRAM_NAME               = i_repid
       I_INTERNAL_TABNAME           = 'IT_SFLIGHT'
       I_STRUCTURE_NAME             = 'SFLIGHT'
      I_CLIENT_NEVER_DISPLAY       = 'X'
      I_INCLNAME                   =
      I_BYPASSING_BUFFER           =
      I_BUFFER_ACTIVE              =
      CHANGING
        ct_fieldcat                  = FIELDCATALOG[]
    EXCEPTIONS
       INCONSISTENT_INTERFACE       = 1
       PROGRAM_ERROR                = 2
       OTHERS                       = 3
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    GD_sort-fieldname = 'CARRID'.
    GD_sort-tabname = 'SFLIGHT'.
    *GD_sort-up  =
    *GD_sort-down =
    *GD_sort-group = 'X'.
    GD_sort-subtot = 'X'.
    append gd_sort TO GD_SORT.
    endform.                    " build_fieldcat
    *&      Form  display
    form display .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      I_INTERFACE_CHECK                 = ' '
      I_BYPASSING_BUFFER                = ' '
      I_BUFFER_ACTIVE                   = ' '
       I_CALLBACK_PROGRAM                = I_REPID
      I_GRID_TITLE                      =
      I_GRID_SETTINGS                   =
      IS_LAYOUT                         =
       IT_FIELDCAT                       = FIELDCATALOG[]
      IT_EXCLUDING                      =
      IT_SPECIAL_GROUPS                 =
        IT_SORT                           = GD_sort[]
      IT_FILTER                         =
      IS_SEL_HIDE                       =
      I_DEFAULT                         = 'X'
      I_SAVE                            = ' '
    IMPORTING
      E_EXIT_CAUSED_BY_CALLER           =
      ES_EXIT_CAUSED_BY_USER            =
      TABLES
        t_outtab                          = IT_SFLIGHT
    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
    Thank you

  • Block ALV Report Doubt!

    Hi!
       In Block AlV we r using Fun Mod
                              REUSE_ALV_BLOCK_LIST_APPEND
        To display data in blocks and called again to display other data in block in same screen.
      I want to know REUSE_ALV_BLOCK_LIST_DISPLAY Fun mod is optional  or mandatory
       without using this also shall i get the required o/p.
      Looking for your reply.
    Rahul.

    REUSE_ALV_BLOCK_LIST_DISPLAY  is mandatory, without calling this FM, you will not get any disply.
    In the below ALV if you comment out t REUSE_ALV_BLOCK_LIST_DISPLAY   FM call call you will not get disply.
    REPORT ztest1 .
    TABLES:     ekko, mara.
    TYPE-POOLS: slis.
    *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,
    END OF t_ekko.
    TYPES: BEGIN OF t_mara,
      matnr TYPE mara-matnr,
      mtart TYPE mara-mtart,
      matkl TYPE mara-matkl,
    END OF t_mara.
    DATA: it_ekko TYPE STANDARD TABLE OF t_ekko INITIAL SIZE 0,
          it_mara TYPE STANDARD TABLE OF t_mara INITIAL SIZE 0.
    *ALV data declarations
    DATA: fieldcatalog1 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          fieldcatalog2 TYPE slis_t_fieldcat_alv WITH HEADER LINE,
          gd_layout     TYPE slis_layout_alv,
          gt_events_ekko TYPE slis_t_event,
          xs_event      TYPE slis_alv_event,
          gt_events_mara TYPE slis_t_event,
          gd_repid       TYPE sy-repid,
          gt_print TYPE slis_print_alv.
    * START-OF-SELECTION
    START-OF-SELECTION.
      PERFORM data_retrival.
      PERFORM build_fieldcat.
      PERFORM build_layout.
      PERFORM events_ekko.
      PERFORM events_mara.
      PERFORM display_alv_report.
    *SUBROUTINES
    *&      Form  data_retrival
    FORM data_retrival .
      SELECT ebeln ebelp statu aedat matnr menge meins netpr peinh
       UP TO 10 ROWS
        FROM ekpo
        INTO TABLE it_ekko.
      SELECT matnr mtart matkl
       UP TO 10 ROWS
        FROM mara
        INTO TABLE it_mara.
    ENDFORM.                    " data_retrival
    *&      Form  build_fieldcat
    FORM build_fieldcat .
    * FOR EKKO
      fieldcatalog1-fieldname   = 'EBELN'.
      fieldcatalog1-seltext_m   = 'Purchase Order'.
      fieldcatalog1-col_pos     = 0.
      fieldcatalog1-outputlen   = 10.
      fieldcatalog1-emphasize   = 'X'.
      fieldcatalog1-key         = 'X'.
      APPEND fieldcatalog1 TO fieldcatalog1.
      CLEAR  fieldcatalog1.
      fieldcatalog1-fieldname   = 'EBELP'.
      fieldcatalog1-seltext_m   = 'PO Item'.
      fieldcatalog1-col_pos     = 1.
      APPEND fieldcatalog1 TO fieldcatalog1.
      CLEAR  fieldcatalog1.
      fieldcatalog1-fieldname   = 'STATU'.
      fieldcatalog1-seltext_m   = 'Status'.
      fieldcatalog1-col_pos     = 2.
      APPEND fieldcatalog1 TO fieldcatalog1.
      CLEAR  fieldcatalog1.
      fieldcatalog1-fieldname   = 'AEDAT'.
      fieldcatalog1-seltext_m   = 'Item change date'.
      fieldcatalog1-col_pos     = 3.
      APPEND fieldcatalog1 TO fieldcatalog1.
      CLEAR  fieldcatalog1.
      fieldcatalog1-fieldname   = 'MATNR'.
      fieldcatalog1-seltext_m   = 'Material Number'.
      fieldcatalog1-col_pos     = 4.
      APPEND fieldcatalog1 TO fieldcatalog1.
      CLEAR  fieldcatalog1.
      fieldcatalog1-fieldname   = 'MENGE'.
      fieldcatalog1-seltext_m   = 'PO quantity'.
      fieldcatalog1-col_pos     = 5.
      APPEND fieldcatalog1 TO fieldcatalog1.
      CLEAR  fieldcatalog1.
      fieldcatalog1-fieldname   = 'MEINS'.
      fieldcatalog1-seltext_m   = 'Order Unit'.
      fieldcatalog1-col_pos     = 6.
      APPEND fieldcatalog1 TO fieldcatalog1.
      CLEAR  fieldcatalog1.
      fieldcatalog1-fieldname   = 'NETPR'.
      fieldcatalog1-seltext_m   = 'Net Price'.
      fieldcatalog1-col_pos     = 7.
      fieldcatalog1-outputlen   = 15.
      fieldcatalog1-do_sum      = 'X'.        "Display column total
      fieldcatalog1-datatype     = 'CURR'.
      APPEND fieldcatalog1 TO fieldcatalog1.
      CLEAR  fieldcatalog1.
      fieldcatalog1-fieldname   = 'PEINH'.
      fieldcatalog1-seltext_m   = 'Price Unit'.
      fieldcatalog1-col_pos     = 8.
      APPEND fieldcatalog1 TO fieldcatalog1.
      CLEAR  fieldcatalog1.
    * FOR MARA
      fieldcatalog2-fieldname   = 'MATNR'.
      fieldcatalog2-seltext_m   = 'Material No'.
      fieldcatalog2-col_pos     = 0.
      fieldcatalog2-outputlen   = 10.
      fieldcatalog2-emphasize   = 'X'.
      fieldcatalog2-key         = 'X'.
      APPEND fieldcatalog2 TO fieldcatalog2.
      CLEAR  fieldcatalog1.
      fieldcatalog2-fieldname   = 'MTART'.
      fieldcatalog2-seltext_m   = 'Material type'.
      fieldcatalog2-col_pos     = 1.
      APPEND fieldcatalog2 TO fieldcatalog2.
      CLEAR  fieldcatalog2.
      fieldcatalog2-fieldname   = 'MATKL'.
      fieldcatalog2-seltext_m   = 'Material Group'.
      fieldcatalog2-col_pos     = 2.
      APPEND fieldcatalog2 TO fieldcatalog2.
      CLEAR  fieldcatalog2.
    ENDFORM.                    " build_fieldcat
    *&      Form  build_layout
    FORM build_layout .
      gd_layout-no_input          = 'X'.
      gd_layout-colwidth_optimize = 'X'.
      gd_layout-totals_text       = 'Totals'(201).
    ENDFORM.                    " build_layout
    *&      Form  events_ekko
    FORM events_ekko .
      CLEAR xs_event.
      xs_event-name = slis_ev_top_of_page.
      xs_event-form = 'TOP_OF_PAGE-EKKO'.
      APPEND xs_event TO gt_events_ekko.
      CLEAR xs_event.
      xs_event-name = slis_ev_end_of_list.
      xs_event-form = 'END_OF_LIST_EKKO'.
      APPEND xs_event TO gt_events_ekko.
    ENDFORM.                    " events_ekko
    *&      Form  TOP_OF_PAGE-EKKO
    FORM top_of_page-ekko.
      WRITE: / 'TOP OF PAGE : Purchase Order'.
    ENDFORM.                    "XTOP_OF_PAGE
    *&      Form  END_OF_LIST_EKKO
    FORM end_of_list_ekko.
      WRITE: / 'end OF list : Purchase Order'.
    ENDFORM.                    "END_OF_LIST_EKKO
    *&      Form  events_mara
    FORM events_mara .
      CLEAR xs_event.
      xs_event-name = slis_ev_top_of_list.
      xs_event-form = 'TOP_OF_LIST-MARA'.
      APPEND xs_event TO gt_events_mara.
      CLEAR xs_event.
      xs_event-name = slis_ev_end_of_page.
      xs_event-form = 'END_OF_PAGE_MARA'.
      APPEND xs_event TO gt_events_mara.
    ENDFORM.                    "events_mara
    *&      Form  TOP_OF_LIST-MARA
    FORM top_of_list-mara.
      WRITE: / 'TOP OF LIST : Material Master'.
    ENDFORM.                    "TOP_OF_LIST-MARA
    *&      Form  END_OF_PAGE_MARA
    FORM end_of_page_mara.
      WRITE: / 'End OF Page : Material Master'.
    ENDFORM.                    "END_OF_PAGE_MARA
    *&      Form  display_alv_report
    FORM display_alv_report .
      gd_repid = sy-repid.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_INIT'
        EXPORTING
          i_callback_program = sy-repid.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = gd_layout
          it_fieldcat                      = fieldcatalog1[]
          i_tabname                        = 'it_ekko'
          it_events                        = gt_events_ekko
        TABLES
          t_outtab                         = it_ekko
       EXCEPTIONS
         program_error                    = 1
         maximum_of_appends_reached       = 2
         OTHERS                           = 3
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_APPEND'
        EXPORTING
          is_layout                        = gd_layout
          it_fieldcat                      = fieldcatalog2[]
          i_tabname                        = 'it_mara'
          it_events                        = gt_events_mara
        TABLES
          t_outtab                         = it_mara
       EXCEPTIONS
         program_error                    = 1
         maximum_of_appends_reached       = 2
         OTHERS                           = 3
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      gt_print-reserve_lines = 2.
      CALL FUNCTION 'REUSE_ALV_BLOCK_LIST_DISPLAY'
        EXPORTING
          is_print = gt_print.
    ENDFORM.                    " display_alv_report

  • Checkbox in alv report-doubt

    hi all
        can anybody tell me the coding lines for
    1)when checking a check box 'test run' in selection-screen,
    a particular output field(for eg.,itab_final-WBS1) has to be updated in standard table(e.g,CATSDB-WBS)  ,if not checked,it should not be updated,just the user has to view the report
    thanks in advance
    Moderator Message: Please do your on work. If you get stuck after putting some effort from your side, then ask a specific question here.
    Edited by: kishan P on Apr 7, 2011 10:30 AM

    Hi,
    1.SELECTING THE VARIANTS FOR INITIAL LIST DISPLAY (DEFAULT VARIANT)
    The variants in the list display can be both user-specific and general. The user can programmatically set the initial (default) variant for list display.
    The default variant can be found using the function module 'REUSE_ALV_VARIANT_DEFAULT_GET'.
    Sample code:
    CALL FUNCTION 'REUSE_ALV_VARIANT_DEFAULT_GET'
           EXPORTING
                i_save     = variant save condition ( A=all, U = user-specific )
           CHANGING
                cs_variant = internal table containing the program name (and the default variant---optional )
           EXCEPTIONS
                not_found  = 2.
    2.A layout is build for the report output list description USING the internal table declared above (I_LAYOUT).
    Output list description structure.
         The parameters are described under the following heads:
    •     Display options
    •     Exceptions
    •     Totals
    •     Interaction
    •     Detail screen
    •     Display variants (only for hierarchical-sequential lists)
    •     Color
    •     Other
    The layout table is of type slis_layout_alv_spec and has the following fields:
    Reward,if useful.
    Thanks,
    Chandu

  • Doubt regarding editable ALV report using Classes

    I need to create an ALV report and make few fields editable
    and i need to update the changes  to the corresponding database tables
    for that please suggest me some idea or provide me sample code for that
    urgent

    Hi ramesh,
    Please check this example program. I think it will help for some extent.
    [code]&----
    *& Report  ZSUMA_INTERACTIVEREPORT                                     *
    report zsuma_interactivereport.
    tables: vbak.
    data :gr_alvgrid type ref to cl_gui_alv_grid,
          gr_cc_name type scrfname value 'CC_ALV',
          gr_ccontainer type ref to cl_gui_custom_container,
          gr_fieldcat type lvc_t_fcat,
          gr_layout type lvc_s_layo,
          gr_sort type lvc_t_sort,
          gr_get_cell type lvc_t_cell,
          gr_set_cell type lvc_t_cell,
          gr_hyper type lvc_t_hype,
          gr_drop_down type lvc_t_drop,
          is_variant type disvariant,
          line_number type lvc_s_roid-row_id,
          line(5) type c ,
          cell_value type lvc_value.
    data: begin of it_vbak occurs 0,
          vbeln type vbak-vbeln,
          erdat like vbak-erdat,
          erzet like vbak-erzet,
          netwr like vbak-netwr,
          waerk like vbak-waerk,
    *Below field is useful for making the entire row with different colors.
    it must be a char of 4.and layout-info_fname should populate with
    *this field.
          rowcolor(4) type c,
    *Below field is useful for making the INDIVIDUAL CELL with different
    *colors.for this we have to include structure of type lvc_t_scol.
    *layout-ctab_fname should be populate with this field.
          cellcolor type lvc_t_scol,
    *below field is added for for providing the hyperlinks to perticular
    *field. at the time of field catalog , it_fcatalog-web_field should be
    *populate with this field.
          vbeln_hyper type int4,
    *For displaying one cell as button.we have to declare one styles
    *internal table .it has to be populate.at layout structure this table
    *name has to be populate at layout-stylename.
         cellstyle type lvc_t_styl,
          end of it_vbak.
    *&   SELECTION SCREEN
    selection-screen begin of block b1 with frame title text-001.
    select-options s_vbeln for vbak-vbeln.
    selection-screen end of block b1.
    start-of-selection.
    select vbeln
           erdat
           erzet
           netwr
           waerk
           from vbak
           into corresponding fields of table it_vbak
           where vbeln in s_vbeln.
    data: wa_cellcolor type lvc_s_scol,
          wa_style type lvc_s_styl.
    loop at it_vbak.
    FOR ROW COLORING
    if sy-tabix = 1.
    it_vbak-rowcolor = 'C511'.
    FOR PUTTING THE HYPERLINKS ON VBELN FIELD
    it_vbak-vbeln_hyper = '1'.
    modify it_vbak.
    endif.
    FOR CELL COLORING
    if sy-tabix = 2.
    wa_cellcolor-fname = 'ERZET'.
    wa_cellcolor-color-col = '6'.
    wa_cellcolor-color-int = '1'.
    wa_cellcolor-color-inv = '1'.
    append wa_cellcolor to it_vbak-cellcolor.
    modify it_vbak index 2.
    endif.
    FOR DISPLAYING THE CELL AS A BUTTON
    clear it_vbak-cellstyle.
    at last.
    read table it_vbak index sy-tabix.
    wa_style-fieldname = 'NETWR'.
    wa_style-style = cl_gui_alv_grid=>mc_style_button.
    append wa_style to it_vbak-cellstyle .
    modify it_vbak .
    endat.
    endloop.
    if not it_vbak[] is initial.
      call screen 100.
    endif.
    *CLASS DEFINITION FOR HANDLING THE EVENTS IN ALV GRID
    class gr_event_handler definition.
    public section.
    methods:handle_hotspot_click
                  for event hotspot_click of cl_gui_alv_grid
                   importing e_row_id e_column_id es_row_no.
    endclass.
    *CLASS IMPLEMENTATIONFOR HANDLING THE EVENTS IN ALV GRID
    class gr_event_handler implementation.
    method handle_hotspot_click.
    perform handle_hotspot_click using e_row_id e_column_id es_row_no.
    endmethod.
    endclass.
    *&      Form  BUILDING_FIELDCATALOG
          text
         <--P_GR_FIELDCAT  text
    form building_fieldcatalog  changing p_gr_fieldcat type lvc_t_fcat.
    data s_fieldcat type lvc_s_fcat.
    s_fieldcat-fieldname = 'VBELN'.
    s_fieldcat-outputlen = '15'.
    s_fieldcat-col_pos   = '1'.
    s_fieldcat-coltext   = 'DOCCUMENT NO.'.
    s_fieldcat-key   = ' '.
    s_fieldcat-emphasize = 'C511'.
    s_fieldcat-web_field = 'VBELN_HYPER'.
    append s_fieldcat to p_gr_fieldcat .
    clear s_fieldcat.
    s_fieldcat-fieldname = 'ERDAT'.
    s_fieldcat-outputlen = '15'.
    s_fieldcat-col_pos   = '2'.
    s_fieldcat-coltext   = 'REC CREATE DATE.'.
    s_fieldcat-emphasize = 'C311'.
    s_fieldcat-hotspot = 'X'.
    append s_fieldcat to p_gr_fieldcat .
    clear s_fieldcat.
    s_fieldcat-fieldname = 'ERZET'.
    s_fieldcat-outputlen = '15'.
    s_fieldcat-col_pos   = '3'.
    s_fieldcat-coltext   = 'TIME ENTRY.'.
    *S_FIELDCAT-EMPHASIZE = 'C311'.
    append s_fieldcat to p_gr_fieldcat .
    clear s_fieldcat.
    s_fieldcat-fieldname = 'NETWR'.
    s_fieldcat-outputlen = '15'.
    s_fieldcat-col_pos   = '4'.
    s_fieldcat-emphasize = 'C311'.
    s_fieldcat-coltext   = 'NET WEIGHT.'.
    s_fieldcat-do_sum   = 'X'.
    append s_fieldcat to p_gr_fieldcat .
    clear s_fieldcat.
    s_fieldcat-fieldname = 'WAERK'.
    s_fieldcat-outputlen = '5'.
    s_fieldcat-col_pos   = '5'.
    s_fieldcat-emphasize = 'C511'.
    s_fieldcat-coltext   = 'CURR.'.
    FOR PUTTING THE DROP DOWN BOX.
    s_fieldcat-drdn_hndl = '1'.
    s_fieldcat-edit = 'X'.
    append s_fieldcat to p_gr_fieldcat .
    clear s_fieldcat.
    endform.                    " BUILDING_FIELDCATALOG
    *&      Form  CREATE_CCONTAINER_INSTANCE
          text
    -->  p1        text
    <--  p2        text
    form create_ccontainer_instance .
    create object gr_ccontainer
    exporting
    container_name              = gr_cc_name
    exceptions
    cntl_error                  = 1
    cntl_system_error           = 2
    create_error                = 3
    lifetime_error              = 4
    lifetime_dynpro_dynpro_link = 5
    others                      = 6
    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.                    " CREATE_CCONTAINER_INSTANCE
    *&      Form  CREATE_ALVGRID_INSTANCE
          text
    -->  p1        text
    <--  p2        text
    form create_alvgrid_instance .
    create object gr_alvgrid
      exporting
        i_parent          = gr_ccontainer
      exceptions
        error_cntl_create = 1
        error_cntl_init   = 2
        error_cntl_link   = 3
        error_dp_create   = 4
        others            = 5
    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.                    " CREATE_ALVGRID_INSTANCE
    *&      Form  DISPLAYING_ALVGRID
          text
    -->  p1        text
    <--  p2        text
    form displaying_alvgrid .
    call method gr_alvgrid->set_table_for_first_display
      exporting
       I_BUFFER_ACTIVE               =
       I_BYPASSING_BUFFER            =
       I_CONSISTENCY_CHECK           =
       I_STRUCTURE_NAME              =
        is_variant                    = is_variant
        i_save                        = 'A'
       I_DEFAULT                     = 'X'
        is_layout                     = gr_layout
       IS_PRINT                      =
       IT_SPECIAL_GROUPS             =
       IT_TOOLBAR_EXCLUDING          =
        it_hyperlink                  = gr_hyper
       IT_ALV_GRAPHICS               =
       IT_EXCEPT_QINFO               =
      changing
        it_outtab                     = it_vbak[]
        it_fieldcatalog               = gr_fieldcat
       it_sort                       = gr_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.
    *CALL METHOD GR_ALVGRID->GET_FRONTEND_LAYOUT
    IMPORTING
       ES_LAYOUT = GR_LAYOUT
    *GR_LAYOUT-GRID_TITLE = 'HAI ALV'.
    *CALL METHOD GR_ALVGRID->SET_FRONTEND_LAYOUT
    EXPORTING
       IS_LAYOUT = GR_LAYOUT
    endform.                    " DISPLAYING_ALVGRID
    *&      Form  REFRESH_DISPLAY_TABLE
          text
    -->  p1        text
    <--  p2        text
    form refresh_display_table .
    call method gr_alvgrid->refresh_table_display
    EXPORTING
       IS_STABLE      =
       I_SOFT_REFRESH =
      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.                    " REFRESH_DISPLAY_TABLE
    *&      Form  SETTING_LAYOUT
          text
         <--P_GR_LAYOUT  text
    form setting_layout  changing p_gr_layout type lvc_s_layo.
    p_gr_layout-grid_title = 'ALV GRID USING ABAP OBJECTS'.
    p_gr_layout-zebra = 'X'.
    p_gr_layout-no_toolbar = ''.
    p_gr_layout-sel_mode = 'D'.
    p_gr_layout-info_fname = 'ROWCOLOR'.
    p_gr_layout-ctab_fname = 'CELLCOLOR'.
    p_gr_layout-stylefname = 'CELLSTYLE'.
    endform.                    " SETTING_LAYOUT
    *&      Module  STATUS_0100  OUTPUT
          text
    module status_0100 output.
    SET PF-STATUS 'xxxxxxxx'.
    SET TITLEBAR 'xxx'.
    set pf-status 'MENU'.
    if gr_alvgrid is initial.
    *CREATING THE CONTAINER INSTANCE BY SENDING THE CONTAINER NAME( IT HAS
    *TO COINSIDE WITH COSTUM CONTROL NAME OF TRANSACTION SCREEN
    perform create_ccontainer_instance.
    perform create_alvgrid_instance.
    *VARIANT POPULATION.
    perform setting_variants changing is_variant.
    *BELOW FORM IS USEFUL TO FILL THE HYPER LINK TABLE AND WE PASS THAT
    *TABLE TO 'IT_HYPERLINK' PARAMETER IN FIRST DISPLAY METHOD.
    perform setting_hyperlinks_field changing gr_hyper.
    *TO MAKE THE COLOUMN AS DROP DOWN.
    perform setting_dropdown_column changing gr_drop_down.
    perform building_fieldcatalog changing gr_fieldcat.
    perform setting_layout changing gr_layout.
    perform setting_sorting changing gr_sort.
    perform setting_cells changing gr_set_cell.
    perform displaying_alvgrid.
    *PERFORM GETTING_CELL_DETAILS CHANGING GR_GET_CELL. " IT IS NOT WORKING
                                                 FOR ME AND I HAVE DOUBT .
    perform creating_event_object.
    *PERFORM REFRESH_DISPLAY_TABLE.
    endif.
    endmodule.                 " STATUS_0100  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
          text
    module user_command_0100 input.
    case sy-ucomm.
      when 'BACK'.
      leave to screen 000.
      endcase.
    endmodule.                 " USER_COMMAND_0100  INPUT
    *&      Form  SETTING_SORTING
          text
         <--P_GR_SORT  text
    form setting_sorting  changing p_gr_sort type lvc_t_sort.
    data: lr_sort type lvc_s_sort.
    lr_sort-spos = '1'.
    lr_sort-fieldname = 'VBELN'.
    lr_sort-up = 'X'.
    append lr_sort to p_gr_sort.
    lr_sort-spos = '2'.
    lr_sort-fieldname = 'ERDAT'.
    lr_sort-up = 'X'.
    append lr_sort to p_gr_sort.
    endform.                    " SETTING_SORTING
    *&      Form  GETTING_CELL_DETAILS
          text
         <--P_GR_GET_CELL  text
    form getting_cell_details  changing p_gr_get_cell.
    call method gr_alvgrid->get_selected_cells
      importing
        et_cell = p_gr_get_cell
    *CELL_VALUE = P_GR_GET_CELL-VALUE.
    endform.                    " GETTING_CELL_DETAILS
    *&      Form  SETTING_CELLS
          text
         <--P_GR_SET_CELL  text
    form setting_cells  changing p_gr_set_cell type lvc_t_cell.
    data:s_gr_set_cell type lvc_s_cell.
    s_gr_set_cell-col_id-fieldname = 'NETWR'.
    s_gr_set_cell-row_id-index = '3'.
    append s_gr_set_cell to p_gr_set_cell.
    call method gr_alvgrid->set_selected_cells
      exporting
        it_cells = p_gr_set_cell.
    endform.                    " SETTING_CELLS
    *&      Form  SETTING_HYPERLINKS_FIELD
          text
         <--P_GR_HYPER  text
    form setting_hyperlinks_field  changing p_gr_hyper type lvc_t_hype.
    data: is_hype type lvc_s_hype.
    is_hype-handle = '1'.
    is_hype-href = 'HTTP://WWW.GOOGLE.CO.IN'.
    append is_hype to p_gr_hyper.
    is_hype-handle = '2'.
    is_hype-href = 'HTTP://SDN.SAP.COM'.
    append is_hype to p_gr_hyper.
    endform.                    " SETTING_HYPERLINKS_FIELD
    *&      Form  SETTING_DROPDOWN_COLUMN
          text
         <--P_GR_DROP_DOWN  text
    form setting_dropdown_column  changing p_gr_drop_down type lvc_t_drop.
    data: wa_drop type lvc_s_drop.
    wa_drop-handle = '1'.
    wa_drop-value = '$'.
    append wa_drop to p_gr_drop_down.
    wa_drop-handle = '1'.
    wa_drop-value = 'Rs'.
    append wa_drop to p_gr_drop_down.
    wa_drop-handle = '1'.
    wa_drop-value = 'CUR'.
    append wa_drop to p_gr_drop_down.
    call method gr_alvgrid->set_drop_down_table
      exporting
        it_drop_down       = p_gr_drop_down
       IT_DROP_DOWN_ALIAS =
    endform.                    " SETTING_DROPDOWN_COLUMN
    *&      Form  SETTING_VARIANTS
          text
         <--P_IS_VARIANT  text
    form setting_variants  changing p_is_variant type disvariant.
    p_is_variant-report = sy-repid.
    endform.                    " SETTING_VARIANTS
    *&      Form  HANDLE_HOTSPOT_CLICK
          text
         -->P_E_ROW  text
         -->P_E_COLUMN  text
         -->P_E_ROW_NO  text
    form handle_hotspot_click  using    p_e_row_id type lvc_s_row
                                        p_e_column_id type lvc_s_col
                                        p_es_row_no type lvc_s_roid.
    read table it_vbak index p_es_row_no-row_id.
    if sy-subrc = 0 and p_e_column_id-fieldname = 'ERDAT'.
    line = p_es_row_no-row_id.
    line_number = p_es_row_no-row_id.
    leave to screen 200.
    endif.
    endform.                    " HANDLE_HOTSPOT_CLICK
    *&      Form  CREATING_EVENT_OBJECT
          text
    -->  p1        text
    <--  p2        text
    form creating_event_object .
    data event_handle type ref to gr_event_handler.
    create object event_handle.
    set handler event_handle->handle_hotspot_click for gr_alvgrid.
    endform.                    " CREATING_EVENT_OBJECT
    *&      Module  STATUS_0200  OUTPUT
          text
    module status_0200 output.
      set pf-status 'BB'.
    SET TITLEBAR 'xxx'.
    *LINE = LINE_NUMBER.
    endmodule.                 " STATUS_0200  OUTPUT
    *&      Module  USER_COMMAND_0200  INPUT
          text
    module user_command_0200 input.
    if sy-ucomm = 'BACK'.
    leave to screen 100.
    endif.
    endmodule.                 " USER_COMMAND_0200  INPUT[/code]
    Reward points if helpful
    Thanks,
    Suma.

  • Some doubts in alv report

    how can i page breakin alv report ?
    what are the types of variants and events in alv report?
    how to hide field in alv?
    how to change standard pf status in alv reports?
    plz give me sample program for how to use variants in alv?
    <THREAD LOCKED. Please stop asking interview questions. There is already a lot of information out there, refer to the [Rules of Engagement|https://wiki.sdn.sap.com/wiki/display/HOME/RulesofEngagement] on how to ask a good question and learn to search>
    Edited by: Mike Pokraka on Oct 15, 2008 4:52 PM

    how can i page breakin alv report ?
    - Yes... using NEW-PAGE
    what are the types of variants and events in alv report?
    - DATA: g_variant LIKE disvariant.
    - DATA: gt_eventos          TYPE slis_t_event.
    how to hide field in alv?
    - When you define the field catalog mark this field ls_fieldcat-no_out = 'X'.
    how to change standard pf status in alv reports?
    CLEAR ls_extab.
    ls_extab-fcode = 'ZASSIG'.
    APPEND ls_extab TO extab.
    SET PF-STATUS 'Z09_STATUS' EXCLUDING extab.

  • Doubt in Alv Report Coloumn Heading

    Hi Gurus
    I want to print 2 coloumn headings in ALv Report.
    For eg: 1st line coloumn heading contains
                  Name   Number        Date      status
                2nd line coloumn heading contains under status
                              Active      Incative            
    Then if my list size is not enough to show the full details. so i can cut it in 2 lines
        if my list contains 20 coloumns
        i have to put 10 coloumns in first line
        then remaning 10 coloums in second line.
    i want the solution for both the questions.
    Help me.
    Regards.
    Bhuvana.

    For the first issue
    Use Top of Page Event to write a simple list which will act as a header for the alv list.
    Second issue:
    In the fieldcat,
    Position all the first 10 coloums row_pos = 1
    Position all the next 10 coloums row_pos = 2
    Regards,
    Lijo Joseph
    <REMOVED BY MODERATOR>
    Edited by: Alvaro Tejada Galindo on Feb 14, 2008 12:35 PM

  • Doubt on ALV report

    Hi gurus,
         For all of your support , I written the ALV report.Now the field is editable. But the problem is I need to save that field value what we edited.
           Actual requirment is we have some materials list.of vehicles... Those vechicles will move to repair after some days. Then in repair location, the user will enter some comments about that material like when it will be replaced like..That note data need to be saved.. When ever the users will execute the same report once again, that saved data will be appear..
          Please suggest me on this issue..
        Thanks in Advance
    Thanks and Regards
    Siri...

    Hi,
    chk out this..
    http://help.sap.com/saphelp_47x200/helpdata/en/39/27ae3a061d522ae10000000a114084/frameset.htm
    Regards,
    Arunsri

  • Add a row after Total row in ALV report

    Hi Experts,
    I have a report is displayed by  ALV format(not use function module to display it but use Class cl_gui_custom_container),I want to add a row after the total row. for example,
    Customer   amount1    amount2    amount3 
    10000         1,234        1,000         2,000
    10001         4,000        2,000         1,000
    10002         1,300        1,000         3,000
    11000         1,200        4,000         3,000
         Total:     7,734        8,000         9,000
    Ratio%        31.27       32.34          36.39
    the row of 'Total' is calculated by fieldcat-do_sum = 'X' But after the Total row we need a Ratio row to display the ratio. Yes we can calculate the total amout and ratio and then append it into the output itab, but we don't like this solution.We want to keep the total function in the ALV report.Any experts can poit me a direction. Thanks in advance.
    Joe

    Djoe,
    First you need to handle the user command,in order to capture the button action. For this you need to implment a class, i  am attaching sample codes here
    In top include write the following code
    CLASS lcl_event_handler DEFINITION .
      PUBLIC SECTION .
        METHODS:
         handle_toolbar  FOR EVENT toolbar                   " To add new functional buttons to the ALV toolbar
                         OF        cl_gui_alv_grid
                         IMPORTING e_object,
         handle_user_command FOR EVENT user_command          " To implement user commands
                            OF cl_gui_alv_grid
                            IMPORTING e_ucomm .
      PRIVATE SECTION.
    ENDCLASS.                                               " Lcl_event_handler DEFINITION
    Now   <b>Class implementation</b>
    CLASS lcl_event_handler IMPLEMENTATION .
      METHOD handle_toolbar.                                " Handle Toolbar
        PERFORM f9500_handle_toolbar USING e_object.
    ENDMETHOD .                                            " Handle_toolbar
      METHOD handle_user_command .                          " Handle User Command
        PERFORM f9600_handle_user_command USING e_ucomm .
      ENDMETHOD.
    ENDCLASS .                                              " lcl_event_handler IMPLEMENTATION
    FORM f9600_handle_user_command USING p_e_ucomm TYPE sy-ucomm.
      CONSTANTS:c_newl(4) TYPE c
                          VALUE 'NEWL',               " New line
                c_copy(4) TYPE c
                          VALUE 'COPY',               " Copy
                c_corr(4) TYPE c
                          VALUE 'CORR'.               " Correction
      CASE p_e_ucomm .
        WHEN c_newl.
    Create a new line
          PERFORM f9610_insert_new_line.
    ENDFORM.                                          " f9600_handle_user_command
    FORM f9610_insert_new_line .
    *Data Declarations
      DATA: lt_rows     TYPE lvc_t_row,                 " Itab for row property
            ls_rows     TYPE lvc_s_row,                 " Work area for row
            lv_cntid    TYPE i.                         " Counter
      DATA: gv_index TYPE sy-index.
      CLEAR gs_last.
      CALL METHOD gr_alvgrid->get_selected_rows
        IMPORTING
          et_index_rows = lt_rows.
      READ TABLE lt_rows INTO ls_rows INDEX 1.
      IF sy-subrc EQ 0.
        gv_index = ls_rows-index + 1.
      ELSE.
        gv_index = 1.
      ENDIF.
      DESCRIBE TABLE gt_last LINES lv_cntid.
      lv_cntid = lv_cntid + 1.
      gs_last-cntid = lv_cntid.
      INSERT gs_last INTO gt_last INDEX gv_index.
      LOOP AT gt_last INTO gs_last FROM gv_index TO gv_index.
    Make the new line editable
        PERFORM f9611_style.
      ENDLOOP.
      CALL METHOD gr_alvgrid->refresh_table_display
        EXCEPTIONS
          finished = 1
          OTHERS   = 2.
    ENDFORM.                    " f9610_insert_new_line
    You can ask questions doubts if any!
    regards
    Antony Thomas

  • 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

  • VA03 netprice in ALV report

    Hi Experts,
    I am creating a ALV report for sales.
    My doubt is in va03 the net price(vbap-netpr) is have the data type is CURR and its field length is 11 and 2 decimal place. But in  va 01 its accepting more that  3 decimal places for USD and EUR . 
    I need help on how to get the same decimal price to display in the ALV report.
    Please explain with sample.
    Thanks in advance.

    Boopathy S,
    In your final internal table which has to displayed define one field for Netprice type P decimal 3. You cant just refer VBAP-NETPR, if that field has 788.456 like value.
    Regards,
    Venkat.O

  • Related to ALV Report

    Hi All,
    I have a doubt in ALV report.
    there is an output which consists of four fields.
    1.Employee
    2.Organizational Unit
    3.Required Compliance Training Not Completed (the specific course (D))
    4.% Compliant*
    Output should be:
       1        2            3               4
    1.a        b            c               d
                              e
                               f
    I mean there is a single row  for 4 fields.
    and in only 3 rd column  there are again 3 rows.
    how to display this.
    1..4 are columns
    a...f are data .
    Please tell me.
    Thanks,
    Geetha.

    Hi All,
    I have a doubt in ALV report.
    there is an output which consists of four fields.
    1.Employee
    2.Organizational Unit
    3.Required Compliance Training Not Completed (the specific course (D))
    4.% Compliant*
    Output should be:
       1        2            3               4
    1.a        b            c               d
                              e
                               f
    I mean there is a single row  for 4 fields.
    and in only 3 rd column  there are again 3 rows.
    how to display this.
    1..4 are columns
    a...f are data .
    Please tell me.
    Thanks,
    Geetha.

  • ALV Report: How to pass the variable in Work area to the FM ? Please help !

    I want to pass the field in the work area which contains the floating point numbers to FM 'FLTP_CHAR_CONVERSION_FROM_SI'. This the correct FM, I have tested.
    If I specify the field with Tab name in FM , It says its not an internal table with header line.
    Please help me, How should can I proceed further and pass the field to FM and get it back in work area.
    And an other issue is I want to sum the particular field in the output.
    Is there a way to do using 'PF-STATUS', if so how ? or what is the alternative for this ?
    Please help me with my issues.
    I'm new to ALV reports.
    Thanks in Advance !

    Hi,
    For your FM issue, i think you are trying to pass the field in the FM as ITAB-field, while you should be taking the data in the work area first and then pass this work area in the FM as WA_ITAB-field.
    I hope this will resolve your prob.
    I mean loop at the table and take the values into work area, update the internal table with changed value. This way by the end of loop you will have all your fields converted.
    Please explain a little more about your second doubt, it is unclear(to me atleast).
    Edited by: DeepakNagar on Jul 28, 2011 6:08 PM

  • Display Color for sigle  CELL in ALV report

    Hi all,
    I have one doubt is it possible to make a particular cell as read color in ALV.
    Ex: I have one field which shows amount in my ALV report,My requirement is that when ever the amount is less then 'ZERO', I have to show that particular cell in read color.
    Regards
    Anil Kumar.N

    hi,
    here code for coloring a perticular cell
    TYPE-POOLS:slis.
    TABLES:mara,
           makt,
           marc.
    DATA:BEGIN OF itab OCCURS 0,
          matnr LIKE mara-matnr,
          maktx LIKE makt-maktx,
          werks LIKE marc-werks,
          mtart LIKE mara-mtart,
          matkl LIKE mara-matkl,
          meins LIKE mara-meins,
          ntgew LIKE mara-ntgew,
         rowcolor(4) TYPE c,
          cellcolors TYPE lvc_t_scol,
         END OF itab.
    DATA:t_fcat TYPE slis_t_fieldcat_alv,
         t_eve TYPE slis_t_event.
    DATA : st_layout TYPE slis_layout_alv.
    SELECTION-SCREEN:BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
    SELECT-OPTIONS:mat FOR mara-matnr.  " no intervals no-extension.
    *PARAMETERS:mat LIKE mara-matnr.
    SELECTION-SCREEN:END OF BLOCK blk1.
    INITIALIZATION.
      PERFORM build_cata USING t_fcat.
      PERFORM build_event.
    START-OF-SELECTION.
      PERFORM data_retrieval.
      PERFORM display_data.
    *&      Form  build_cata
          text
         -->TEMP_FCAT  text
    FORM build_cata USING temp_fcat TYPE slis_t_fieldcat_alv.
      sy-tvar0 = sy-uname.
      WRITE sy-datum TO sy-tvar1.
      DATA:wa_fcat TYPE slis_fieldcat_alv.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MATNR'.
      wa_fcat-seltext_m = 'Material'.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MAKTX'.
      wa_fcat-seltext_m = 'Description'.
      wa_fcat-fix_column = 'x'.
      wa_fcat-key = 'X'.                                     "To color a column
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'WERKS'.
      wa_fcat-seltext_m = 'Plant'.
      wa_fcat-key = ' '.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MTART'.
      wa_fcat-seltext_m = 'Type'.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MATKL'.
      wa_fcat-seltext_m = 'Group'.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'MEINS'.
      wa_fcat-seltext_m = 'Measurement Unit'.
      APPEND wa_fcat TO temp_fcat.
      wa_fcat-tabname = 'ITAB'.
      wa_fcat-fieldname = 'NTGEW'.
      wa_fcat-seltext_m = 'Net Value'.
      APPEND wa_fcat TO temp_fcat.
    ENDFORM.                    "build_cata
    *&      Form  build_event
          text
    FORM build_event.
      CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
        EXPORTING
          i_list_type     = 0
        IMPORTING
          et_events       = t_eve
        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.
    ENDFORM.                    "build_event
    *&      Form  data_retrieval
          text
    FORM data_retrieval.
      SELECT maramatnr  maramtart maramatkl marameins mara~ntgew
       maktmaktx  marcwerks
      INTO CORRESPONDING FIELDS OF TABLE itab
      FROM mara INNER JOIN makt ON
      maramatnr = maktmatnr
      INNER JOIN marc ON
      maramatnr = marcmatnr
      WHERE mara~matnr IN mat.
      SORT itab BY matnr.
      DELETE ADJACENT DUPLICATES FROM itab.
    ENDFORM.                    "data_retrieval
    *&      Form  display_data
          text
    FORM display_data.
    *******************************For setting Cell Color*******************************************
      DATA ls_cellcolor TYPE lvc_s_scol .
      st_layout-coltab_fieldname = 'CELLCOLORS'.
      READ TABLE itab INDEX 5 .
      ls_cellcolor-fname = 'MATNR' .
      ls_cellcolor-color-col = '1' .
      ls_cellcolor-color-int = '1' .
      APPEND ls_cellcolor TO itab-cellcolors .
      MODIFY itab INDEX 5 .
    st_layout-colwidth_optimize = 'X'.
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_program = 'ZALV_DS'
          is_layout          = st_layout
          i_save             = 'A'
          it_fieldcat        = t_fcat
          it_events          = t_eve
        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.
    ENDFORM.                    "display_data
    Please reward if useful...

  • What is the  difference between list display and grid display in alv report

    Hai genious
    i am a new of the abap, i dont know the alv report, i have a small doubt, can u please tell me  what is the main difference between list display and grid display in alv report
    thanks&regards
    chinnu

    Hi ,
    1. For all practical purposes, they are the same.
    2. Some differences:
    a) from abap coding point of view,
    alv list is done with Function modules,
    alv gris can also be done with FM,
    but can also be done using OO concepts.
    b) Alv grid (using oo concept) requires
    designing the screen layout .
    Hence, in one screen, we can show more
    then one alv grid
    (we cannot show more than
    one alv list on one screen)
    c) ALV grid uses ActiveX controls
    present on the Presentation Server.
    Hence, it consumes More Memory
    on the presentation server.
    d) ALV LIST is Display Only.
    Whereas
    ALV Grid Can Be made EDITABLE for entry purpose.
    e) In alv grid, these options are possible,
    but not in alv list.
    without horizontal lines
    without vertical lines
    without cell merging during sorts
    display total lines above the entries
    I hope it helps.
    Regards,
    Mamta
    Edited by: Mamta Verma on Nov 27, 2008 6:41 AM

Maybe you are looking for