Registration

Dear SAP Community Member,
In order to fully benefit from what the SAP Community has to offer, please register at:
http://scn.sap.com
Thank you,
The SAP Community team.
Skip to end of metadata
Go to start of metadata

Author: Vinod Reddy Vemuru
Submitted: 25/01/2009
Below code snippet describes how to use checkbox functionality in interactive classical report.

************************************************************************
*Check box Functionality in Classical report
************************************************************************
TYPES: BEGIN OF t_mara,
check TYPE c,
matnr TYPE mara-matnr,
END OF t_mara.

DATA: i_mara TYPE TABLE OF t_mara,
      i_mara1 TYPE TABLE OF t_mara,
      wa_mara TYPE t_mara.

DO 10 TIMES.
  wa_mara-matnr = sy-index.
  APPEND wa_mara TO i_mara.
ENDDO.

LOOP AT i_mara INTO wa_mara.
  WRITE: /1 wa_mara-check AS CHECKBOX,
          2 wa_mara-matnr.
ENDLOOP.

AT LINE-SELECTION.
  REFRESH i_mara1[].
  DO 12 TIMES.
    READ LINE sy-index LINE VALUE INTO wa_mara.
    IF sy-subrc IS INITIAL.
      CHECK wa_mara-check = 'X'.
      APPEND wa_mara TO i_mara1.
    ELSE.
      EXIT.
    ENDIF.
  ENDDO.

  IF NOT i_mara1[] IS INITIAL.
    WRITE 'You have selected below lines.'.
    LOOP AT i_mara1 INTO wa_mara.
      WRITE: /1 wa_mara-check AS CHECKBOX,
              2 wa_mara-matnr.
    ENDLOOP.
  ELSE.
    WRITE 'You have not selected any line.'.
  ENDIF.