Skip to Content
0
Nov 30, 2005 at 11:36 AM

ALV and CheckBoxes

120 Views

Hi everyone,

I created checkboxes in my ALV.

The problem is when I double click on a checkbox, I get a dump.

Here is the code.

REPORT  ztestdfalv1                             .

*Data Declaration
*----------------
DATA: BEGIN OF t_ekko,
  ebeln TYPE ekpo-ebeln,
  ebelp TYPE ekpo-ebelp,
 END OF t_ekko.

DATA: BEGIN OF it_ekko OCCURS 0.
        INCLUDE STRUCTURE t_ekko.
DATA: END OF it_ekko.

*ALV data declarations
TYPE-POOLS: slis.                                 "ALV Declarations
DATA: fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE,
      gd_layout    TYPE slis_layout_alv,
      gd_repid     LIKE sy-repid.


************************************************************************
*Start-of-selection.
START-OF-SELECTION.

  PERFORM data_retrieval.
  PERFORM build_fieldcatalog.
  PERFORM build_layout.
  PERFORM display_alv_report.


*&--------------------------------------------------------------------*
*&      Form  build_fieldcatalog
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
FORM build_fieldcatalog.
  REFRESH fieldcatalog.
  CLEAR fieldcatalog.

  fieldcatalog-fieldname   = 'Select'.
  fieldcatalog-seltext_m   = 'Select please'.

  fieldcatalog-checkbox     = 'X'.
  fieldcatalog-edit     = 'X'.
  fieldcatalog-col_pos     = 1.
  APPEND fieldcatalog.
  CLEAR  fieldcatalog.


  fieldcatalog-fieldname   = 'EBELN'.
  fieldcatalog-seltext_m   = 'Purchase Order'.
  fieldcatalog-hotspot     = 'X'.
  fieldcatalog-col_pos     = 2.
  APPEND fieldcatalog.
  CLEAR  fieldcatalog.

  fieldcatalog-fieldname   = 'EBELP'.
  fieldcatalog-seltext_m   = 'PO Item'.
  fieldcatalog-col_pos     = 3.
  APPEND fieldcatalog.
  CLEAR  fieldcatalog.

ENDFORM.                    " BUILD_FIELDCATALOG


*&---------------------------------------------------------------------*
*&      Form  BUILD_LAYOUT
*&---------------------------------------------------------------------*
*       Build layout for ALV grid report
*----------------------------------------------------------------------*
FORM build_layout.
  "Permet d'ajuster les colonnes au text
*  gd_layout-colwidth_optimize = 'X'.
  gd_layout-totals_text       = 'Totals'(201).

ENDFORM.                    " BUILD_LAYOUT


*&---------------------------------------------------------------------*
*&      Form  DISPLAY_ALV_REPORT
*&---------------------------------------------------------------------*
*       Display report using ALV grid
*----------------------------------------------------------------------*
FORM display_alv_report.
  gd_repid = sy-repid.
  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
       EXPORTING
            i_callback_program        = gd_repid
*            i_callback_top_of_page   = 'TOP-OF-PAGE'
            i_callback_pf_status_set  = 'SET_PF_STATUS'
            i_callback_user_command   = 'USER_COMMAND'
*            i_grid_title             = 'My Title'
            is_layout                 = gd_layout
            it_fieldcat               = fieldcatalog[]
            i_save                    = 'X'

       TABLES
            t_outtab                  = it_ekko
       EXCEPTIONS
            program_error             = 1
            OTHERS                    = 2.

  IF sy-subrc <> 0.
    WRITE:/ sy-subrc.
  ENDIF.

ENDFORM.                    " DISPLAY_ALV_REPORT


*&---------------------------------------------------------------------*
*&      Form  DATA_RETRIEVAL
*&---------------------------------------------------------------------*
*       Retrieve data form EKPO table and populate itab it_ekko
*----------------------------------------------------------------------*
FORM data_retrieval.

  SELECT ebeln ebelp
   UP TO 10 ROWS
    FROM ekpo
    INTO TABLE it_ekko.
ENDFORM.                    " DATA_RETRIEVAL


*----------------------------------------------------------------------*
*                      FORM SET_PF_STATUS                              *
*----------------------------------------------------------------------*
FORM set_pf_status USING rt_extab   TYPE  slis_t_extab.
  SET PF-STATUS 'STANDARD_FULLSCREEN1'.
ENDFORM.                    "set_pf_status


*&--------------------------------------------------------------------*
*&      Form  user_command
*&--------------------------------------------------------------------*
*       text
*---------------------------------------------------------------------*
*      -->R_UCOMM    text
*      -->RS_SELFIELDtext
*---------------------------------------------------------------------*
FORM user_command  USING r_ucomm LIKE sy-ucomm
                         rs_selfield TYPE slis_selfield.
  CASE r_ucomm.
    WHEN '&IC1'.
      CHECK rs_selfield-tabindex > 0.
      IF rs_selfield-value EQ '6000000001'.
        CALL TRANSACTION 'ZDF2'.
      ENDIF.
    WHEN 'REFRESH'.
      PERFORM data_retrieval.
      rs_selfield-refresh = 'X'.
  ENDCASE.
ENDFORM.                    "user_command

Here is the Dum.

This error may occur for any of the following reasons:

- You address a typed field symbol before it is set using ASSIGN

- You address a field symbol that points to a line in an internal table

that has been deleted

- You address a field symbol that had previously been reset using

UNASSIGN, or that pointed to a local field that no longer exists

- You address a global function interface parameter, even

though the relevant function module is not active,

that is it is not in the list of active calls. You can get the list

of active calls from the this short dump.

Thanks for the help !

Best Regards.