‎2008 Jul 18 1:15 PM
Hai All!
i want to create a normal interactive report, in the basic list CARRID should be displayed with checkbox. the detail list should be displayed after selecting the checkboxes & clicking the pushbotton in application toolbar.
plz help me to findout the solution.
‎2008 Jul 18 1:22 PM
hi,
Refer to the demo program demo_list_read_line for interactive reporting.
Regards,
Veeresh
‎2008 Jul 18 1:22 PM
hi,
Refer to the demo program demo_list_read_line for interactive reporting.
Regards,
Veeresh
‎2008 Jul 18 1:27 PM
Hi smitha,
Report z_sfpfli.
*Data Declarations ...................................................
----
Field String fs_spfli *
----
DATA:
BEGIN OF fs_spfli,
carrid LIKE spfli-carrid, " Airline Code
connid LIKE spfli-connid, " Flight Connection Number
airpfrom LIKE spfli-airpfrom, " Departure airport
airpto LIKE spfli-airpto, " Destination airport
deptime LIKE spfli-deptime, " Departure time
arrtime LIKE spfli-arrtime, " Arrival time
END OF fs_spfli.
*Data Declarations ...................................................
----
Field String fs_sflight *
----
DATA:
BEGIN OF fs_sflight,
carrid LIKE spfli-carrid, " Airline Code
connid LIKE spfli-connid, " Flight Connection Number
date LIKE sflight-fldate, " Flight date
seatsmax LIKE sflight-seatsmax, " Maximum capacity in economy
" class
seatsocc LIKE sflight-seatsocc, " Occupied seats in economy
" class
END OF fs_sflight.
----
Internal Table To Hold spfli Table Details *
----
DATA:
t_spfli LIKE
STANDARD TABLE
OF fs_spfli.
----
Internal Table To Hold sflight Table Details *
----
DATA:
t_sflight LIKE
STANDARD TABLE
OF fs_sflight.
DATA:
w_checkbox TYPE c,
w_lines TYPE i,
w_currentline TYPE i,
w_last_line TYPE i.
TOP-OF-PAGE.
PERFORM top_flight_data.
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM top_sflight_data.
"----
AT SELECTION-SCREEN EVENT *
"----
START-OF-SELECTION.
PERFORM get_flight_data.
&----
*& Form TOP_FLIGHT_DATA
----
This subroutine DISPLAY to_flight_data *
----
There are no interface parameters to be passed to this subroutine.
----
FORM top_flight_data .
SKIP 2.
FORMAT COLOR 5 ON.
WRITE:
/5(15) 'Airline Code'(010),
(15) 'Flight Connection Number'(011),
(10) 'Departure airport'(012),
(10) 'Destination airport'(013),
(10) 'Departure time'(014),
(15) 'Arrival time'(015).
FORMAT COLOR OFF.
SKIP 2.
ENDFORM. " TOP_FLIGHT_DATA
"----
END-OF-SELECTION EVENT *
"----
END-OF-SELECTION.
SET PF-STATUS 'MENU'.
PERFORM display_flight_data.
AT LINE-SELECTION.
IF sy-lsind EQ 1.
PERFORM get_sflight_data.
PERFORM display_sflight_data.
ENDIF. " IF SY-LSIND..
AT USER-COMMAND.
SET PF-STATUS space.
CASE sy-ucomm.
WHEN 'SELECTALL'.
w_checkbox = 'X'.
PERFORM modify_checkbox.
WHEN 'DSELECTALL'.
w_checkbox = ' '.
PERFORM modify_checkbox.
WHEN 'DISPLAY'.
PERFORM get_sflight_data1 .
ENDCASE. " CASE SY-UCOMM
&----
*& Form GET_FLIGHT_DATA
----
This subroutine retrieves necessary data from SPFLI *
*
----
There are no interface parameters to be passed to this subroutine.
----
FORM get_flight_data .
SELECT carrid " Airline Code
connid " Flight Connection Number
airpfrom " Departure airport
airpto " Destination airport
deptime " Departure time
arrtime " Arrival time
FROM spfli
INTO TABLE t_spfli.
ENDFORM. " GET_FLIGHT_DATA
&----
*& Form DISPLAY_FLIGHT_DATA
----
This subroutine DISPLAY necessary data from SPFLI *
*
----
There are no interface parameters to be passed to this subroutine.
----
FORM display_flight_data .
LOOP AT t_spfli INTO fs_spfli.
WRITE:
/02 w_checkbox AS CHECKBOX,
fs_spfli-carrid UNDER text-010,
fs_spfli-connid UNDER text-011,
fs_spfli-airpfrom UNDER text-012,
fs_spfli-airpto UNDER text-013,
fs_spfli-deptime UNDER text-014,
fs_spfli-arrtime UNDER text-015.
HIDE:
fs_spfli-carrid,
fs_spfli-connid.
ENDLOOP. " LOOP AT T_SPFLI INTO...
w_last_line = sy-linno.
ENDFORM. " DISPLAY_FLIGHT_DATA
&----
*& Form GET_SFLIGHT_DATA
----
This subroutine retrieves necessary data from SFLIGHT *
*
----
There are no interface parameters to be passed to this subroutine.
----
FORM get_sflight_data .
SELECT carrid " Airline Code
connid " Flight Connection Number
fldate " Flight date
seatsmax " Maximum capacity in economy
" class
seatsocc " Occupied seats in economy
" class
FROM sflight
INTO TABLE t_sflight
WHERE carrid EQ fs_spfli-carrid
AND connid EQ fs_spfli-connid.
ENDFORM. " GET_SFLIGHT_DATA
&----
*& Form top_sflight_data
----
This subroutine to Display to_sflight_data *
----
There are no interface parameters to be passed to this subroutine.
----
form top_sflight_data .
SKIP 2.
FORMAT COLOR 3 ON.
WRITE:
/1(15) 'Airline Code'(010) LEFT-JUSTIFIED,
15(15) 'Flight Connection Number'(011) LEFT-JUSTIFIED,
25(15) 'Flight date'(016) LEFT-JUSTIFIED,
38(17) 'Maximum capacity'(017) LEFT-JUSTIFIED,
48(15) 'Occupied seats'(018) LEFT-JUSTIFIED.
SKIP 2.
FORMAT COLOR OFF.
endform. " top_sflight_data
&----
*& Form DISPLAY_SFLIGHT_DATA
----
This subroutine DISPLAY necessary data from SFLIGHT *
*
----
There are no interface parameters to be passed to this subroutine.
----
FORM display_sflight_data .
LOOP AT t_sflight INTO fs_sflight.
WRITE:
/ fs_sflight-carrid UNDER TEXT-010,
fs_sflight-connid UNDER TEXT-011,
fs_sflight-date UNDER TEXT-016,
fs_sflight-seatsmax UNDER TEXT-017,
fs_sflight-seatsocc UNDER TEXT-018.
ENDLOOP. " LOOP AT T_SFLIGHT INTO...
ENDFORM. " DISPLAY_SFLIGHT_DATA
&----
*& Form GET_SFLIGHT_DATA1
----
This subroutine retrieves necessary data from SFLIGHT
----
There are no interface parameters to be passed to this subroutine.
----
FORM get_sflight_data1 .
DATA
lw_checkbox TYPE c.
DESCRIBE TABLE t_spfli LINES w_lines.
DO w_last_line TIMES.
w_currentline = 2 + sy-index.
CLEAR:
w_checkbox,
t_spfli.
READ LINE w_currentline FIELD VALUE
w_checkbox INTO lw_checkbox.
IF sy-subrc EQ 0.
IF lw_checkbox EQ 'X'.
PERFORM get_sflight_data .
PERFORM display_sflight_data .
ENDIF. " IF LW_CHECKBOX..
ENDIF. " IF SY-SUBRC..
ENDDO. " DO W_LAST_LINE
ENDFORM. " GET_SFLIGHT_DATA1
&----
*& Form MODIFY_CHECKBOX
----
This subroutine MODIFIES accordingly
----
There are no interface parameters to be passed to this subroutine.
----
FORM modify_checkbox .
CLEAR w_currentline.
WHILE w_currentline LE w_last_line.
READ LINE w_currentline.
MODIFY LINE w_currentline FIELD VALUE w_checkbox FROM w_checkbox.
ADD 1 TO w_currentline.
ENDWHILE. " WHILE w_line LE w_last_line.
ENDFORM. " MODIFY_CHECKBOX
Regards,
Sravanthi
‎2008 Jul 18 1:42 PM
Hii,
Check out this sample code
REPORT z_sdn.
*" Data declarations...................................................
*"--------------------------------------------------------------------*
* Work variables *
*"--------------------------------------------------------------------*
DATA:
BEGIN OF fs_spfli,
carrid LIKE spfli-carrid, " Airline Code
connid LIKE spfli-connid, " Flight Connection Number
airpfrom LIKE spfli-airpfrom, " Departure airport
airpto LIKE spfli-airpto, " Destination airport
deptime LIKE spfli-deptime, " Departure time
arrtime LIKE spfli-arrtime, " Arrival time
END OF fs_spfli,
BEGIN OF fs_sflight,
carrid LIKE sflight-carrid, " Airline Code
connid LIKE sflight-connid, " Flight Connection Number
fldate LIKE sflight-fldate, " Flight date
seatsmax LIKE sflight-seatsmax, " Maximum seats in economy class
seatsocc LIKE sflight-seatsocc, " Occupied seats in economyclass
END OF fs_sflight,
w_checkbox TYPE c, " Variable for checkbox
w_currentline TYPE i, " Variable to display current
" line
w_lines TYPE i,
w_read TYPE c .
*"--------------------------------------------------------------------*
* Internal Table to hold flight schedule information *
*"--------------------------------------------------------------------*
DATA:
t_spfli LIKE
TABLE OF
fs_spfli.
*"--------------------------------------------------------------------*
* Internal Table to hold flight information *
*"--------------------------------------------------------------------*
DATA:
t_sflight LIKE
TABLE OF
fs_sflight,
t_sflight1 LIKE t_sflight.
*"--------------------------------------------------------------------*
* START-OF-SELECTION Event *
*"--------------------------------------------------------------------*
START-OF-SELECTION.
PERFORM get_data_spfli.
*"--------------------------------------------------------------------*
* END-OF-SELECTION Event *
*"--------------------------------------------------------------------*
END-OF-SELECTION.
SET PF-STATUS 'MENU'.
PERFORM display_data_spfli.
*"--------------------------------------------------------------------*
* TOP-OF-PAGE Event *
*"--------------------------------------------------------------------*
TOP-OF-PAGE.
PERFORM header_table_spfli.
*"--------------------------------------------------------------------*
* AT LINE-SELECTION EVENT *
*"--------------------------------------------------------------------*
AT LINE-SELECTION.
SET PF-STATUS space.
IF sy-lsind EQ 1 AND sy-lilli GE 4.
PERFORM get_data_sflight.
PERFORM display_data_sflight.
PERFORM flag_line.
ENDIF. " IF sy-lsind EQ 1..
*"--------------------------------------------------------------------*
* AT USER-COMMAND *
*"--------------------------------------------------------------------*
AT USER-COMMAND.
IF sy-lsind EQ 1.
SET PF-STATUS space.
CASE sy-ucomm.
WHEN 'DISPLAY'.
PERFORM get_data_sflight1.
PERFORM display_data_sflight.
WHEN 'SELECTALL'.
PERFORM select_all.
PERFORM flag_line.
WHEN 'DESELECTAL'.
PERFORM deselect_all.
PERFORM flag_line.
ENDCASE. " CASE sy-ucomm
ENDIF. " IF sy-lsind EQ 1
*"--------------------------------------------------------------------*
* TOP-OF-PAGE DURING LINE-SELECTION *
*"--------------------------------------------------------------------*
TOP-OF-PAGE DURING LINE-SELECTION.
PERFORM sec_list_heading.
*&---------------------------------------------------------------------*
*& Form get_data_spfli
*&---------------------------------------------------------------------*
* This subroutine fetches the data from SPFLI
*----------------------------------------------------------------------*
* This subroutine does not have parameters to pass
*----------------------------------------------------------------------*
FORM get_data_spfli .
SELECT carrid " Airline Code
connid " Flight Connection Number
airpfrom " Departure airport
airpto " Destination airport
deptime " Departure time
arrtime " Arrival time
FROM spfli
INTO TABLE t_spfli.
ENDFORM. " GET_DATA_SPFLI
*&---------------------------------------------------------------------*
*& Form display_data_spfli
*&---------------------------------------------------------------------*
* This subroutine displays the data of SPFLI
*----------------------------------------------------------------------*
* This subroutine does not have parameters to pass
*----------------------------------------------------------------------*
FORM display_data_spfli .
LOOP AT t_spfli INTO fs_spfli.
WRITE: /02 w_checkbox AS CHECKBOX,
05 w_read,
fs_spfli-carrid UNDER text-001,
fs_spfli-connid UNDER text-002,
fs_spfli-airpfrom UNDER text-003,
fs_spfli-airpto UNDER text-004,
fs_spfli-deptime UNDER text-005,
fs_spfli-arrtime UNDER text-006.
HIDE:
fs_spfli-carrid,
fs_spfli-connid.
ENDLOOP. " LOOP AT t_spfli..
ENDFORM. " DISPLAY_DATA_SPFLI
*&---------------------------------------------------------------------*
*& Form header_table_spfli
*&---------------------------------------------------------------------*
* This subroutine diplays the headings of table spfli
*----------------------------------------------------------------------*
* This subroutine does not have parameters to pass
*----------------------------------------------------------------------*
FORM header_table_spfli .
WRITE: /10 text-001 COLOR 4,
25 text-002 COLOR 4,
40 text-003 COLOR 4,
55 text-004 COLOR 4,
70 text-005 COLOR 4,
85 text-006 COLOR 4.
ENDFORM. " HEADER_TABLE
*&---------------------------------------------------------------------*
*& Form get_data_sflight
*&---------------------------------------------------------------------*
* This subroutine fetches the data from SFLIGHT
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM get_data_sflight .
SELECT carrid " Airline Code
connid " Flight Connection Number
fldate " Flight date
seatsmax " Maximum seats in economy class
seatsocc " Occupied seats in economyclass
FROM sflight
INTO TABLE t_sflight
WHERE carrid EQ fs_spfli-carrid
AND connid EQ fs_spfli-connid.
ENDFORM. " GET_DATA_SFLIGHT
*&---------------------------------------------------------------------*
*& Form display_data_sflight
*&---------------------------------------------------------------------*
* This subroutine displays the SFLIGHT data
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM display_data_sflight .
LOOP AT t_sflight INTO fs_sflight.
WRITE: / fs_sflight-carrid UNDER text-001,
fs_sflight-connid UNDER text-002,
fs_sflight-fldate UNDER text-007,
fs_sflight-seatsmax UNDER text-008 LEFT-JUSTIFIED,
fs_sflight-seatsocc UNDER text-009 LEFT-JUSTIFIED.
ENDLOOP.
CLEAR: fs_sflight.
ENDFORM. " DISPLAY_DATA_sflight
*&---------------------------------------------------------------------*
*& Form sec_list_heading
*&---------------------------------------------------------------------*
* This subroutine diplays the headings of table spfli
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM sec_list_heading .
WRITE: /2 text-001 COLOR 4,
15 text-002 COLOR 4,
33 text-007 COLOR 4,
45 text-008 COLOR 4,
60 text-009 COLOR 4.
ENDFORM. " SEC_LIST_HEADING
*&---------------------------------------------------------------------*
*& Form get_data_sflight1
*&---------------------------------------------------------------------*
* This subroutine displays the data from SFLIGHT according to checkbox
* clicked.
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM get_data_sflight1 .
DATA:
lw_checkbox TYPE c.
DESCRIBE TABLE t_spfli LINES w_lines.
DO w_lines TIMES.
w_currentline = 3 + sy-index.
CLEAR:
w_checkbox,
fs_spfli.
READ LINE w_currentline FIELD VALUE
w_checkbox INTO lw_checkbox
fs_spfli-carrid INTO fs_spfli-carrid
fs_spfli-connid INTO fs_spfli-connid.
IF sy-subrc EQ 0.
IF lw_checkbox EQ 'X'.
SELECT carrid " Airline Code
connid " Flight Connection Number
fldate " Flight Date
seatsmax " Max Seats
seatsocc " Occupied Seats
FROM sflight
INTO TABLE t_sflight1
WHERE carrid EQ fs_spfli-carrid
AND connid EQ fs_spfli-connid.
IF sy-subrc EQ 0.
APPEND LINES OF t_sflight1 TO t_sflight.
ENDIF. " IF sy-subrc EQ 0.
ENDIF. " IF lw_checkbox EQ 'X'
ENDIF. " IF sy-subrc EQ 0.
ENDDO. " DO w_lines TIMES
ENDFORM. " GET_DATA_SFLIGHT1
*&---------------------------------------------------------------------*
*& Form select_all
*&---------------------------------------------------------------------*
* This subroutine selects all the records of SPFLI
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM select_all .
DESCRIBE TABLE t_spfli LINES w_lines.
DO w_lines TIMES.
w_currentline = sy-index + 3.
READ LINE w_currentline FIELD VALUE
w_checkbox INTO w_checkbox.
IF sy-subrc = 0.
MODIFY LINE w_currentline FIELD VALUE
w_checkbox FROM 'X'.
ENDIF. " IF sy-subrc = 0.
ENDDO. " DO lw_line TIMES.
ENDFORM. " SELECT_ALL
*&---------------------------------------------------------------------*
*& Form deselect_all
*&---------------------------------------------------------------------*
* This subroutine deselects all the records of SPFLI
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM deselect_all .
DESCRIBE TABLE t_spfli LINES w_lines.
DO w_lines TIMES.
w_currentline = sy-index + 3.
READ LINE w_currentline FIELD VALUE
w_checkbox INTO w_checkbox.
IF sy-subrc = 0.
MODIFY LINE w_currentline FIELD VALUE
w_checkbox FROM ' '.
ENDIF. " IF sy-subrc = 0.
ENDDO. " DO lw_line TIMES.
ENDFORM. " DESELECT_ALL
*&---------------------------------------------------------------------*
*& Form flag_line
*&---------------------------------------------------------------------*
* This subroutine flags the line which has been read
*----------------------------------------------------------------------*
* This subroutine does not have interface parameters to pass
*----------------------------------------------------------------------*
FORM flag_line .
DESCRIBE TABLE t_spfli LINES w_lines.
DO w_lines TIMES.
w_checkbox = 'X'.
READ LINE sy-lilli FIELD VALUE
w_read INTO w_read
w_checkbox INTO w_checkbox.
IF sy-subrc EQ 0.
MODIFY CURRENT LINE
FIELD FORMAT w_checkbox INPUT OFF
FIELD VALUE w_read FROM '*'.
ENDIF. " IF sy-subrc EQ 0
ENDDO. " DO w_lines TIMES
ENDFORM. " FLAG_LINE
Regards
Abhijeet