..3 Printing Program

Create a report Z_CHART and paste below code into it:


REPORT z_chart.


* declare the context

DATA gt_context TYPE ty_flights .


* fill the context

PERFORM fill_context .


* call the form

CALL FUNCTION 'ZXLWB_CALLFORM'

EXPORTING

iv_formname = 'CHART'

iv_context_ref = gt_context

EXCEPTIONS

process_terminated = 1

OTHERS = 2.

IF sy-subrc NE 0 .

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 .

ENDIF .


*&---------------------------------------------------------------------*

*& Form fill_context

*&---------------------------------------------------------------------*

FORM fill_context .


SELECT fldate AS fldate

SUM( seatsmax ) AS seatsmax

SUM( seatsocc ) AS seatsocc

INTO CORRESPONDING FIELDS OF TABLE gt_context

FROM sflight UP TO 10 ROWS

GROUP BY fldate

ORDER BY fldate .


ENDFORM . "fill_context

Result of the printing program execution: