Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Checkbox Issue in Reporting

Former Member
0 Kudos

Hi Gurus,

How i can put check boxes in list display and further to make them functional.

i.e. I hv a report and after executing that report it shows the sales order number in basic list as per the user selection through selection screen.

Now, I want a check box infront of all the sales order numbers and further i want to make them functional.

Tell me how to set the check boxes in basic list.

Regards

Vikas Badhan

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hiii

you can do this by using following code.refer it.

FORM get_flight_detail .


  SELECT
          carrid                       "carrier id
          connid                       "connection id
          airpfrom                     "airport from
          airpto                       "airport to
          deptime                      "departure time
          arrtime                      "arrival time
    INTO CORRESPONDING FIELDS OF TABLE t_flight
    FROM spfli.


ENDFORM.                    " get_flight_detail



FORM read_flight_detail .

  LOOP AT t_flight INTO fs_flight.
    SET PF-STATUS 'SELECT'.

    WRITE:
     /20
             box AS CHECKBOX,
             fs_flight-carrid,
             fs_flight-connid,
             fs_flight-airpfrom,
             fs_flight-airpto,
             fs_flight-deptime,
             fs_flight-arrtime.

    WRITE: w_zero.


  ENDLOOP.


ENDFORM.                    " read_flight_detail



<-----after at line selection call following subroutine----->

FORM detail_data .

  DATA:
     w_index TYPE sy-index,
     w_space TYPE c VALUE ' '.

  w_index = sy-index.
  DESCRIBE TABLE t_flight LINES w_lines.
  w_index = w_index + 2.
  DO w_lines TIMES.
    READ LINE sy-index FIELD VALUE box INTO box
              fs_flight-carrid INTO fs_flight-carrid
               fs_flight-connid INTO fs_flight-connid.



    IF box EQ 'X'.

      .
      SELECT
          carrid                       "carrier id
          connid                       "connection id
          fldate                       "flight date
          seatsmax                     "maximum seats
          seatsocc                     "occupied seats
      INTO CORRESPONDING FIELDS OF TABLE t_flight1
      FROM sflight
      WHERE connid EQ fs_flight-connid
      AND carrid EQ fs_flight-carrid.


      LOOP AT t_flight1 INTO fs_flight1.
        WRITE:
            /20
                 fs_flight1-connid,
                 fs_flight1-fldate,
                  fs_flight1-seatsocc,
                  fs_flight1-seatsmax.



        MODIFY LINE sy-lilli  FIELD VALUE  box
             FIELD FORMAT box INPUT OFF.
        MODIFY LINE sy-lilli  FIELD VALUE  box FROM w_space.


        w_flag = '*'.
        MODIFY LINE sy-index FIELD VALUE w_zero FROM w_flag.

      ENDLOOP.
    ENDIF.
  ENDDO.

ENDFORM.                    " detail_data

regards

twinkal

5 REPLIES 5

Former Member
0 Kudos

try this,

WRITE:/ SELECT-CHECKBOX AS CHECKBOX.

Former Member
0 Kudos

hi vikas

u can o/p the checkbox stament using write additions

but if u want to capture the check box which is selected in at-line selection event

u have to use syntax

READ LINE ... FIELD VALUE f1 INTO g1 ...

fn INTO gn

Former Member
0 Kudos

Hi,

Are you using a ALV List Display? If so, to display the checkbox, you just have to mention it in the fieldcatalog. Declare a new field say 'BOX' and while defining fieldcatalog, set the fieldcatalog-checkbox = 'X'. You also have to mention it in the layout. This will display a checkbox in the ALV List display.

To make it functional, write the code in the USER_COMMAND of the ALV.

Regards,

Suganya

Former Member
0 Kudos

hiii

you can do this by using following code.refer it.

FORM get_flight_detail .


  SELECT
          carrid                       "carrier id
          connid                       "connection id
          airpfrom                     "airport from
          airpto                       "airport to
          deptime                      "departure time
          arrtime                      "arrival time
    INTO CORRESPONDING FIELDS OF TABLE t_flight
    FROM spfli.


ENDFORM.                    " get_flight_detail



FORM read_flight_detail .

  LOOP AT t_flight INTO fs_flight.
    SET PF-STATUS 'SELECT'.

    WRITE:
     /20
             box AS CHECKBOX,
             fs_flight-carrid,
             fs_flight-connid,
             fs_flight-airpfrom,
             fs_flight-airpto,
             fs_flight-deptime,
             fs_flight-arrtime.

    WRITE: w_zero.


  ENDLOOP.


ENDFORM.                    " read_flight_detail



<-----after at line selection call following subroutine----->

FORM detail_data .

  DATA:
     w_index TYPE sy-index,
     w_space TYPE c VALUE ' '.

  w_index = sy-index.
  DESCRIBE TABLE t_flight LINES w_lines.
  w_index = w_index + 2.
  DO w_lines TIMES.
    READ LINE sy-index FIELD VALUE box INTO box
              fs_flight-carrid INTO fs_flight-carrid
               fs_flight-connid INTO fs_flight-connid.



    IF box EQ 'X'.

      .
      SELECT
          carrid                       "carrier id
          connid                       "connection id
          fldate                       "flight date
          seatsmax                     "maximum seats
          seatsocc                     "occupied seats
      INTO CORRESPONDING FIELDS OF TABLE t_flight1
      FROM sflight
      WHERE connid EQ fs_flight-connid
      AND carrid EQ fs_flight-carrid.


      LOOP AT t_flight1 INTO fs_flight1.
        WRITE:
            /20
                 fs_flight1-connid,
                 fs_flight1-fldate,
                  fs_flight1-seatsocc,
                  fs_flight1-seatsmax.



        MODIFY LINE sy-lilli  FIELD VALUE  box
             FIELD FORMAT box INPUT OFF.
        MODIFY LINE sy-lilli  FIELD VALUE  box FROM w_space.


        w_flag = '*'.
        MODIFY LINE sy-index FIELD VALUE w_zero FROM w_flag.

      ENDLOOP.
    ENDIF.
  ENDDO.

ENDFORM.                    " detail_data

regards

twinkal

I355602
Advisor
Advisor
0 Kudos

Hi Vikas,

Say you print vendor details with checkbox available for each record.

And on checking a checkbox for a particular vendor you want to print the further details

for the selected vendors.

Then you can check the selected vendors and then process their details.

A demo for this is given below :-

TYPES : BEGIN OF VENDOR,

LIFNR LIKE LFA1-LIFNR,

NAME1 LIKE LFA1-NAME1,

END OF VENDOR,

BEGIN OF VENDOR1,

LIFNR LIKE LFA1-LIFNR,

NAME1 LIKE LFA1-NAME1,

ORT01 LIKE LFA1-ORT01,

LAND1 LIKE LFA1-LAND1,

BUKRS LIKE LFB1-BUKRS,

END OF VENDOR1.

DATA : VENDOR_TAB TYPE STANDARD TABLE OF VENDOR INITIAL SIZE 20 WITH HEADER LINE,

VENDOR1_TAB TYPE STANDARD TABLE OF VENDOR1 INITIAL SIZE 20 WITH HEADER LINE,

CB.

START-OF-SELECTION.

SET PF-STATUS 'ZPFSTAT'.

SELECT LIFNR NAME1

FROM LFA1

INTO CORRESPONDING FIELDS OF TABLE VENDOR_TAB.

AT USER-COMMAND.

CASE SY-UCOMM.

WHEN 'VL'.

IF SY-LSIND = 1.

SET PF-STATUS SPACE.

DO.

CLEAR CB.

READ LINE SY-INDEX FIELD VALUE CB.

IF SY-SUBRC <> 0.

EXIT.

ELSE.

CHECK CB = 'X'.

MODIFY CURRENT LINE : FIELD VALUE CB FROM SPACE.

SELECT ALIFNR ANAME1 AORT01 ALAND1 B~BUKRS

FROM LFA1 AS A

LEFT OUTER JOIN LFB1 AS B

ON ALIFNR = BLIFNR

INTO TABLE VENDOR1_TAB

WHERE A~LIFNR = VENDOR_TAB-LIFNR.

LOOP AT VENDOR1_TAB.

WRITE : / 'Vendor ID:' NO-GAP, VENDOR1_TAB-LIFNR,

/ 'Vendor Name :' NO-GAP, VENDOR1_TAB-NAME1,

/ 'City :' NO-GAP, VENDOR1_TAB-ORT01,

/ 'Land :' NO-GAP, VENDOR1_TAB-LAND1,

/ 'Country Code :' NO-GAP, VENDOR1_TAB-BUKRS.

ULINE.

ENDLOOP.

ENDIF.

ENDDO.

ENDIF.

ENDCASE.

END-OF-SELECTION.

WRITE : /1 'CB', 5 'Vendor ID', 18 'Vendor Name'.

ULINE.

LOOP AT VENDOR_TAB.

WRITE : /1 CB AS CHECKBOX, 5 VENDOR_TAB-LIFNR, 18 VENDOR_TAB-NAME1.

HIDE : VENDOR_TAB-LIFNR.

ENDLOOP.

ULINE.