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

Similar Messages

  • Checkbox in alv report

    hi all,
    i am facing one problem regarding checkbox in alv.
    i have to buttons on alv report as 'select all' (to select all) and 'send mail'(as i have to send mail to selected record)
    wat i have done till now is:
    1. when i run the report and cleck on checkboxes the action is reflected in internal table..n i can capture the data.
    2.when i click on select all button all the records get selected and i can capture the data again.
    now the problem :
    when i clcik on "select all" and all the record get selected ..but when i deselect any of those record..the changes in internal table lost i.e. the checkbox field because empty for all the record.....
    PLZ GIVE SOLUTION FOR FUNCTION "REUSE_ALV_GRID_DISPLAY" ONLY...
    now the code:
    ************LAYOUT**************
    DATA: gd_layout TYPE SLIS_LAYOUT_ALV.
      gd_layout-colwidth_optimize = 'X'.
    gd_layout-zebra      = 'X'.
      gd_layout-box_fieldname  = 'CHECKBOX'.
      gd_layout-box_tabname  = 'IT_CONF'.
    ****alv display*************
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
          EXPORTING
            i_grid_title             = 'Detailed List'
            it_fieldcat              = fieldcat
            i_callback_program       = sy-repid
            i_callback_user_command  = 'USER_CMD'
            i_callback_pf_status_set = 'EMAILS'
            IS_LAYOUT                = gd_layout
          TABLES
            t_outtab                 = it_conf
          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.
      endif.
    endform.                    "alv_display
    *&      Form  sush1
          text
         -->RT_EXTAB   text
    FORM emails USING rt_extab TYPE slis_t_extab.
      SET PF-STATUS 'EMAILS'.
    ENDFORM.                    "emails
    *&      Form  user_cmd
          text
         -->P_UCOMM    text
         -->LS_SELFIELDtext
    FORM user_cmd USING p_ucomm LIKE sy-ucomm ls_selfield type slis_selfield.
    IF REF_GRID IS INITIAL.
        CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
          IMPORTING
            E_GRID = REF_GRID.
      ENDIF.
    IF NOT REF_GRID IS INITIAL.
        CALL METHOD REF_GRID->CHECK_CHANGED_DATA.
      ENDIF.
      IF p_ucomm = 'EMAIL'.
        loop at it_conf  where checkbox = 'X'.
    **[[[[[[[U MAY NOT SEE THIS THIS IS FOR MAIL PUPOSE]]]]]]]]]]]]*********
          select single  sachn  telnr  into (tc_name , tc_num ) from t526
          where SACHX = it_conf-zztc
          and werks = it_conf-werks .
      ******find the emil of employee.
           clear : p_0105,p_0105[].
            CALL FUNCTION 'HR_READ_INFOTYPE'
              EXPORTING
                pernr           = it_conf-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 = 10.
            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     = it_conf-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_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 = 10.
            move p_0105-USRID_LONG to email_s.
              endif.
            if email <> ' '.
            perform send_mail using it_conf-ename email email_s tc_name tc_num.
            endif.
            if email_s <> ' '.
            perform send_mail using it_conf-ename email email_s tc_name tc_num.
            endif.
    ****MAIL PART IS OVER*******************************************
        endloop.
    endif.
    *****FOR  "SELECT ALL " BUTTON**************
       IF p_ucomm = 'SELECT'.
       flag = 1.
        loop at it_conf.
          move 'X' to it_conf-checkbox.
          MODIFY IT_CONF.
        endloop.
        ls_selfield-refresh = 'X'.
        endif.

    " Please  see the code  of  myin  in the    'SELECT' & 'DESELECT'.
    case save_ok.
        when 'EXIT'.
          perform exit_program.
        when 'SELECT'.
          perform select_all_entries changing gt_outtab[].
        when 'DESELECT'.
          perform deselect_all_entries changing gt_outtab[].
        when 'RESET'.
          perform reset_selected_entries changing gt_outtab[].
        when 'SWITCH'.
          perform switch_activation changing gt_outtab[].
      endcase.
    form select_all_entries changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      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 pt_outtab 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 pt_outtab from ls_outtab.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    endform.   
    form check_lock using    ps_outtab type gs_outtab
                    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.       
    form deselect_all_entries changing pt_outtab type standard table.
      data: ls_outtab type gs_outtab.
      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 pt_outtab 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 = ' '.
          endif.
          modify pt_outtab from ls_outtab.
        endloop.
        call method g_grid->refresh_table_display.
      endif.
    reward  points if it is usefull ......
    Girish

  • 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

  • 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

  • ACTIONS ON ALV REPORT FOR CHECKBOX?

    hi All,
    i have to display ALVreport with one of the columns has checkbox.whenever user presses any checkbox,in repected row values have to be validated and updated in DataBase.
    My First Doubt is,How can i get the column of checkBoxes in ALV Report.?
    2.How can i add action for that checkBox?
    Regards,
    Ravi.

    Hi Ravi,
    Your requirement can be achieved by creating a custom function in your ALV.
    We create a button in the ALV toolbar with text 'Confirm'. When user clicks on this, a popup screen is called for confirmation. Based on the input we set the flag.
    To accomplish this, When defining the configuration model of the ALV, do the following
    Assume that we get the model of the ALV into lo_list
    lo_list = lo_ref_interfacecontroller->get_model( ).
    DATA:
    * Generate an object for self defined functions
        lo_self_functions          TYPE REF TO if_salv_wd_function_settings,
    * Generate an object for button 'Confirm'
        lo_button_conf          TYPE REF TO cl_salv_wd_fe_button,
    * Set Self-defined functions
    * 'Confirm' Button
      lo_self_functions ?= lo_list.
      lo_self_function = lo_self_functions->create_function( 'CONFIRM' ).
      CREATE OBJECT lo_button_conf.
      CLEAR l_text.
      l_text = 'Confirm'
      lo_button_sel_all->set_text( l_text ).
      lo_button_sel_all->set_image_source( '< Any icon name >' ).
      lo_button_sel_all->set_image_first( 'X' ).
      lo_self_function->set_editor( lo_button_conf ).
    In the methods tab, Create a event handler for ON_FUNCTION event of the ALV.
    ONFUNTION     Event Handler     ON_FUNCTION     ON_FUNCTION     INTERFACECONTROLLER     alv_name
    In the ONFUNCTION method, Do the following.
      DATA:
        l_window                  TYPE REF TO if_wd_window,
        l_componentcontroller_api TYPE REF TO if_wd_component,
        l_window_manager          TYPE REF TO if_wd_window_manager,
        l_api                     TYPE REF TO if_wd_view_controller,
        lt_text                   TYPE string_table,
        l_text_line               TYPE string.
    * Based on the function selected, set the selection
      CASE  r_param->id.
        WHEN 'CONFIRM'.
    * Call the confirmation for popup
      l_api = wd_this->wd_get_api( ).
      l_componentcontroller_api = wd_comp_controller->wd_get_api( ).
      l_window_manager = l_componentcontroller_api->get_window_manager( ).
      CALL METHOD l_window_manager->create_popup_to_confirm
        EXPORTING
          text            = lt_text
          button_kind     = if_wd_window=>co_buttons_yesno
          message_type    = if_wd_window=>co_msg_type_question
          window_position = if_wd_window=>co_center
        RECEIVING
          result          = l_window.
      CALL METHOD l_window->subscribe_to_button_event
        EXPORTING
          button            = if_wd_window=>co_button_yes
          action_name       = 'YES'
          action_view       = l_api
          is_default_button = abap_false.
      CALL METHOD l_window->subscribe_to_button_event
         EXPORTING
           button            = if_wd_window=>co_button_no
           action_name       = 'NO'
           action_view       = l_api
           is_default_button = abap_false.
      l_window->open( ).
      ENDCASE.
    Create 2 actions with names YES and NO ( As mentioned in the subscription.
    In these actions, bases on the inputs, set the flag to a context attribute and update the same in the table you wanted.
    Hope this is what you want.
    Regards,
    Sravan Varagani.

  • RE: Use of checkbox in ALV

    Hi All,
    Please provide a solution. how to use checkboxes in ALV report.
    •     “Include Blocked A ” checkbox – default is unchecked –
    THEN the report data should include all A flagged for Block (as well as all active A )
    •     “Include Deleted A ” checkbox – default is unchecked –
    Then the report data should include all  A flagged for deletion (as well as all active A )
    •     “Include Deactivated A ” checkbox – default is unchecked –
    Then the report data should include all A  flagged for deactivated on
    •     “Include Disposed/Retired A” checkbox – default is unchecked –
    When checked
    •      “Include A without values” checkbox – default is unchecked
    When checked
    Then also include A Master Records without an A Value Date.

    Check below code for Dynamic selection screen as per radio buttons
    TABLES: ekpo, resb, ltak.
    PARAMETER : p_res RADIOBUTTON GROUP rb1 DEFAULT 'X'  USER-COMMAND ucom,
                p_sto    RADIOBUTTON GROUP rb1.
    SELECT-OPTIONS :
               s_rwerks FOR ekpo-werks NO INTERVALS NO-EXTENSION MODIF ID s,
               s_wempf  FOR resb-wempf NO INTERVALS NO-EXTENSION MODIF ID r,
               s_deldt  FOR resb-bdter NO-EXTENSION DEFAULT sy-datum,
               s_tanum  FOR ltak-tanum NO-EXTENSION MODIF ID s,
               s_bdatu  FOR ltak-bdatu NO-EXTENSION MODIF ID r.
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        IF p_sto = 'X'.
          IF screen-group1 = 'R'.
            screen-input  = 0.
            MODIFY SCREEN.
            CONTINUE.
          ENDIF.
        ENDIF.
        IF p_res = 'X'.
          IF screen-group1 = 'S'.
            screen-input  = 0.
            MODIFY SCREEN.
            CONTINUE.
          ENDIF.
        ENDIF.
      ENDLOOP.
    I think this will solve your problem....
    Rewards if helpful...
    Regards,
    Minal

  • Functionality of Checkbox in ALV Grid Report

    Hi Experts,
    I created a ALV grid report with the checkbox as my first coloum and other fields as shown below. Initially, my ALV report displays as below. It is working fine till here.
    checkbox       customer     material      quantity       UOM         Sales Order    Delivery
                           C1                  M1           1                  KG
                           C1                   M2           2                  KG
                            C2                   M1          1                   KG
                            C2                  M2           2                   KG
                           C3                   M1          1                   KG
                           C3                   M2          2                   KG
                           C3                   M3           3                 KG
                            C4                  M1           1                  KG
                           C5                   M5           1                  KG
    I have created a push button on application toolbar for creating sales order and delivery using bapi's. When I click on my pushbutton, as of now it creates the SO and delivery for the first customer C1 and updates my Internal table with the sales order number and delivery number. If I need to create sales order for the second customer I need to run my ALV report again and so on for 3rd, 4th and 5th customers. It is also working fine till here.
    checkbox       customer     material      quantity       UOM     Sales Order     Delivery
                           C1                  M1           1                  KG          SO1               DEL1
                           C1                   M2           2                  KG         SO1               DEL1
                            C2                   M1          1                   KG
                            C2                  M2           2                   KG
                           C3                   M1          1                   KG
                           C3                   M2          2                   KG
                           C3                   M3           3                 KG
                            C4                  M1           1                  KG
                           C5                   M5           1                  KG
    Need help on this:
    When I select the check boxes as shown below and when I click the push button to create SO and Delivery then my program should create sales order and delivery for all the checked ones as shown below. What is the condition do I need to put here for selecting the checkbox.
    checkbox       customer     material      quantity       UOM     Sales Order     Delivery
    X                      C1                  M1           1                  KG         SO1               DEL1
    X                     C1                   M2           2                  KG         SO1               DEL1
                            C2                   M1          1                   KG
                            C2                  M2           2                   KG
    X                     C3                   M1          1                   KG        SO3             DEL3
    X                     C3                   M2          2                   KG        SO3             DEL3
    X                     C3                   M3           3                 KG          SO3            DEL3
                            C4                  M1           1                  KG
    X                     C5                   M5           1                  KG          SO5            DEL5
    I would really appreciate if somebody could help me / guide me on this. I will also post my code if someone needs to understand what I am doing exactly.
    Thanks.

    You need to use OO ABAP
    Use Class the class  1)  CL_GUI_ALV_GRID, 2) CL_GUI_CUSTOM_CONTAINER
    Create Sceen and container on same screen.
    Check following COde it used for printing purpose.
    Using AFTER_USER_COMMAND  Event you will find Check box selected entries.
    Capture those in another internal Table and use it for SO Creation
    DATA:  O_GRID TYPE REF TO CL_GUI_ALV_GRID,
           O_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
           T_FCAT TYPE LVC_T_FCAT,
           CONTAINER(15) TYPE C VALUE 'ET_CONTAINER'.
          CLASS EVENT_CLASS DEFINITION
    CLASS EVENT_CLASS DEFINITION.
      PUBLIC SECTION.
        METHODS: BEFORE_COMMAND FOR EVENT AFTER_USER_COMMAND OF CL_GUI_ALV_GRID IMPORTING E_UCOMM,
                 DOUBLE_CLICK_N  FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID IMPORTING E_ROW E_COLUMN,
                 TOOLBAR FOR EVENT TOOLBAR OF CL_GUI_ALV_GRID IMPORTING E_OBJECT.
    ENDCLASS.                    "EVENT_CLASS DEFINITION
          CLASS EVENT_CLASS IMPLEMENTATION
    CLASS EVENT_CLASS IMPLEMENTATION.
      METHOD BEFORE_COMMAND.
        IF E_UCOMM = 'PRINT'.
          CLEAR : W_FLAG.
          T_FINAL2 = T_FINAL.
          SORT T_FINAL2 BY COL_CHK .
          DELETE   T_FINAL2 WHERE COL_CHK = ' '.
          IF NOT T_FINAL2 IS INITIAL.
            LOOP AT T_FINAL2 INTO WA_FINAL.
              IF W_FLAG IS INITIAL.
      Does some of modification/s in control parameters
                W_CONTROL_PARAM-NO_OPEN   = 'X'.
                W_CONTROL_PARAM-NO_CLOSE  = 'X'.
                W_CONTROL_PARAM-PREVIEW   = 'X'.
                W_CONTROL_PARAM-NO_DIALOG = SPACE.
                W_OUTPUT_OPTIONS-TDNEWID = 'X'.
                W_OUTPUT_OPTIONS-TDIMMED = SPACE.
      Opens the smartform print-job
                CALL FUNCTION 'SSF_OPEN'
                  EXPORTING
                    OUTPUT_OPTIONS     = W_OUTPUT_OPTIONS
                    CONTROL_PARAMETERS = W_CONTROL_PARAM
                  EXCEPTIONS
                    FORMATTING_ERROR   = 1
                    INTERNAL_ERROR     = 2
                    SEND_ERROR         = 3
                    USER_CANCELED      = 4
                    OTHERS             = 5.
                IF SY-SUBRC EQ 0.
                  W_FLAG = 'X'.
                ELSE.
                 LEAVE LIST-PROCESSING.
                ENDIF.
              ENDIF.
              IF W_FLAG = 'X'.
                CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'
                  EXPORTING
                    FORMNAME           = 'ZFORM_BIW_PRINT'
                  IMPORTING
                    FM_NAME            = LF_FM_NAME
                  EXCEPTIONS
                    NO_FORM            = 1
                    NO_FUNCTION_MODULE = 2
                    OTHERS             = 3.
                IF SY-SUBRC <> 0.
                ENDIF.
                IF SY-SUBRC = 0.
                  CALL FUNCTION LF_FM_NAME
                    EXPORTING
                      CONTROL_PARAMETERS = W_CONTROL_PARAM
                     V_VBELN            = WA_FINAL-VBELN
                      WA_FINAL           = WA_FINAL.
                   TABLES
                     T_FINAL            = T_FINAL.
                ELSE.
                  MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                          WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
                ENDIF.
              ENDIF.
            ENDLOOP.
           * Close the smartform print job
            IF W_FLAG EQ 'X'.
              CALL FUNCTION 'SSF_CLOSE'
                EXCEPTIONS
                  FORMATTING_ERROR = 1
                  INTERNAL_ERROR   = 2
                  SEND_ERROR       = 3
                  OTHERS           = 4.
            ENDIF.
          ENDIF.
        ENDIF.
      ENDMETHOD.                    "BEFORE_COMMAND

  • ALV Report Output Checkbox

    Hi,
    I'm developing an ALV Report. The output of the report contains a checkbox for each row. There are 2 buttons in the Application bar namely 'Select-ALL' and 'DeSelect-ALL'. The requirement is when I click either of the button it should select or deselect all the checkbox. The problem is when i click either the button first time its not working but when i click for second time its working. Basically It needs 2 clicks for the operation. Can anybody suggest a solution how to make work of the program at the first clck itself.
    Thanks,
    Kaarthick

    Since your program is working in debugging mode, It might be some problem pertaining to some time delay or lag, or a refresh problem.
    So save your code once again activate it and shut down your saplogon and after couple of minutes log in again.
    I faced a similar problem, it was working in debugging and not when executed directly, it was some lag problem only.

  • How to make checkbox field inactive in the output of ALV report.

    Dear All,
    I am having one ALV report in whose output there are checkboxes against each record. Example: the output columns of my ALV report are:
    Checkbox, Sales Document No, Billing Document No.
    Now, my requirement is that if for the Sales Document No there exists any Billing Document No in the output then the Checkbox should be inactive but if the Billing document coloumn is empty for a particular Sales Document No then only the Checkbox field should become active.
    Kindly guide me on how to make this checkbox field inactive.
    Waiting for your reply.
    Warm Regards,
    N.Jain

    Hello,
    Follow the below steps:
    1.Define as--> GS_STATUS TYPE SLIS_STATUS,
    2.check layout check box fieldname is not initial.
          then set the status according to your logical conditions
          GS_STATUS-FLG_CHECKBOXES_ACTIVE = 'X'
    Hope this would help you.
    Let me know your feedback.
    Regards,
    Raju

  • 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.

  • Urgent: about the checkbox in OOP ALV report

    Hi Experts,
    I had use OOP method to display my ALV report. In the report I have a checkbox for each line. I had set this check box use below statements:
        gt_fieldcat_record-tabname = 'GT_ISSUE_INT'.
        gt_fieldcat_record-fieldname = 'CHECKBOX'.
        gt_fieldcat_record-checkbox = 'X'.
        gt_fieldcat_record-edit = 'X'.
        APPEND gt_fieldcat_record.
    When I press the save button, then I will save the lines to my Z-table which its GT_ISSUE_INT-CHECKBOX = 'X'.
    Now I click the checkbox to select several lines in my ALV report and then press save, but it do not work. Then I check the internal table GT_ISSUE_INT in debugger, I found the GT_ISSUE_INT-CHECKBOX = ' '. Above statements is not correct for the checkbox?? Or I need additional statements to move 'X' to GT_ISSUE_INT-CHECKBOX?? Please help!!!Thanks.

    Hi,
    If u want to read check box status from list, need to call function module explicitly.
    see the sample code:
    case sy-ucomm.
    when 'SAVE'.
    Data ref1 type ref to cl_gui_alv_grid.
          CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
            IMPORTING
               E_GRID = ref1.
           call method ref1->check_changed_data.
    loop at GT_ISSUE_INT to workarea.
    ____ continue writing ur code.
    function module read the data from list . and save the changes that made on list.
    when u debug, u can see the check box status as 'X' after exucut\ing this fm and method.
    reward if helpful.
    regards,
    swapna

  • 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

Maybe you are looking for

  • Problem with flash components in director  tollbox

    1- I have 2 buttons named "makeQst1BT" in frame 1 and  "chkQst1BT" in frame 2,  which both are draged from toolbox. First the user gets a random question in frame 2 andhas to answer it, When the user clicks "chkQst1BT" its visible is to disappear aft

  • My iPad mini is dead and won't charge!!!!

    My iPad mini was nearly dead, so I plugged it in. However, it didn't say it was charging. And now it's completely dead. I've tried using a different charger and switching wall sockets, but nothing will work. It won't turn on it just has the symbol te

  • My laptop network autoprobe

    autonetwork.sh #!/bin/sh if [ `id -u` -ne 0 ]; then exit 1; fi PROFILE_DIR="/etc/network-profiles" STATE_DIR="/var/run/net" if [ "$(ls $PROFILE_DIR 2>/dev/null | grep -v ^template$)" = "" -o ! -d $PROFILE_DIR ]; then echo "No profiles found. Add prof

  • Firefox doesn't display xmlns attribute?

    e.g xml <root xmlns="www.myurl.com"> <child xmlns="">this is child</child> </root>

  • 2 iPods...1 CPU...1 External Hard Drive

    My wife and I have each have our own iPods. We both use iTunes and we both purchase music and save it to the same location (an external hard drive). My question is why is it when my wife logs in and she opens up her iTunes that she does not have any