Skip to Content
0
Former Member
Mar 28, 2007 at 02:25 PM

Multiline Checkbox Selection

25 Views

I have a report that each record has a heading line (preceded with a checkbox) and the next line is the information. I want to be able to display the information for all those selected. Right now it doesn't get the right data. Here is the code:

*Note: The fields of zmytable all are type C of 10 length.

DATA:  mark TYPE c,
            int_tmp TYPE i,
            it_mytab TYPE zmytable OCCURS 0,
            wa_mytab LIKE LINE OF it_mytab.

LOOP AT it_mytab INTO wa_mytab.
      SELECT SINGLE descr FROM zmycodes
                          INTO st_tmp3
                          WHERE tp_code = wa_mytab-tp_code.
      WRITE: /  mark AS CHECKBOX,
                     st_tmp3 color col_negative intensified off,
                  /  wa_mytab-field1,
                     wa_mytab-field2,
                     wa_mytab-field3.
      ULINE.
      HIDE:  wa_mytab-field1,
                wa_mytab-field2,
                wa_mytab-field3.
    ENDLOOP.
    CLEAR mytab.

AT LINE-SELECTION.
  CHECK NOT wa_mytab-field1 IS INITIAL.

  CASE sy-lsind.
    WHEN 1.
      DO.
        int_tmp = 0.
        mark = space.
        READ LINE sy-index FIELD VALUE mark.
        IF sy-subrc NE 0.
          EXIT.
        ELSE.
          IF mark = 'X'.
            ADD 1 TO int_tmp.
            WRITE: /  int_tmp,
                           wa_mytab-field1,
                           wa_mytab-field2,
                           wa_mytab-field3.
          ENDIF.
        ENDIF.
      ENDDO.
  ENDCASE.

Any help would be greatly appreciated. Thanks in advance.