Click checkbox on alv grid

hi all,
Is there any way to handle the single click/tick on checkbox. Is there user command on that? For now, if we will click on the checkbox, the changes made on it does not reflect. I checked on the debugging mode, checkbox is not populated/ marked even if it was ticked by the user.
thanks in advance.

Hi Akira,
For Controling  Check Box , you have to use grid display using customised  Container screen.
From there you can control check Box .
CREATE OBJECT custom_container
     EXPORTING container_name = o_container.
  CREATE OBJECT o_grid
           EXPORTING i_parent = custom_container.
Form for building the fieldcatalog
  PERFORM build_fieldcat CHANGING it_fieldcat.
Form for excluding the unwanted functionalities from the toolbar.
  PERFORM exclude_tb_functions CHANGING it_exclude.
Method for displaying the ALV grid.
  CALL METHOD o_grid->set_table_for_first_display
    EXPORTING
      is_layout            = it_layout
      it_toolbar_excluding = it_exclude
    CHANGING
      it_fieldcatalog      = it_fieldcat
      it_outtab            = it_final.
  CREATE OBJECT o_event_receiver.
Setting the event handlers for events toolbar, usercommand and datachange.
  SET HANDLER o_event_receiver->catch_toolbar FOR o_grid.
  SET HANDLER o_event_receiver->catch_user_command FOR o_grid.
  SET HANDLER o_event_receiver->catch_datachange FOR o_grid.
Set editable cells to ready for input.
  CALL METHOD o_grid->set_ready_for_input
    EXPORTING
      i_ready_for_input = 1.

Similar Messages

  • Problems with checkbox in ALV-GRID OO

    Hi,
    i have Problems by listing an editable checkbox
    in ALV GRID OO and handle the itab with
    the marked fields.
    Here my Code extract. Has anybody an idea or a short example.
    TYPES: BEGIN OF ALV_TAB,
            SGTXT  LIKE RK23B-SGTXT,
            CHECK(1),
          END   OF ALV_TAB.
    DATA: ITAB    TYPE TABLE OF ALV_TAB.
    Is this Declaration correct??
    <b>  GS_FIELDCAT-FIELDNAME  = 'CHECK'.
      GS_FIELDCAT-CHECKBOX   = 'X'.
      APPEND GS_FIELDCAT TO GT_FIELDCAT.
      GS_LAYOUT-EDIT         = 'X'.
      GS_LAYOUT-BOX_FNAME    = 'CHECK'.</b>
      CALL METHOD GR_ALVGRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          IT_TOOLBAR_EXCLUDING = PT_EXCLUDE
          IS_LAYOUT            = GS_LAYOUT
        CHANGING
          IT_FIELDCATALOG      = GT_FIELDCAT
          IT_OUTTAB            = ITAB.
    FORM HANDLE_USER_COMMAND USING E_UCOMM.
      CASE E_UCOMM.
        WHEN 'REFR'.
    <b>      Here i will have the itab with the marked checkbox.
          how can i refresh?</b>*
        WHEN 'EXCEL'.
          MESSAGE I010 WITH E_UCOMM.
      ENDCASE.
    ENDFORM.                    "HANDLE_USER_COMMAND
    Regards, Dieter

    Hi, in reference to....
    ASE E_UCOMM.
    WHEN 'REFR'.
    Here i will have the itab with the marked checkbox.
    how can i refresh?*
    Do you want to get rid of the checks in any checkbox?
    If so,  just loop at modify.
    ASE E_UCOMM.
    WHEN 'REFR'.
    <b>   Loop at itab where check = 'X'.
            itab-check = space.
            modify itab.
       endloop.</b>
    Regards,
    Rich Heilman

  • User command for checkbox in alv grid output

    Hi,
    Does anyone knows the user command for checkbox in alv grid display. My requirement is to have a column for checkbox in alv output. When the user checks the checkbox, a pop-up dialog box will appear. This dialog box was created in screen painter. I can't find the user command for this. Please help.
    Thanks in advance.

    Hi,
    there r two ways for creating checkbox col on the ALV grid.
    1.)  take an extra field in your internal table i.e 
    data:
       checkbox type c.
    loop at internal_table into wa.
    checkbox.
    endloop.
    or
    the fieldcatalog attribute
    2.) wa_fcat-checkbox = 'X'.
    append wa_fcat to t_fcat.
    clear wa_fcat.
    if itab-checkbox = 'X'.
    call screen <dialogbox screen number>.
    endif.
    regards
    ravi

  • Handling Right & Left Click Events in ALV Grid

    Hi Friends,
    Please give me the idea how to handle Right & Left mouse Click Events in ALV Grid.
    My requirement is that when i click on the grid i need to pop up a message.
    Eagerly waiting for your replies
    Thanks
    Satish

    you have to Define a class and implement event handler methods for this purpose.
    and the following events can help.
    LEFT_CLICK_DESIGN
    LEFT_CLICK_RUN
    Regards
    Raja

  • Single click event in alv grid.

    Hi Experts,
    i have done will my code..everything is working perfectly, but having an issue..pls help me...
    in my output screen i have 2 check-boxes,when i select both of them i shuld get a message saying select only one..this is done when am using double click. Is single click possible in alv-grid...
    please help me.
    thanks.
    anusha

    Hi Anusha,
    Did you Try by using get_selected_rows(Method)?
    If the selected rows are 2 display a message such that 'Select only One record'.
    data t_roid type lvc_t_roid.
    CALL METHOD r_grid->get_selected_rows
            IMPORTING
              et_row_no = t_roid.
    READ TABLE t_roid INDEX 1 TRANSPORTING NO FIELDS."to know how many No.Of records selected
    if sy-tfill > 1.
    Message 'Please Select only one record' type 'I'.
    Exit.
    endif.

  • Set editable/non-editable checkbox in alv grid

    Hi all,
    How to set a checkbox in alv grid in editable/non-editable. i am using alv gird display function module for this. i tried to used method  cl_gui_alv_grid=>mc_style_disabled. but its not working. is it possible to have this functionality in grid? please help. thanks in advance.

    Hi,
    Try like this.
    CALL METHOD gr_alvgrid->set_table_for_first_display
    EXPORTING
    I_BUFFER_ACTIVE =
    I_CONSISTENCY_CHECK =
    I_STRUCTURE_NAME =
    IS_VARIANT =
    I_SAVE =
    I_DEFAULT = 'X'
    is_layout = gs_layout
    IS_PRINT =
    IT_SPECIAL_GROUPS =
    IT_TOOLBAR_EXCLUDING =
    IT_HYPERLINK =
    CHANGING
    it_outtab = gt_list[]
    it_fieldcatalog = gt_fieldcat
    IT_SORT =
    IT_FILTER =
    EXCEPTIONS
    invalid_parameter_combination = 1
    program_error = 2
    too_many_lines = 3
    OTHERS = 4
    regards
    Rajesh kumar

  • How to Set Checkbox of ALV Grid Dark on Display Mode

        ABAP experts, I want to switch between display mode and edit mode for some columns of ALV Grid. So I set "LVC_S_FCAT-EDIT" "X" for the columns which need to switch mode, and use method "SET_READY_FOR_INPUT" to switch.
        Currently, the function of switch mode has been achieved. But icons of checkbox columns are light but not dark when display mode, although the columns can't be edited. (Please refer to the image below.) I want to make checkbox columns dark as other columns on display mode.
        I tried to use "CL_GUI_ALV_GRID=>MC_STYLE_ENABLED" and "CL_GUI_ALV_GRID=>MC_STYLE_DISABLED", but failed. I also studied sample program "BCALV_EDIT_05" which is related to checkbox in ALV Grid, and compared my program with this program. But I still have not found problems.
        Help me solve this problem, please.
        Part of my codes are as follows.
        Part 1:
    IF iv_is_create_group = abap_true OR iv_is_edit_group = abap_true.
           set_enable( iv_flag = 1 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             CLEAR ls_celltab.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_enabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_enabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ELSE.
           set_enable( iv_flag = 0 ).
           LOOP AT gt_acct_group_item ASSIGNING <lfs_acct_group_item>.
             IF <lfs_acct_group_item>-celltab IS INITIAL.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'CHECK_BOX'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
               CLEAR ls_celltab.
               ls_celltab-fieldname = 'XPORE'.
               ls_celltab-style = cl_gui_alv_grid=>mc_style_disabled.
               APPEND ls_celltab TO <lfs_acct_group_item>-celltab.
             ELSE.
               LOOP AT <lfs_acct_group_item>-celltab ASSIGNING <lfs_celltab>.
                 <lfs_celltab>-style = cl_gui_alv_grid=>mc_style_disabled.
               ENDLOOP.
             ENDIF.
           ENDLOOP.
         ENDIF.
         CALL METHOD gr_grid->refresh_table_display
    *      EXPORTING
    *        is_stable      =
    *        i_soft_refresh =
           EXCEPTIONS
             finished       = 1
             OTHERS         = 2
         IF sy-subrc <> 0.
    *     Implement suitable error handling here
         ENDIF.
        Part 2:
    METHOD set_enable.
         gr_grid->set_ready_for_input(
             i_ready_for_input = iv_flag
    ENDMETHOD.

    Hi Liu,
        Please go through the below code.
    *& Report  YEDIT_DISPLAY
    REPORT  YEDIT_DISPLAY.
    TABLES : VBAK.
    TYPE-POOLS SLIS.
    TYPES : BEGIN OF TY_VBAK,
              VBELN TYPE VBAK-VBELN,
             END OF TY_VBAK,
             BEGIN OF TY_FINAL,
               BOX TYPE C,
               VBELN TYPE VBAK-VBELN,
             END OF TY_FINAL.
    DATA : IT_VBAK TYPE TABLE OF TY_VBAK,
            WA_VBAK TYPE TY_VBAK,
            IT_FINAL TYPE TABLE OF TY_FINAL,
            WA_FINAL TYPE TY_FINAL,
            IT_FCAT TYPE TABLE OF SLIS_FIELDCAT_ALV,
            WA_FCAT TYPE SLIS_FIELDCAT_ALV.
    START-OF-SELECTION.
       PERFORM FETCH_DATA.
       PERFORM FCAT_DATA.
       PERFORM DISPLAY.
    *&      Form  FETCH_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FETCH_DATA .
       SELECT VBELN INTO TABLE IT_VBAK FROM VBAK UP TO 10 ROWS.
       LOOP AT IT_VBAK INTO WA_VBAK.
         WA_FINAL-VBELN = WA_VBAK-VBELN.
         APPEND WA_FINAL TO IT_FINAL.
         CLEAR : WA_FINAL , WA_VBAK.
       ENDLOOP.
    ENDFORM.                    " FETCH_DATA
    *&      Form  FCAT_DATA
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FCAT_DATA .
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
       WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FCAT_DATA
    *&      Form  DISPLAY
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY .
       CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = SY-REPID
    *   I_CALLBACK_PF_STATUS_SET          = ' '
        I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY
    FORM USER_COMMAND USING UCOMM TYPE SY-UCOMM
                             RTAB TYPE slis_selfield.
       CASE UCOMM.
         WHEN '&IC1'.
           MESSAGE 'SUCESSFUL' TYPE 'S'.
         WHEN '&DATA_SAVE'.
           PERFORM FIL_FCAT.
           PERFORM DISPLAY1.
         WHEN 'BACK'.
           LEAVE TO SCREEN 0.
         WHEN OTHERS.
           LEAVE TO SCREEN 0.
       ENDCASE.
    ENDFORM.
    *&      Form  FIL_FCAT
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM FIL_FCAT .
    CLEAR IT_FCAT.
       WA_FCAT-COL_POS = 1.
       WA_FCAT-FIELDNAME = 'BOX'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'BOX'.
       wa_fcat-checkbox = 'X'.
    **  WA_FCAT-EDIT = 'X'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
       WA_FCAT-COL_POS = 2.
       WA_FCAT-FIELDNAME = 'VBELN'.
       WA_FCAT-TABNAME = 'IT_FINAL'.
       WA_FCAT-OUTPUTLEN = '3'.
       WA_FCAT-SELTEXT_M = 'Sales Document'.
       APPEND WA_FCAT TO IT_FCAT.
       CLEAR WA_FCAT.
    ENDFORM.                    " FIL_FCAT
    *&      Form  DISPLAY1
    *       text
    *  -->  p1        text
    *  <--  p2        text
    FORM DISPLAY1 .
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
    *   I_INTERFACE_CHECK                 = ' '
    *   I_BYPASSING_BUFFER                = ' '
    *   I_BUFFER_ACTIVE                   = ' '
          I_CALLBACK_PROGRAM                = SY-REPID
    *   I_CALLBACK_TOP_OF_PAGE            = ' '
          IT_FIELDCAT                       = IT_FCAT
    *   I_DEFAULT                         = 'X'
    *   I_SAVE                            = ' '
         TABLES
           T_OUTTAB                          = IT_FINAL
    * EXCEPTIONS
    *   PROGRAM_ERROR                     = 1
    *   OTHERS                            = 2
       IF SY-SUBRC <> 0.
    * Implement suitable error handling here
       ENDIF.
    ENDFORM.                    " DISPLAY1
    Here i written code under the SAVE button , if requires you create your own status and apply.
    Regards,
    Krishna

  • 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

  • Handling checkboxes in ALV Grid.

    Hi  guys.
    I have displayed an ALV grid with checkboxes. I want to opearate on the selected checkboxes by the user by clicking on a added button.
    I am using oops and using function set_table_for_first_display.
    if no box is selected the function works properly. If i select a checkbox, i get a dump.
    Thanks

    Hi arun
    here is the required code.
    <b>Form to register events</b>
    FORM register_events .
      CREATE OBJECT gr_event_handler .
      SET HANDLER gr_event_handler->handle_toolbar FOR gr_alvgrid .
      SET HANDLER gr_event_handler->handle_user_command FOR gr_alvgrid.
      SET HANDLER gr_event_handler->handle_hotspot_click FOR gr_alvgrid.
      SET HANDLER gr_event_handler->handle_double_click FOR gr_alvgrid.
    ENDFORM. 
    <b>Class Defination and implementation</b>
    CLASS LCL_EVENT_HANDLER DEFINITION.
        PUBLIC SECTION .
          METHODS:
    *To add new functional buttons to the ALV toolbar
          handle_toolbar FOR EVENT toolbar OF cl_gui_alv_grid
          IMPORTING e_object e_interactive,
    *To implement user commands.
          handle_user_command
          FOR EVENT user_command OF cl_gui_alv_grid
          IMPORTING e_ucomm,
       To handle hotspot click.
          handle_hotspot_click
          FOR EVENT hotspot_click OF cl_gui_alv_grid
          IMPORTING e_row_id e_column_id es_row_no,
         To handle Double Click
          handle_double_click
          FOR EVENT double_click OF cl_gui_alv_grid
          IMPORTING e_row e_column .
      ENDCLASS.                    "LCL_EVENT_HANDLER DEFINITION
    *&       Class (Implementation)  lcl_event_handler
           Text
      CLASS lcl_event_handler IMPLEMENTATION.
        METHOD handle_toolbar.
          PERFORM handle_toolbar USING e_object.
        ENDMETHOD .                    "handle_toolbar
        METHOD handle_user_command.
          perform handler_user_command using e_ucomm .
        ENDMETHOD.                    "handle_user_command
        METHOD handle_hotspot_click .
          PERFORM handle_hotspot_click USING e_row_id e_column_id es_row_no .
        ENDMETHOD .                    "handle_hotspot_click
        METHOD handle_double_click .
          PERFORM handle_double_click USING e_row e_column .
        ENDMETHOD .                    "handle_hotspot_click
      ENDCLASS.            "lcl_event_handler
    <b>
    PBO of screen that is called after the pushbutton is pressed.</b>
    MODULE STATUS_9400 OUTPUT.
      SET PF-STATUS 'SCREEN9400'.
      perform diaply_checkbox.
    <b>and the method display_checkbox.</b>
    FORM diaply_checkbox .
      data: count type i.
      count = 0.
      loop at za004_t_t into wa_a004_t_t.
        if wa_a004_t_t-checkboc = 'X'.
          count = count + 1.
        endif.
          count = count + 1.
      endloop.
    ENDFORM.                    " diaply_checkbox
    thanks
    Abhinav Dhasmana

  • How can I use hotspot click in an ALV grid?

    Hello,
    I have a table that is displayed in an ALV grid and I would like to have one of the columns as clickable icons.
    For example:
    Print  |  Doc. Type | Name
    (icon) |   .docx      | first
    (icon) |   .pdf         | second ... and so on.
    I would like to click in the icon (Print column) and execute an action, but no matter what I do I can't set the action.
    I know that is not just setting "fieldcatalog-hotspot='X'", but I don't know how to use a hotspot handler.
    Here's some of the code I have:
    TYPES: BEGIN OF ty_docs,
                        print LIKE ICON-ID,
                        doc_type LIKE table_doc-TYPE,
                        name LIKE table_doc-NAME,
                 END OF ty_docs.
    DATA:  oref_dock TYPE REF TO cl_gui_docking_container,
                oref_alv TYPE REF TO cl_gui_alv_grid,
                i_fieldcat TYPE lvc_t_fcat,
                aux_fieldcat TYPE lvc_s_fcat,
                aux_lay TYPE lvc_s_layo,
                i_exclude TYPE TABLE OF syucomm,
                i_docs TYPE ty_docs,
                t_docs LIKE TABLE OF i_docs.
    AT SELECTION-SCREEN OUTPUT.
       APPEND 'ONLI' TO i_exclude.
       APPEND 'SJOB' TO i_exclude.
       APPEND 'PRIN' TO i_exclude.
       CALL FUNCTION 'RS_SET_SELSCREEN_STATUS'
         EXPORTING
           p_status = sy-pfkey
           p_program = sy-repid
         TABLES
           p_exclude = i_exclude.
    AT SELECTION-SCREEN.
       CHECK sy-ucomm = space.
         SELECT
               icon~ID AS print
               doc~TYPE AS doc_type
               doc~NAME as name
                 INTO CORRESPONDING FIELDS OF TABLE t_docs
                 FROM table_doc AS doc
                      INNER JOIN ICON AS icon    
                        ON icon~NAME EQ 'ICON_PRINT'
                 GROUP BY icon~ID doc~TYPE doc~NAME.
       IF sy-subrc = 0.
         IF oref_dock IS NOT BOUND.
           CREATE OBJECT oref_dock
              EXPORTING
                repid = sy-repid
                dynnr = sy-dynnr
                side = cl_gui_docking_container=>dock_at_bottom
                ratio = 90
             EXCEPTIONS
               OTHERS = 1.
         ENDIF.
         IF oref_alv IS NOT BOUND.
           CHECK oref_dock IS BOUND.
           CREATE OBJECT oref_alv
             EXPORTING
               i_parent = oref_dock
             EXCEPTIONS
               OTHERS = 1.
           CHECK oref_alv IS BOUND.
           aux_fieldcat-fieldname = 'PRINT'.
           aux_fieldcat-coltext = 'Print'.
           aux_fieldcat-ref_table = 't_docs'.
           aux_fieldcat-ref_field = 't_docs-print'.
           aux_fieldcat-edit = ''.
           aux_fieldcat-just = 'C'.
           aux_fieldcat-hotspot = 'X'.
           aux_fieldcat-outputlen = 10.
           aux_fieldcat-col_pos = 0.
           APPEND aux_fieldcat TO i_fieldcat.
           CLEAR aux_fieldcat.
           aux_fieldcat-fieldname = 'TYPE'.
           aux_fieldcat-coltext = 'Doc. Type'.
           aux_fieldcat-ref_table = 't_docs'.
           aux_fieldcat-ref_field = 't_docs-doc_type'.
           aux_fieldcat-edit = ''.
           aux_fieldcat-outputlen = 15.
           aux_fieldcat-col_pos = 1.
           APPEND aux_fieldcat TO i_fieldcat.
           CLEAR aux_fieldcat.
           aux_fieldcat-fieldname = 'NAME'.
           aux_fieldcat-coltext = 'Name'.
           aux_fieldcat-ref_table = 't_docs'.
           aux_fieldcat-ref_field = 't_docs-name'.
           aux_fieldcat-edit = ''.
           aux_fieldcat-outputlen = 12.
           aux_fieldcat-col_pos = 2.
           APPEND aux_fieldcat TO i_fieldcat.
           CLEAR aux_fieldcat.
           aux_lay-grid_title = 'Docs'.
           aux_lay-edit = ''.
           CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
             EXPORTING
              i_structure_name = 'ty_docs'
              i_internal_tabname = 't_docs'
            CHANGING
              ct_fieldcat = i_fieldcat
           EXCEPTIONS
             OTHERS = 3.
           CALL METHOD oref_alv->set_table_for_first_display
             EXPORTING
               i_structure_name = 'ty_docs'
               is_layout = aux_lay
             CHANGING
               it_fieldcatalog = i_fieldcat
               it_outtab = t_docs
             EXCEPTIONS
               OTHERS = 1.
         ELSE.
           CALL METHOD oref_alv->refresh_table_display
             EXCEPTIONS
               OTHERS = 1.
         ENDIF.
      ENDIF.
    Thank you so much in advance!

    Hi,
    After creating grid set the even handler for hot spot.
    SET HANDLER lcl_event_receiver=>handle_hotspot_click FOR alv_grid.
    Try this code:
    TABLES: mara,t001l.
    DATA: BEGIN OF i_alv OCCURS 0,
           matnr TYPE mara-matnr,
           mtart TYPE mara-mtart,
           matkl TYPE mara-matkl,
           groes TYPE mara-groes,
           maktx TYPE makt-maktx,
           END OF i_alv.
    DATA: wa_alv  LIKE LINE OF i_alv.
    DATA: alv_container  TYPE REF TO cl_gui_docking_container.
    DATA: alv_grid       TYPE REF TO cl_gui_alv_grid.
    DATA: layout    TYPE lvc_s_layo.
    DATA: fieldcat  TYPE lvc_t_fcat.
    DATA: gt_t001l TYPE STANDARD TABLE OF t001l.
    CLASS lcl_event_receiver DEFINITION.
       PUBLIC SECTION.
    *-->Method for User command
         CLASS-METHODS :
         handle_hotspot_click FOR EVENT hotspot_click    OF
                                               cl_gui_alv_grid
                                     IMPORTING E_ROW_ID e_column_id.
    ENDCLASS.                    "lcl_event_receiver DEFINITION
    *       CLASS lcl_event_receiver IMPLEMENTATION
    CLASS  lcl_event_receiver IMPLEMENTATION.
       METHOD handle_hotspot_click.
         READ TABLE i_alv INTO wa_alv
          INDEX e_row_id-index
           TRANSPORTING matnr.
         SET PARAMETER ID 'MAT' FIELD wa_alv-matnr.
         CALL TRANSACTION 'MM03' AND SKIP FIRST SCREEN.
       ENDMETHOD.                    "handle_double_click
    ENDCLASS.                    "lcl_event_receiver IMPLEMENTATION
    PARAMETERS: p_check TYPE matnr.
    INITIALIZATION.
    PERFORM get_data.
    AT SELECTION-SCREEN OUTPUT.
    *  START-OF-SELECTION.
       DATA: variant TYPE  disvariant.
       DATA: repid TYPE sy-repid.
       repid = sy-repid.
       variant-report = sy-repid.
       variant-username = sy-uname.
       layout-zebra = 'X'.
       layout-edit_mode = 'X'.
       CHECK alv_container IS INITIAL.
       CREATE OBJECT alv_container
                   EXPORTING repid     = repid
                             dynnr     = sy-dynnr
                             side      = alv_container->dock_at_right
                             extension = 350.
       CREATE OBJECT alv_grid
              EXPORTING
                    i_parent          =  alv_container.
    * Set event handler
       SET HANDLER lcl_event_receiver=>handle_hotspot_click FOR alv_grid.
    *  ALV Specific. Data selection.
    *  Populate Field Catalog
       PERFORM get_fieldcatalog.
       CALL METHOD alv_grid->set_table_for_first_display
         EXPORTING
           is_layout        = layout
           is_variant       = variant
           i_save           = 'U'
           i_structure_name = 'I_ALV'
         CHANGING
           it_outtab        = i_alv[]
           it_fieldcatalog  = fieldcat[].
    START-OF-SELECTION.
    * FORM GET_DATA
    FORM get_data.
       SELECT * INTO CORRESPONDING FIELDS OF TABLE i_alv
             FROM mara
               INNER JOIN makt
                 ON mara~matnr = makt~matnr
                        UP TO 100 ROWS
                    WHERE makt~spras = sy-langu.
       SORT i_alv ASCENDING BY matnr.
    ENDFORM.                    "get_data
    *      Form  Get_Fieldcatalog - Set Up Columns/Headers
    FORM get_fieldcatalog.
       DATA: ls_fcat TYPE lvc_s_fcat.
       REFRESH: fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Material Number'.
       ls_fcat-fieldname  = 'MATNR'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '18'.
       ls_fcat-fix_column = 'X'.
       ls_fcat-key        = 'X'.
       ls_fcat-hotspot    = 'X'.
       ls_fcat-col_pos    = '1'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Material Type'.
       ls_fcat-fieldname  = 'MTART'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '10'.
       ls_fcat-fix_column = 'X'.
       ls_fcat-key        = 'X'.
       ls_fcat-col_pos    = '2'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Material Group'.
       ls_fcat-fieldname  = 'MATKL'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '12'.
       ls_fcat-col_pos    = '3'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Size'.
       ls_fcat-fieldname  = 'GROES'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '30'.
       ls_fcat-col_pos    = '4'.
       APPEND ls_fcat TO fieldcat.
       CLEAR: ls_fcat.
       ls_fcat-reptext    = 'Material Description'.
       ls_fcat-fieldname  = 'MAKTX'.
       ls_fcat-ref_table  = 'I_ALV'.
       ls_fcat-outputlen  = '40'.
       ls_fcat-col_pos    = '5'.
       APPEND ls_fcat TO fieldcat.
    ENDFORM.                    "get_fieldcatalog
    Hope this solves your problem....

  • Reg: CheckBox in ALV Grid Display

    Hi all,
    My requirement is to display checkbox field in ALV Grid which is editable.
    And i also need to get all the records that i have selected in ALV grid.
    How can i do it. Kindly Help me with sample codes.
    Its Urgent.
    <REMOVED BY MODERATOR>
    Regards
    Naveen
    Edited by: Alvaro Tejada Galindo on Feb 18, 2008 5:41 PM

    Hi,
    First declare ur itab with the first field of length 1 char,
    Dont mention dat in the field cat.
    Give that field name and itab name in the layout.
    as
      is_layout-box_fieldname = 'CHECK'.
      is_layout-box_tabname   = 'IT_FINAL'.
    u can dispaly ur checkbox in the output dispaly.
    now to read the selected checkboxes u need to read the display with the syntax..
    first describe the table + headre length = w_count.
    FORM sub_read_checkbox.
      DATA: w_cbox TYPE char1.
      REFRESH : it_mail,it_text,it_selected.                   
      REFRESH : it_selected.
      DO w_count TIMES.
        READ LINE sy-index FIELD VALUE  : is_final-cbox  INTO w_cbox.
        IF w_cbox = c_x.
          READ TABLE it_header INTO is_header WITH KEY lifnr = is_header-lifnr
                                                       u_r   = is_header-u_r.
          IF sy-subrc = 0.
            APPEND is_header TO it_selected .
            CLEAR: is_header,w_cbox.
          ENDIF.
        ENDIF.
      ENDDO.
    endform.
    This serves ur purpose.
    Regards............

  • ALV REPORT: read selected checkbox in alv grid and process the pushbutton

    my requirement is to check some rows from alv grid and the press the pushbutton. Thereby following things should process:
    select all checked rows into an itab and call the transaction code CJ01 for all
    entries......
    I am finding the problem that when I select the checkbox....the internal table doesnt recognize the boxes as checked ones......
    thanks in advance...
    Kartikey Singh,

    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 t_output where Flag = 'X'.
            if t_output-VKUEGRU is initial.
              message e000 with text-110.
            endif.
    endloop.

  • Double click in a ALV GRID

    Hi all,
    I have a problem with an ALV GRID Control: I print in the screen an ALV with the clauses 'starting at...ending at...' ; when I do double click in a line of the ALV I show the details but, the size of the ALV get smaller and smaller for everytime I do double-click...
    Any ideas about how to solve this?
    Thanks and Regard.
    Urtzi.

    I have two dynpros:
    - In the first, in PBO I do
        CALL METHOD grid1->set_table_for_first_display
    To display the ALV
    - When I do double-clic, I raise the event handle_double_click. In the event I do a
      CALL SCREEN 2000 STARTING AT d_left_d d_top_d ENDING AT y1 y2
    to get the details. then, in the screen 2000, in the PBO, I do another
       CALL METHOD grid2->set_table_for_first_display
    to display the second ALV, the details.
    Regards.

  • To activate/deactivate checkbox in ALV grid report

    Hi All,
    I am trying to create an ALV Grid that contains check-box as column fields. I am able to either activate or deactivate all the check-boxes in the entire column. But, I need to keep only certain check-boxes for editing based on certain conditions. The other check-boxes in the column should be deactivated for editing by the user. Any help is appreciated.
    -Dinesh

    Hi dinesh babu ,
    In this example, i use 'REUSE_ALV_GRID_DISPLAY_LVC'
    FORM display_alv .
    DATA: ls_event_exit TYPE slis_event_exit,
          lt_event_exit TYPE slis_event_exit OCCURS 1.
    DESCRIBE TABLE itab_data LINES lv_cont.
    PERFORM layout_build   USING gs_layout.
    PERFORM eventtab_build USING gt_events[].
    PERFORM comment_build  USING gt_lheader[].
    CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
    EXPORTING
    i_structure_name            = 'ZHRESS_FORMACION_ALV'
    i_client_never_display   = 'X'
    i_bypassing_buffer         = 'X'
    CHANGING
    ct_fieldcat                      = gt_fieldcat[]
    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.
    LOOP AT gt_fieldcat INTO ls_fcat.
    Active check field
      IF ls_fcat-fieldname EQ 'CHECK'.
         ls_fcat-checkbox     = 'X'.
         ls_fcat-edit             = 'X'.
         ls_fcat-fix_column  = 'X'.
         ls_fcat-reptext        = 'Check'.
      ENDIF.
      PERFORM field_attributes.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY_LVC'
    EXPORTING
         i_background_id                   = 'ALV_BACKGROUND'
    i_callback_program             = g_repid
    i_callback_pf_status_set      = 'PF_STATUS'
    i_callback_user_command  = 'USER_COMMAND'
    is_layout_lvc                       = gs_layout
    it_fieldcat_lvc                     = gt_fieldcat[]
    i_save                                 = g_save
    is_variant                            = g_variant
    it_events                             = gt_events[]
    it_event_exit                       = lt_event_exit
    i_default                             = 'X'
    TABLES
    t_outtab                              = itab_data.
    ENDFORM.                    " DISPLAY_ALV
    FORM field_attributes .
      DATA ls_stylerow TYPE lvc_s_styl .
      DATA lt_styletab TYPE lvc_t_styl .
      LOOP AT itab_data INTO wa_data.
        IF wa_data-status NE c_status_p.         " Condition for enable / disable check
          ls_stylerow-fieldname = 'CHECK' .
          ls_stylerow-style = cl_gui_alv_grid=>mc_style_disabled.  "set field to disabled
          APPEND ls_stylerow TO wa_data-field_style.
          MODIFY itab_data FROM wa_data.
        ENDIF.
      ENDLOOP.
    ENDFORM.   
    Regards,
    José
    Edited by: Jose Luzardo on Oct 6, 2009 3:37 PM

  • Checkbox in alv grid

    Hello friends
    i have an internal table displayed in alv with one field as editable checkbox.
    The display is OK.
    After the user click the SAVE button, I want to process the ckecked records only.
    My problem: after clicking the SAVE  button, in USER_COMMAND form, all the records of the internal table have the checkbox field empty even if they were checked.
    MOVE 'SET_PF_STATUS' TO wv_slis_formname.
      wv_repid = sy-repid.
      DELETE wt_input INDEX 1.   "remove the header texts
      CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
        EXPORTING
          i_callback_user_command  = 'USER_COMMAND'
          i_callback_program       = wv_repid
          i_callback_pf_status_set = wv_slis_formname
          is_layout                = ws_layout
          it_fieldcat              = wt_field1
    *      i_save                   = 'X'
        TABLES
          t_outtab                 = wt_input
        EXCEPTIONS
          program_error            = 1
          OTHERS                   = 2.
    anybody could give me a hint?
    In debug session I check : wt_input table here
    FORM user_command USING r_ucomm LIKE sy-ucomm
                            ls_selfield type slis_selfield.
      DATA: save_ok TYPE sy-ucomm.
      DATA: ref1 TYPE REF TO cl_gui_alv_grid.
      save_ok = sy-ucomm.
      CASE save_ok.
        WHEN 'SAVE'.
      ENDCASE.
    ENDFORM.                    "user_command
    and its fields corresponding for the checkbox are all empty

    Hi,
    Go through this code . This code is for interactive alv . This interactive alv will display only for Checked ones.
    TYPE-POOLS : SLIS.
    PARAMETERS : P_EBELN TYPE EKKO-EBELN.
    TYPES: BEGIN OF TY_EKKO,
            CHECK TYPE C,
            EBELN TYPE EKKO-EBELN,
            BUKRS TYPE EKKO-BUKRS,
            EKORG TYPE EKKO-EKORG,
            BEDAT TYPE EKKO-BEDAT,
          END OF TY_EKKO.
    DATA : REPID TYPE SY-REPID.
    DATA : IT_EKKO TYPE TABLE OF TY_EKKO,
           WA_EKKO TYPE TY_EKKO.
    DATA : ITAB TYPE TABLE OF TY_EKKO.
    DATA: IT_FCAT TYPE SLIS_T_FIELDCAT_ALV,
          WA_FCAT TYPE SLIS_FIELDCAT_ALV.
    data : gs_layout type SLIS_LAYOUT_ALV.
    FIELD-SYMBOLS : <WA_EKKO> LIKE LINE OF IT_EKKO.
    SELECT EBELN BUKRS EKORG BEDAT FROM EKKO INTO CORRESPONDING FIELDS OF TABLE IT_EKKO UP TO 10 ROWS.
    PERFORM FIELDCAT.
    PERFORM DISPLAY_DATA.
    FORM SET_PF_STATUS USING STATUS.
      SET PF-STATUS 'STATUS'.
    ENDFORM.
    FORM USER_COMMAND USING FU_UCOMM LIKE SY-UCOMM FU_SELFIELD TYPE SLIS_SELFIELD.
      CASE fu_ucomm.
    WHEN 'CHECK'.
          LOOP AT IT_EKKO ASSIGNING <WA_EKKO>.
            <WA_EKKO>-check = 'X'.
            MODIFY TABLE IT_EKKO FROM <WA_EKKO> TRANSPORTING CHECK.
          ENDLOOP.
          FU_SELFIELD-REFRESH = 'X'.
        WHEN 'UNCHECK'.
          LOOP AT IT_EKKO ASSIGNING <WA_EKKO>.
            <WA_EKKO>-check = ' '.
            MODIFY TABLE IT_EKKO FROM <WA_EKKO> TRANSPORTING CHECK.
          ENDLOOP.
          FU_SELFIELD-REFRESH = 'X'.
    WHEN 'READ'.
    IF IT_EKKO IS NOT INITIAL.
    LOOP AT IT_EKKO INTO <WA_EKKO> WHERE CHECK = 'X'.
      BREAK-POINT.
       APPEND <WA_EKKO> TO ITAB.
       ENDLOOP.
      ENDIF.
    if itab is not initial.
    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
         I_CALLBACK_PROGRAM                = SY-REPID
         I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         IS_LAYOUT                         = GS_LAYOUT
         IT_FIELDCAT                       = IT_FCAT
         I_SAVE                            = 'X'
         TABLES
         T_OUTTAB                          = ITAB
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
    endif.
    WHEN OTHERS.
    READ TABLE IT_EKKO ASSIGNING <WA_EKKO> INDEX FU_SELFIELD-TABINDEX.
    <WA_EKKO>-CHECK = 'X'.
    MODIFY table  IT_EKKO FROM <WA_EKKO> TRANSPORTING CHECK .
    *BREAK-POINT.
    FU_SELFIELD-REFRESH = 'X'.
      ENDCASE.
    ENDFORM.                
    FORM FIELDCAT .
      WA_FCAT-FIELDNAME = 'CHECK'.
      wa_fcat-seltext_m = 'Select' .
      wa_fcat-checkbox = 'X'.
      wa_fcat-edit = 'X'.
      WA_FCAT-COL_POS = 5.
      WA_FCAT-OUTPUTLEN = '20'.
      wa_fcat-hotspot = 'X'.
      APPEND WA_FCAT TO IT_FCAT.
      CLEAR WA_FCAT.
      WA_FCAT-FIELDNAME = 'EBELN' .
      WA_FCAT-TABNAME = 'EKKO' .
      WA_FCAT-COL_POS = 1.
      WA_FCAT-OUTPUTLEN = '20'.
      wa_fcat-seltext_m = 'BILLING NUM' .
      APPEND WA_FCAT TO IT_FCAT.
      CLEAR WA_FCAT.
      WA_FCAT-FIELDNAME = 'BUKRS' .
      WA_FCAT-TABNAME = 'EKKO' .
      WA_FCAT-COL_POS = 2.
      WA_FCAT-OUTPUTLEN = '20'.
      wa_fcat-seltext_m = 'COMPANY CODE' .
      APPEND WA_FCAT TO IT_FCAT.
      CLEAR WA_FCAT.
      WA_FCAT-FIELDNAME = 'EKORG' .
      WA_FCAT-TABNAME = 'EKKO' .
      WA_FCAT-COL_POS = 3.
      WA_FCAT-OUTPUTLEN = '20'.
      wa_fcat-seltext_m = 'ORGANIZATION' .
      APPEND WA_FCAT TO IT_FCAT.
      CLEAR WA_FCAT.
      WA_FCAT-FIELDNAME = 'BEDAT' .
      WA_FCAT-TABNAME = 'EKKO' .
      WA_FCAT-COL_POS = 4.
      WA_FCAT-OUTPUTLEN = '20'.
      wa_fcat-seltext_m = 'BILLING DATE' .
      APPEND WA_FCAT TO IT_FCAT.
      CLEAR WA_FCAT.
    ENDFORM.                  
    FORM DISPLAY_DATA .
      IF NOT IT_EKKO IS INITIAL.
        GS_LAYOUT-zebra = 'X' .
        GS_LAYOUT-colwidth_optimize = 'X'.
        CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
         EXPORTING
         I_CALLBACK_PROGRAM                = SY-REPID
         I_CALLBACK_PF_STATUS_SET          = 'SET_PF_STATUS'
         I_CALLBACK_USER_COMMAND           = 'USER_COMMAND'
         IS_LAYOUT                         = GS_LAYOUT
         IT_FIELDCAT                       = IT_FCAT
         I_SAVE                            = 'X'
         TABLES
         T_OUTTAB                          = IT_EKKO
    EXCEPTIONS
      PROGRAM_ERROR                     = 1
      OTHERS                            = 2
      ENDIF.
    ENDFORM.
    Edited by: Aditya.G on Dec 29, 2011 12:35 PM

Maybe you are looking for

  • Creating a new company in a new database

    I am attempting to create a new company, but want it in a separate database.  (Just like creating a Sandbox for development and testing.)  However, when I choose to create the new company (specifying company name, accounting periods, etc.), B1 will n

  • Opemoffice stops working after upgrade to gcc 3.3

    openoffice no longer starts, most likely because of gcc 3 can someone rebuild it ? /opt/openoffice/program/javaldx: /opt/openoffice/program/libgcc_s.so.1: version `GCC_3.3' not found (required by /usr/lib/libstdc++.so.5) /opt/openoffice/program/soffi

  • Mail deletes body content of mail

    I forwarded several messages to my MAC address from another computer. All content is visible in the MAC INBOX. After moving to a newly created mailbox, the email and the size of the email is displayed however the body content of the emails are no lon

  • Re-setting up router HELP PLEASE!!

    Hello, i have the WRT54G wireless-g broadband router, I recently had my computer crash that i had set up the network with so i had to reformat my computer the problem is, I used the auto-generate key that was like 40 letters/numbers long and i saved

  • Can't print from Mail, TextEdit, or Preview in Snow Leopard

    Installed Snow Leopard on a new Mac Mini with a newly formatted drive. Successfully set up network HP printers using IP Printing option. Able to print to these printer from all installed applications EXCEPT TextEdit, Preview, and Mail. Print dialog n