Skip to Content

ALV and CheckBoxes

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 30, 2005 at 11:44 AM

    Hi David,

    First of all you need to have the field "SELECT" as part of the internal table that you pass to the fm REUSE_ALV_GRID_DISPLAY.

    Here,

    DATA: BEGIN OF t_ekko,

    <b> select,</b>

    ebeln TYPE ekpo-ebeln,

    ebelp TYPE ekpo-ebelp,

    END OF t_ekko.

    And then in your field catalog prepare logic, give the field name in BOLD,

    FORM build_fieldcatalog.

    REFRESH fieldcatalog.

    CLEAR fieldcatalog.

    <b> fieldcatalog-fieldname = 'SELECT'.</b>

    fieldcatalog-seltext_m = 'Select please'.

    ....

    Hope this helps..

    Sri

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.