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: 

spool request

Former Member
0 Kudos

hi all,

i am having a report where , when i update any database table , now i need to generate a spool for the messages showing the database is updated.

i am not clear with what does that mean , i tried learning some things about spool

but i cant relate it to my requirement , how to generate spool????

can anybody let me know the specific FM for that and what it leads to

please give me some good ideas

i will appreciate good answers!!!

thnkx

bhanu

1 ACCEPTED SOLUTION

former_member404244
Active Contributor
0 Kudos

Hi,

chek the below code..

REPORT zxap_rpt_001r_bc_sets_printing NO STANDARD PAGE HEADING

LINE-SIZE 132

MESSAGE-ID zca.

************************************************************************

*TYPE POOLS *

************************************************************************

TYPE-POOLS : scpr.

************************************************************************

  • Tables Declaration *

************************************************************************

TABLES : scprtext, "BC Set: Short texts

tsp01. "Spool Requests

************************************************************************

  • Global Types Declaration *

************************************************************************

  • Type declaration for BCSet id's

TYPES : BEGIN OF t_id,

id TYPE scpr_id, "Business Configuration Set

moddate TYPE scpr_date, "Last Changed on

modifier TYPE scpr_modif, "Last Changed By

END OF t_id.

  • Type declaration for BCset records

TYPES: BEGIN OF t_scprrecord,

tabname LIKE scprdata-tablename, "Table name

tabtype LIKE objh-objecttype, "Table type

tabtext LIKE dd02t-ddtext, "Table text

tablen TYPE i, "Table length

keylen TYPE i, "Key length

objname LIKE objh-objectname, "Object name

objtype LIKE objh-objecttype, "Object type

activity LIKE scprreca-activity, "Activity

rawrec LENGTH scpr_maxdatalen, "Length

importable, "Importable

status(1), "Status

descr_reduced(1), "Desc reduced

descr TYPE scpr_flddescr OCCURS 10, "Table for fielddesc

sellist LIKE vimsellist OCCURS 10, "Table for sellist

header LIKE vimdesc OCCURS 10, "Table for header

namtab LIKE vimnamtab OCCURS 10, "Table for namtab

END OF t_scprrecord.

  • Type declaration for documentation

TYPES : BEGIN OF t_dokhl,

id TYPE doku_id, "Document class

object TYPE doku_obj, "Documentation Object

langu TYPE doku_langu, "Documentation language

typ TYPE doku_typ, "Documentation type

dokversion TYPE dokvers, "Version of document

END OF t_dokhl.

************************************************************************

  • Internal Tables Declaration *

************************************************************************

DATA :

  • Internal table for BCSet id's

i_id TYPE STANDARD TABLE OF t_id,

  • Internal table for Selection screen parameters

i_seltable TYPE STANDARD TABLE OF rsparams,

  • Internal table for tablename,activity,objectname

i_ret TYPE STANDARD TABLE OF scprreca,

  • Internal table for BC Set: Values

i_vals TYPE STANDARD TABLE OF scprvals,

  • Internal table for BC Set: Values

i_vall TYPE STANDARD TABLE OF scprvall,

  • Internal table for IMG activity

i_activities TYPE scpr_activities ,

  • Internal table for Field Overview

i_flddescrs TYPE scpr_records ,

  • Internal table for PDF

i_pdf TYPE STANDARD TABLE OF tline,

  • Internal table for documentation

i_lines TYPE STANDARD TABLE OF tline.

************************************************************************

  • Global Workareas Declaration *

************************************************************************

DATA :

  • Workarea for BCSet id's

wa_id TYPE t_id,

  • Workarea for tablename,activity,objectname

wa_ret TYPE scprreca.

************************************************************************

  • Global Variables *

************************************************************************

DATA : v_text TYPE scprtext-text, "BC Set: Description

v_acttext LIKE dsyst-doktitle, "Module Title

v_objtext LIKE objt-ddtext, "Explanatory short text

v_tabtext LIKE scprotabl-text, "BC Set: Table/view name

v_activity TYPE cus_act, "Customizing activity

v_print_parms LIKE pri_params, "Structure for Passing

"Print Parameters

v_rqident LIKE tsp01-rqident, "Spool request number

v_print TYPE pri_params-primm.

************************************************************************

  • Global Constants *

************************************************************************

CONSTANTS : c_linsz LIKE sy-linsz VALUE '132', "Constant for line size

c_c(4) TYPE c VALUE 'C:\' , "Constant for C:\

c_x(1) TYPE c VALUE 'X'. "Constant for X

*&----


*& Selection Screen Declaration

*&----


SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS : s_id FOR scprtext-id OBLIGATORY. "BC Set ID

SELECT-OPTIONS : s_change FOR sy-uname, "Last changed by

s_date FOR sy-datum. "Last Changed on

SELECTION-SCREEN : END OF BLOCK b1.

SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

PARAMETERS : p_bcset AS CHECKBOX DEFAULT 'X', "BC Set Text

p_tables AS CHECKBOX DEFAULT 'X', "BC Set Tables and Views

p_img AS CHECKBOX DEFAULT 'X', "IMG Activity

p_oblect AS CHECKBOX DEFAULT 'X', "Customizing Object

p_docu AS CHECKBOX DEFAULT 'X'. "BC Set Documentation

SELECTION-SCREEN : END OF BLOCK b2.

SELECTION-SCREEN : BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.

PARAMETERS : p_disp RADIOBUTTON GROUP rad1, "Display BC Set

p_print RADIOBUTTON GROUP rad1. "Print BC Set

SELECTION-SCREEN : END OF BLOCK b3.

SELECTION-SCREEN : BEGIN OF BLOCK b4 WITH FRAME TITLE text-016.

PARAMETERS : p_pdf RADIOBUTTON GROUP rad2, "Save as RTF

p_rtf RADIOBUTTON GROUP rad2. "Save as PDF

SELECTION-SCREEN : END OF BLOCK b4.

----


  • START-OF-SELECTION

----


START-OF-SELECTION.

  • To Get the User selection on selection screen

PERFORM get_selection_screen.

  • To Get the BCsets id

PERFORM get_data.

----


  • END-OF-SELECTION

----


END-OF-SELECTION.

IF NOT i_id[] IS INITIAL.

  • For printing

PERFORM print.

  • For outputting BCSet details

PERFORM bcset_details.

  • For getting the spool number

PERFORM get_spool_number.

  • For Printing Options

PERFORM print_options.

ENDIF. "IF NOT i_id[] IS INITIAL.

&----


*& Form get_selection_screen

&----


  • Subroutine to get the user selection on selection screen

----


FORM get_selection_screen .

CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

EXPORTING

curr_report = sy-repid

TABLES

selection_table = i_seltable

EXCEPTIONS

not_found = 01

no_report = 02.

IF sy-subrc NE 0.

REFRESH i_seltable.

ENDIF.

ENDFORM. " get_selection_screen

&----


*& Form get_data

&----


  • Subroutine to get the BCsets id

----


FORM get_data .

  • Get the BCsets id

SELECT id

moddate

modifier

FROM scprattr INTO TABLE i_id

WHERE id IN s_id

AND moddate IN s_date

AND modifier IN s_change.

IF sy-subrc NE 0.

MESSAGE i007.

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " get_data

*&----


*

*& Form print

*&----


*

  • Subroutine for printing

*----


FORM print .

  • Declaration of local constants

CONSTANTS : lc_paart LIKE sy-paart VALUE 'X_65_132', " Paper Format

lc_locl TYPE sypdest VALUE 'LOCL'. " Destination

  • If print option is selected.

IF p_print IS NOT INITIAL.

MOVE c_x TO v_print.

ELSE.

CLEAR v_print.

ENDIF.

  • Setup the Print Parmaters

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

authority = space

immediately = v_print

new_list_id = c_x

no_dialog = c_x

user = sy-uname

IMPORTING

out_parameters = v_print_parms

EXCEPTIONS

archive_info_not_found = 1

invalid_print_params = 2

invalid_archive_params = 3

OTHERS = 4.

IF sy-subrc NE 0.

CLEAR : v_print_parms.

ENDIF.

  • The printer destination has to be set up

IF v_print_parms-pdest = space.

v_print_parms-pdest = lc_locl.

ENDIF.

  • Explicitly set line width, and output format so that

  • the PDF conversion comes out OK

v_print_parms-linsz = c_linsz.

v_print_parms-paart = lc_paart.

ENDFORM. " print

&----


*& Form bcset_details

&----


  • Subroutine for bcset details

----


FORM bcset_details .

NEW-PAGE PRINT ON PARAMETERS v_print_parms NO DIALOG.

LOOP AT i_id INTO wa_id.

IF sy-index <> 1.

NEW-PAGE.

  • For Printing the report header

PERFORM report_header.

  • TO display the selction criteria in the output

IF sy-pagno EQ 1.

PERFORM display_selection_criteria.

ENDIF. " IF sy-pagno EQ 1.

ENDIF. "IF sy-index <> 1.

  • Get the BCset short text

PERFORM get_text.

  • Get the IMG activity objectname and tablename

PERFORM get_activity.

LOOP AT i_ret INTO wa_ret.

  • Get the short text for the IMG activity

PERFORM get_activity_text.

  • Get the short text for the objectname

PERFORM get_object_text.

  • Get the short text for the table

PERFORM get_table_text.

  • Get the IMG path

PERFORM get_img_path.

  • Get the Field Overview

PERFORM get_field_overview.

  • Clear Workareas

CLEAR : wa_ret.

ENDLOOP. "LOOP AT i_ret INTO wa_ret.

IF p_docu IS NOT INITIAL.

  • GET the documentation of the bc set

PERFORM get_documentation.

ENDIF.

  • IF display option is selected on selection screen

PERFORM display_output.

WRITE 😕 sy-uline.

  • Clear workareas and variables

CLEAR : wa_id,

v_text,

v_activity.

  • Refresh the internal table

REFRESH : i_lines,

i_ret.

ENDLOOP. "LOOP AT i_id INTO wa_id

NEW-PAGE PRINT OFF.

ENDFORM. " bcset_details

*&----


*

*& Form get_spool_number

*&----


*

  • Subroutine to get the spool number

*----


*

FORM get_spool_number .

  • Declaration of local variables.

DATA:

lv_rq2name LIKE tsp01-rq2name.

CONCATENATE sy-repid+0(8)

sy-uname+0(3)

INTO lv_rq2name SEPARATED BY '_'.

  • Get the spool number.

SELECT * FROM tsp01 WHERE rq2name = lv_rq2name

ORDER BY rqcretime DESCENDING.

v_rqident = tsp01-rqident.

EXIT.

ENDSELECT.

IF sy-subrc NE 0.

CLEAR v_rqident.

ENDIF.

ENDFORM. " get_spool_number

&----


*& Form print_options

&----


  • Subroutine for print options

----


FORM print_options .

IF p_disp IS NOT INITIAL.

  • To display the list in the output

CALL FUNCTION 'RSPO_DISPLAY_SPOOLJOB'

EXPORTING

rqident = v_rqident

first_line = 1

last_line = 0.

ENDIF.

  • If PDF option is selected on selection screen

IF p_pdf IS NOT INITIAL.

PERFORM save_as_pdf.

ENDIF.

  • If RTF option is selected on selection screen

IF p_rtf IS NOT INITIAL.

PERFORM save_as_rtf.

ENDIF.

ENDFORM. " print_options

&----


*& Form get_text

&----


  • Subroutine to get the BCset short text

----


FORM get_text .

CALL FUNCTION 'SCPR_TEXT_GET'

EXPORTING

profid = wa_id-id

langu = sy-langu

IMPORTING

proftext = v_text

EXCEPTIONS

no_text_found = 1

OTHERS = 2.

IF sy-subrc NE 0.

CLEAR v_text.

ENDIF.

ENDFORM. " get_text

&----


*& Form get_activity

&----


  • Subroutine to get the IMG activity objectname and tablename

----


FORM get_activity .

CALL FUNCTION 'SCPR_TEMPL_DB_DATA_READ_BCSET'

EXPORTING

bcset_id = wa_id-id

TABLES

recattr = i_ret

values = i_vals

valuesl = i_vall.

DELETE ADJACENT DUPLICATES FROM i_ret COMPARING id.

ENDFORM. " get_activity

&----


*& Form get_activity_text

&----


  • Subroutine to get the short text for the IMG activity

----


FORM get_activity_text .

CALL FUNCTION 'SCPR_IMG_DB_ACT_TEXT_GET'

EXPORTING

activity = wa_ret-activity

IMPORTING

activity_text = v_acttext.

ENDFORM. " get_activity_text

&----


*& Form get_object_text

&----


  • Subroutine to get the short text for the objectname

----


FORM get_object_text .

CALL FUNCTION 'SCPR_DB_COBJ_TEXT_GET'

EXPORTING

objname = wa_ret-objectname

objtype = wa_ret-objecttype

IMPORTING

objtext = v_objtext.

ENDFORM. " get_object_text

&----


*& Form get_table_text

&----


  • subroutine to get short text for the table

----


FORM get_table_text .

CALL FUNCTION 'SCPR_DB_TABLE_TEXT_GET'

EXPORTING

tabname = wa_ret-tablename

IMPORTING

tabtext = v_tabtext.

ENDFORM. " get_table_text

&----


*& Form get_img_path

&----


  • Subroutine to get the IMG path

----


FORM get_img_path .

v_activity = wa_ret-activity.

CALL FUNCTION 'SCPR_IMG_DB_ACT_GET_FATHERS'

EXPORTING

custact = v_activity

TABLES

activities = i_activities.

ENDFORM. " get_img_path

&----


*& Form get_field_overview

&----


  • Subroutine to get the field overview

----


FORM get_field_overview .

CALL FUNCTION 'SCPR_PRSET_DB_FLDDESCRS_GET'

EXPORTING

flddescr_reduc = 'X'

TABLES

recattr = i_ret

flddescrs = i_flddescrs.

ENDFORM. " get_field_overview

&----


*& Form get_documentation

&----


  • Subroutine to get the documentation

----


FORM get_documentation .

  • Declaration of local variables

DATA: lv_doc_name LIKE scprdocext-doc_name,

lv_doc_id LIKE scprdocext-doc_id.

  • Declaration of local internal tables

DATA : li_dokhl TYPE STANDARD TABLE OF t_dokhl.

  • Declaration of local workareas

DATA : lwa_dokhl TYPE t_dokhl.

  • Call the FM to get the documentation name and id

CALL FUNCTION 'SCPR_DB_DOCU_GET'

EXPORTING

profid = wa_id-id

IMPORTING

doc_name = lv_doc_name

doc_id = lv_doc_id

EXCEPTIONS

docu_dont_exist = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Get the documentation id,object,language,version,typ

SELECT id

object

langu

typ

dokversion

FROM dokhl

INTO TABLE li_dokhl

WHERE langu = sy-langu

AND id = lv_doc_id

AND object = lv_doc_name.

IF sy-subrc EQ 0.

SORT li_dokhl BY dokversion DESCENDING.

ENDIF.

READ TABLE li_dokhl INTO lwa_dokhl INDEX 1.

IF sy-subrc EQ 0.

  • Call the FM to get the documentation details

CALL FUNCTION 'DOCU_READ'

EXPORTING

id = lwa_dokhl-id

langu = lwa_dokhl-langu

object = lwa_dokhl-object

typ = lwa_dokhl-typ

version = lwa_dokhl-dokversion

TABLES

line = i_lines.

ENDIF. "IF sy-subrc EQ 0.

ENDFORM. " get_documentation

&----


*& Form display_output

&----


  • Display the report output

----


FORM display_output .

  • Declaration of local workareas

DATA : lwa_activity TYPE scpr_activity,

lwa_lines TYPE tline.

  • Declaration of field symbols

FIELD-SYMBOLS : <lfs_descr> TYPE scpr_descr,

<lfs_flddescrs> TYPE t_scprrecord.

  • Declaration of local variable

DATA : lv_length TYPE i.

WRITE 😕 sy-uline(150).

FORMAT COLOR = 1 INTENSIFIED ON.

WRITE 😕 text-015.

WRITE 😕 sy-uline(150).

FORMAT COLOR OFF INTENSIFIED OFF.

  • To print the BCset id

WRITE :/2 text-004, 25 wa_id-id.

WRITE :/3 text-019, 26 wa_id-modifier.

WRITE :/4 text-020, 27 wa_id-moddate.

IF p_bcset IS NOT INITIAL.

  • To print the BCset shorttext

WRITE :/5 text-005, 26 v_text.

ENDIF.

FORMAT COLOR = 1 INTENSIFIED ON.

WRITE 😕 text-014.

WRITE 😕 sy-uline(150).

FORMAT COLOR OFF INTENSIFIED OFF.

LOOP AT i_ret INTO wa_ret.

IF p_img IS NOT INITIAL.

  • To print the IMG activity

WRITE :/6 text-006, 27 wa_ret-activity, 50 v_acttext.

ENDIF.

IF p_oblect IS NOT INITIAL.

  • To print the objectname

WRITE :/7 text-007, 28 wa_ret-objectname, 51 v_objtext.

ENDIF.

IF p_tables IS NOT INITIAL.

  • To print the tablename

WRITE :/8 text-008, 29 wa_ret-tablename, 52 v_tabtext.

ENDIF.

  • Clear the workarea

CLEAR wa_ret.

ENDLOOP.

SKIP.

FORMAT COLOR = 1 INTENSIFIED ON.

WRITE 😕 text-009.

WRITE 😕 sy-uline(150).

FORMAT COLOR OFF INTENSIFIED OFF.

SORT i_activities BY depth DESCENDING.

IF p_img IS NOT INITIAL.

  • To print the IMG Path

LOOP AT i_activities INTO lwa_activity.

NEW-LINE.

lv_length = STRLEN( lwa_activity-acttext ).

WRITE: '-> ', AT (lv_length) lwa_activity-acttext.

CLEAR : lwa_activity.

ENDLOOP. " LOOP AT i_activities INTO lwa_activity.

ENDIF.

SKIP.

  • To print the field overview

LOOP AT i_flddescrs ASSIGNING <lfs_flddescrs>.

WRITE :/2 text-010.

WRITE 😕 sy-uline(100).

FORMAT COLOR = 1 INTENSIFIED ON.

WRITE : /1 sy-vline, text-011,

31 sy-vline,text-012,

61 sy-vline,text-013,

100 sy-vline.

WRITE : sy-uline(100).

FORMAT COLOR OFF INTENSIFIED OFF.

LOOP AT <lfs_flddescrs>-descr ASSIGNING <lfs_descr>.

WRITE :/1 sy-vline,2 <lfs_descr>-fieldname,

31 sy-vline,32 <lfs_descr>-fieldtext,

61 sy-vline,62 <lfs_descr>-reptext,

100 sy-vline.

WRITE : sy-uline(100).

CLEAR <lfs_descr>.

ENDLOOP. " LOOP AT i_flddescrs ASSIGNING <lfs_descr>.

CLEAR <lfs_flddescrs>.

ENDLOOP. "LOOP AT <lfs_flddescrs>-descr ASSIGNING <lfs_flddescrs>.

SKIP.

IF p_docu IS NOT INITIAL.

FORMAT COLOR = 1 INTENSIFIED ON.

WRITE 😕 text-018.

WRITE 😕 sy-uline(150).

FORMAT COLOR OFF INTENSIFIED OFF.

  • Display the documentation in the output

LOOP AT i_lines INTO lwa_lines.

WRITE 😕 lwa_lines-tdline.

CLEAR lwa_lines.

ENDLOOP.

ENDIF.

SKIP 2.

ENDFORM. " display_output

*&----


*

*& Form save_as_pdf

*&----


*

  • Subroutine to save as PDF Format

*----


*

FORM save_as_pdf .

  • Declaration of local variables

DATA : lv_bytecount TYPE i,

lv_cancel(1) TYPE c,

lv_filename1 LIKE rlgrap-filename. "File name

  • Declaration of local constants

CONSTANTS: lc_pdf(4) TYPE c VALUE '.PDF'.

CONCATENATE c_c

sy-repid

lc_pdf

INTO lv_filename1.

  • Convert Spool to PDF

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = v_rqident

no_dialog = c_x

dst_device = v_print_parms-pdest

IMPORTING

pdf_bytecount = lv_bytecount

TABLES

pdf = i_pdf

EXCEPTIONS

err_no_abap_spooljob = 1

err_no_spooljob = 2

err_no_permission = 3

err_conv_not_possible = 4

err_bad_destdevice = 5

user_cancelled = 6

err_spoolerror = 7

err_temseerror = 8

err_btcjob_open_failed = 9

err_btcjob_submit_failed = 10

err_btcjob_close_failed = 11

OTHERS = 12.

IF sy-subrc NE 0.

REFRESH : i_pdf.

ENDIF.

IF p_pdf IS NOT INITIAL.

  • To Download to PDF format

PERFORM download_w_ext(rstxpdft) TABLES i_pdf

USING lv_filename1

lc_pdf

'BIN'

lv_bytecount

lv_cancel.

ENDIF.

ENDFORM. " save_as_pdf

&----


*& Form save_as_rtf

&----


  • Subroutine to save as RTF Format

----


FORM save_as_rtf .

  • Declaration of local variables

DATA : lv_filename2 LIKE rlgrap-filename. "File name

  • Declaration of local constants

CONSTANTS: lc_rtf(4) TYPE c VALUE '.RTF'.

CONCATENATE c_c

sy-repid

lc_rtf

INTO lv_filename2.

  • Call the FM to convert to RTF Format

CALL FUNCTION 'RSPO_DOWNLOAD_SPOOLJOB'

EXPORTING

id = v_rqident

fname = lv_filename2.

ENDFORM. " save_as_rtf

&----


*& Form report_header

&----


  • To display the report header

----


FORM report_header .

  • Declaration of local variable

DATA : lv_title TYPE string.

lv_title = text-017 .

*--This function module is to maintain Header for the report.

CALL FUNCTION 'Z_REPORT_HEADER'

EXPORTING

report_header = lv_title

line_size = c_linsz

EXCEPTIONS

user_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

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

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

ENDIF.

ENDFORM. " report_header

&----


*& Form display_selection_criteria

&----


  • Subroutine to display the selction criteria in the output

----


FORM display_selection_criteria .

CALL FUNCTION 'RS_LIST_SELECTION_TABLE'

EXPORTING

report = sy-repid

seltext = c_x

newpage = space

TABLES

sel_tab = i_seltable

EXCEPTIONS

sel_tab_empty = 1

OTHERS = 2.

IF sy-subrc <> 0.

REFRESH i_seltable.

ENDIF.

ENDFORM. " display_selection_criteria

Reward if helpful.

Regards,

Nagaraj

4 REPLIES 4

former_member404244
Active Contributor
0 Kudos

Hi,

chek the below code..

REPORT zxap_rpt_001r_bc_sets_printing NO STANDARD PAGE HEADING

LINE-SIZE 132

MESSAGE-ID zca.

************************************************************************

*TYPE POOLS *

************************************************************************

TYPE-POOLS : scpr.

************************************************************************

  • Tables Declaration *

************************************************************************

TABLES : scprtext, "BC Set: Short texts

tsp01. "Spool Requests

************************************************************************

  • Global Types Declaration *

************************************************************************

  • Type declaration for BCSet id's

TYPES : BEGIN OF t_id,

id TYPE scpr_id, "Business Configuration Set

moddate TYPE scpr_date, "Last Changed on

modifier TYPE scpr_modif, "Last Changed By

END OF t_id.

  • Type declaration for BCset records

TYPES: BEGIN OF t_scprrecord,

tabname LIKE scprdata-tablename, "Table name

tabtype LIKE objh-objecttype, "Table type

tabtext LIKE dd02t-ddtext, "Table text

tablen TYPE i, "Table length

keylen TYPE i, "Key length

objname LIKE objh-objectname, "Object name

objtype LIKE objh-objecttype, "Object type

activity LIKE scprreca-activity, "Activity

rawrec LENGTH scpr_maxdatalen, "Length

importable, "Importable

status(1), "Status

descr_reduced(1), "Desc reduced

descr TYPE scpr_flddescr OCCURS 10, "Table for fielddesc

sellist LIKE vimsellist OCCURS 10, "Table for sellist

header LIKE vimdesc OCCURS 10, "Table for header

namtab LIKE vimnamtab OCCURS 10, "Table for namtab

END OF t_scprrecord.

  • Type declaration for documentation

TYPES : BEGIN OF t_dokhl,

id TYPE doku_id, "Document class

object TYPE doku_obj, "Documentation Object

langu TYPE doku_langu, "Documentation language

typ TYPE doku_typ, "Documentation type

dokversion TYPE dokvers, "Version of document

END OF t_dokhl.

************************************************************************

  • Internal Tables Declaration *

************************************************************************

DATA :

  • Internal table for BCSet id's

i_id TYPE STANDARD TABLE OF t_id,

  • Internal table for Selection screen parameters

i_seltable TYPE STANDARD TABLE OF rsparams,

  • Internal table for tablename,activity,objectname

i_ret TYPE STANDARD TABLE OF scprreca,

  • Internal table for BC Set: Values

i_vals TYPE STANDARD TABLE OF scprvals,

  • Internal table for BC Set: Values

i_vall TYPE STANDARD TABLE OF scprvall,

  • Internal table for IMG activity

i_activities TYPE scpr_activities ,

  • Internal table for Field Overview

i_flddescrs TYPE scpr_records ,

  • Internal table for PDF

i_pdf TYPE STANDARD TABLE OF tline,

  • Internal table for documentation

i_lines TYPE STANDARD TABLE OF tline.

************************************************************************

  • Global Workareas Declaration *

************************************************************************

DATA :

  • Workarea for BCSet id's

wa_id TYPE t_id,

  • Workarea for tablename,activity,objectname

wa_ret TYPE scprreca.

************************************************************************

  • Global Variables *

************************************************************************

DATA : v_text TYPE scprtext-text, "BC Set: Description

v_acttext LIKE dsyst-doktitle, "Module Title

v_objtext LIKE objt-ddtext, "Explanatory short text

v_tabtext LIKE scprotabl-text, "BC Set: Table/view name

v_activity TYPE cus_act, "Customizing activity

v_print_parms LIKE pri_params, "Structure for Passing

"Print Parameters

v_rqident LIKE tsp01-rqident, "Spool request number

v_print TYPE pri_params-primm.

************************************************************************

  • Global Constants *

************************************************************************

CONSTANTS : c_linsz LIKE sy-linsz VALUE '132', "Constant for line size

c_c(4) TYPE c VALUE 'C:\' , "Constant for C:\

c_x(1) TYPE c VALUE 'X'. "Constant for X

*&----


*& Selection Screen Declaration

*&----


SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.

SELECT-OPTIONS : s_id FOR scprtext-id OBLIGATORY. "BC Set ID

SELECT-OPTIONS : s_change FOR sy-uname, "Last changed by

s_date FOR sy-datum. "Last Changed on

SELECTION-SCREEN : END OF BLOCK b1.

SELECTION-SCREEN : BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.

PARAMETERS : p_bcset AS CHECKBOX DEFAULT 'X', "BC Set Text

p_tables AS CHECKBOX DEFAULT 'X', "BC Set Tables and Views

p_img AS CHECKBOX DEFAULT 'X', "IMG Activity

p_oblect AS CHECKBOX DEFAULT 'X', "Customizing Object

p_docu AS CHECKBOX DEFAULT 'X'. "BC Set Documentation

SELECTION-SCREEN : END OF BLOCK b2.

SELECTION-SCREEN : BEGIN OF BLOCK b3 WITH FRAME TITLE text-003.

PARAMETERS : p_disp RADIOBUTTON GROUP rad1, "Display BC Set

p_print RADIOBUTTON GROUP rad1. "Print BC Set

SELECTION-SCREEN : END OF BLOCK b3.

SELECTION-SCREEN : BEGIN OF BLOCK b4 WITH FRAME TITLE text-016.

PARAMETERS : p_pdf RADIOBUTTON GROUP rad2, "Save as RTF

p_rtf RADIOBUTTON GROUP rad2. "Save as PDF

SELECTION-SCREEN : END OF BLOCK b4.

----


  • START-OF-SELECTION

----


START-OF-SELECTION.

  • To Get the User selection on selection screen

PERFORM get_selection_screen.

  • To Get the BCsets id

PERFORM get_data.

----


  • END-OF-SELECTION

----


END-OF-SELECTION.

IF NOT i_id[] IS INITIAL.

  • For printing

PERFORM print.

  • For outputting BCSet details

PERFORM bcset_details.

  • For getting the spool number

PERFORM get_spool_number.

  • For Printing Options

PERFORM print_options.

ENDIF. "IF NOT i_id[] IS INITIAL.

&----


*& Form get_selection_screen

&----


  • Subroutine to get the user selection on selection screen

----


FORM get_selection_screen .

CALL FUNCTION 'RS_REFRESH_FROM_SELECTOPTIONS'

EXPORTING

curr_report = sy-repid

TABLES

selection_table = i_seltable

EXCEPTIONS

not_found = 01

no_report = 02.

IF sy-subrc NE 0.

REFRESH i_seltable.

ENDIF.

ENDFORM. " get_selection_screen

&----


*& Form get_data

&----


  • Subroutine to get the BCsets id

----


FORM get_data .

  • Get the BCsets id

SELECT id

moddate

modifier

FROM scprattr INTO TABLE i_id

WHERE id IN s_id

AND moddate IN s_date

AND modifier IN s_change.

IF sy-subrc NE 0.

MESSAGE i007.

LEAVE LIST-PROCESSING.

ENDIF.

ENDFORM. " get_data

*&----


*

*& Form print

*&----


*

  • Subroutine for printing

*----


FORM print .

  • Declaration of local constants

CONSTANTS : lc_paart LIKE sy-paart VALUE 'X_65_132', " Paper Format

lc_locl TYPE sypdest VALUE 'LOCL'. " Destination

  • If print option is selected.

IF p_print IS NOT INITIAL.

MOVE c_x TO v_print.

ELSE.

CLEAR v_print.

ENDIF.

  • Setup the Print Parmaters

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING

authority = space

immediately = v_print

new_list_id = c_x

no_dialog = c_x

user = sy-uname

IMPORTING

out_parameters = v_print_parms

EXCEPTIONS

archive_info_not_found = 1

invalid_print_params = 2

invalid_archive_params = 3

OTHERS = 4.

IF sy-subrc NE 0.

CLEAR : v_print_parms.

ENDIF.

  • The printer destination has to be set up

IF v_print_parms-pdest = space.

v_print_parms-pdest = lc_locl.

ENDIF.

  • Explicitly set line width, and output format so that

  • the PDF conversion comes out OK

v_print_parms-linsz = c_linsz.

v_print_parms-paart = lc_paart.

ENDFORM. " print

&----


*& Form bcset_details

&----


  • Subroutine for bcset details

----


FORM bcset_details .

NEW-PAGE PRINT ON PARAMETERS v_print_parms NO DIALOG.

LOOP AT i_id INTO wa_id.

IF sy-index <> 1.

NEW-PAGE.

  • For Printing the report header

PERFORM report_header.

  • TO display the selction criteria in the output

IF sy-pagno EQ 1.

PERFORM display_selection_criteria.

ENDIF. " IF sy-pagno EQ 1.

ENDIF. "IF sy-index <> 1.

  • Get the BCset short text

PERFORM get_text.

  • Get the IMG activity objectname and tablename

PERFORM get_activity.

LOOP AT i_ret INTO wa_ret.

  • Get the short text for the IMG activity

PERFORM get_activity_text.

  • Get the short text for the objectname

PERFORM get_object_text.

  • Get the short text for the table

PERFORM get_table_text.

  • Get the IMG path

PERFORM get_img_path.

  • Get the Field Overview

PERFORM get_field_overview.

  • Clear Workareas

CLEAR : wa_ret.

ENDLOOP. "LOOP AT i_ret INTO wa_ret.

IF p_docu IS NOT INITIAL.

  • GET the documentation of the bc set

PERFORM get_documentation.

ENDIF.

  • IF display option is selected on selection screen

PERFORM display_output.

WRITE 😕 sy-uline.

  • Clear workareas and variables

CLEAR : wa_id,

v_text,

v_activity.

  • Refresh the internal table

REFRESH : i_lines,

i_ret.

ENDLOOP. "LOOP AT i_id INTO wa_id

NEW-PAGE PRINT OFF.

ENDFORM. " bcset_details

*&----


*

*& Form get_spool_number

*&----


*

  • Subroutine to get the spool number

*----


*

FORM get_spool_number .

  • Declaration of local variables.

DATA:

lv_rq2name LIKE tsp01-rq2name.

CONCATENATE sy-repid+0(8)

sy-uname+0(3)

INTO lv_rq2name SEPARATED BY '_'.

  • Get the spool number.

SELECT * FROM tsp01 WHERE rq2name = lv_rq2name

ORDER BY rqcretime DESCENDING.

v_rqident = tsp01-rqident.

EXIT.

ENDSELECT.

IF sy-subrc NE 0.

CLEAR v_rqident.

ENDIF.

ENDFORM. " get_spool_number

&----


*& Form print_options

&----


  • Subroutine for print options

----


FORM print_options .

IF p_disp IS NOT INITIAL.

  • To display the list in the output

CALL FUNCTION 'RSPO_DISPLAY_SPOOLJOB'

EXPORTING

rqident = v_rqident

first_line = 1

last_line = 0.

ENDIF.

  • If PDF option is selected on selection screen

IF p_pdf IS NOT INITIAL.

PERFORM save_as_pdf.

ENDIF.

  • If RTF option is selected on selection screen

IF p_rtf IS NOT INITIAL.

PERFORM save_as_rtf.

ENDIF.

ENDFORM. " print_options

&----


*& Form get_text

&----


  • Subroutine to get the BCset short text

----


FORM get_text .

CALL FUNCTION 'SCPR_TEXT_GET'

EXPORTING

profid = wa_id-id

langu = sy-langu

IMPORTING

proftext = v_text

EXCEPTIONS

no_text_found = 1

OTHERS = 2.

IF sy-subrc NE 0.

CLEAR v_text.

ENDIF.

ENDFORM. " get_text

&----


*& Form get_activity

&----


  • Subroutine to get the IMG activity objectname and tablename

----


FORM get_activity .

CALL FUNCTION 'SCPR_TEMPL_DB_DATA_READ_BCSET'

EXPORTING

bcset_id = wa_id-id

TABLES

recattr = i_ret

values = i_vals

valuesl = i_vall.

DELETE ADJACENT DUPLICATES FROM i_ret COMPARING id.

ENDFORM. " get_activity

&----


*& Form get_activity_text

&----


  • Subroutine to get the short text for the IMG activity

----


FORM get_activity_text .

CALL FUNCTION 'SCPR_IMG_DB_ACT_TEXT_GET'

EXPORTING

activity = wa_ret-activity

IMPORTING

activity_text = v_acttext.

ENDFORM. " get_activity_text

&----


*& Form get_object_text

&----


  • Subroutine to get the short text for the objectname

----


FORM get_object_text .

CALL FUNCTION 'SCPR_DB_COBJ_TEXT_GET'

EXPORTING

objname = wa_ret-objectname

objtype = wa_ret-objecttype

IMPORTING

objtext = v_objtext.

ENDFORM. " get_object_text

&----


*& Form get_table_text

&----


  • subroutine to get short text for the table

----


FORM get_table_text .

CALL FUNCTION 'SCPR_DB_TABLE_TEXT_GET'

EXPORTING

tabname = wa_ret-tablename

IMPORTING

tabtext = v_tabtext.

ENDFORM. " get_table_text

&----


*& Form get_img_path

&----


  • Subroutine to get the IMG path

----


FORM get_img_path .

v_activity = wa_ret-activity.

CALL FUNCTION 'SCPR_IMG_DB_ACT_GET_FATHERS'

EXPORTING

custact = v_activity

TABLES

activities = i_activities.

ENDFORM. " get_img_path

&----


*& Form get_field_overview

&----


  • Subroutine to get the field overview

----


FORM get_field_overview .

CALL FUNCTION 'SCPR_PRSET_DB_FLDDESCRS_GET'

EXPORTING

flddescr_reduc = 'X'

TABLES

recattr = i_ret

flddescrs = i_flddescrs.

ENDFORM. " get_field_overview

&----


*& Form get_documentation

&----


  • Subroutine to get the documentation

----


FORM get_documentation .

  • Declaration of local variables

DATA: lv_doc_name LIKE scprdocext-doc_name,

lv_doc_id LIKE scprdocext-doc_id.

  • Declaration of local internal tables

DATA : li_dokhl TYPE STANDARD TABLE OF t_dokhl.

  • Declaration of local workareas

DATA : lwa_dokhl TYPE t_dokhl.

  • Call the FM to get the documentation name and id

CALL FUNCTION 'SCPR_DB_DOCU_GET'

EXPORTING

profid = wa_id-id

IMPORTING

doc_name = lv_doc_name

doc_id = lv_doc_id

EXCEPTIONS

docu_dont_exist = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

  • Get the documentation id,object,language,version,typ

SELECT id

object

langu

typ

dokversion

FROM dokhl

INTO TABLE li_dokhl

WHERE langu = sy-langu

AND id = lv_doc_id

AND object = lv_doc_name.

IF sy-subrc EQ 0.

SORT li_dokhl BY dokversion DESCENDING.

ENDIF.

READ TABLE li_dokhl INTO lwa_dokhl INDEX 1.

IF sy-subrc EQ 0.

  • Call the FM to get the documentation details

CALL FUNCTION 'DOCU_READ'

EXPORTING

id = lwa_dokhl-id

langu = lwa_dokhl-langu

object = lwa_dokhl-object

typ = lwa_dokhl-typ

version = lwa_dokhl-dokversion

TABLES

line = i_lines.

ENDIF. "IF sy-subrc EQ 0.

ENDFORM. " get_documentation

&----


*& Form display_output

&----


  • Display the report output

----


FORM display_output .

  • Declaration of local workareas

DATA : lwa_activity TYPE scpr_activity,

lwa_lines TYPE tline.

  • Declaration of field symbols

FIELD-SYMBOLS : <lfs_descr> TYPE scpr_descr,

<lfs_flddescrs> TYPE t_scprrecord.

  • Declaration of local variable

DATA : lv_length TYPE i.

WRITE 😕 sy-uline(150).

FORMAT COLOR = 1 INTENSIFIED ON.

WRITE 😕 text-015.

WRITE 😕 sy-uline(150).

FORMAT COLOR OFF INTENSIFIED OFF.

  • To print the BCset id

WRITE :/2 text-004, 25 wa_id-id.

WRITE :/3 text-019, 26 wa_id-modifier.

WRITE :/4 text-020, 27 wa_id-moddate.

IF p_bcset IS NOT INITIAL.

  • To print the BCset shorttext

WRITE :/5 text-005, 26 v_text.

ENDIF.

FORMAT COLOR = 1 INTENSIFIED ON.

WRITE 😕 text-014.

WRITE 😕 sy-uline(150).

FORMAT COLOR OFF INTENSIFIED OFF.

LOOP AT i_ret INTO wa_ret.

IF p_img IS NOT INITIAL.

  • To print the IMG activity

WRITE :/6 text-006, 27 wa_ret-activity, 50 v_acttext.

ENDIF.

IF p_oblect IS NOT INITIAL.

  • To print the objectname

WRITE :/7 text-007, 28 wa_ret-objectname, 51 v_objtext.

ENDIF.

IF p_tables IS NOT INITIAL.

  • To print the tablename

WRITE :/8 text-008, 29 wa_ret-tablename, 52 v_tabtext.

ENDIF.

  • Clear the workarea

CLEAR wa_ret.

ENDLOOP.

SKIP.

FORMAT COLOR = 1 INTENSIFIED ON.

WRITE 😕 text-009.

WRITE 😕 sy-uline(150).

FORMAT COLOR OFF INTENSIFIED OFF.

SORT i_activities BY depth DESCENDING.

IF p_img IS NOT INITIAL.

  • To print the IMG Path

LOOP AT i_activities INTO lwa_activity.

NEW-LINE.

lv_length = STRLEN( lwa_activity-acttext ).

WRITE: '-> ', AT (lv_length) lwa_activity-acttext.

CLEAR : lwa_activity.

ENDLOOP. " LOOP AT i_activities INTO lwa_activity.

ENDIF.

SKIP.

  • To print the field overview

LOOP AT i_flddescrs ASSIGNING <lfs_flddescrs>.

WRITE :/2 text-010.

WRITE 😕 sy-uline(100).

FORMAT COLOR = 1 INTENSIFIED ON.

WRITE : /1 sy-vline, text-011,

31 sy-vline,text-012,

61 sy-vline,text-013,

100 sy-vline.

WRITE : sy-uline(100).

FORMAT COLOR OFF INTENSIFIED OFF.

LOOP AT <lfs_flddescrs>-descr ASSIGNING <lfs_descr>.

WRITE :/1 sy-vline,2 <lfs_descr>-fieldname,

31 sy-vline,32 <lfs_descr>-fieldtext,

61 sy-vline,62 <lfs_descr>-reptext,

100 sy-vline.

WRITE : sy-uline(100).

CLEAR <lfs_descr>.

ENDLOOP. " LOOP AT i_flddescrs ASSIGNING <lfs_descr>.

CLEAR <lfs_flddescrs>.

ENDLOOP. "LOOP AT <lfs_flddescrs>-descr ASSIGNING <lfs_flddescrs>.

SKIP.

IF p_docu IS NOT INITIAL.

FORMAT COLOR = 1 INTENSIFIED ON.

WRITE 😕 text-018.

WRITE 😕 sy-uline(150).

FORMAT COLOR OFF INTENSIFIED OFF.

  • Display the documentation in the output

LOOP AT i_lines INTO lwa_lines.

WRITE 😕 lwa_lines-tdline.

CLEAR lwa_lines.

ENDLOOP.

ENDIF.

SKIP 2.

ENDFORM. " display_output

*&----


*

*& Form save_as_pdf

*&----


*

  • Subroutine to save as PDF Format

*----


*

FORM save_as_pdf .

  • Declaration of local variables

DATA : lv_bytecount TYPE i,

lv_cancel(1) TYPE c,

lv_filename1 LIKE rlgrap-filename. "File name

  • Declaration of local constants

CONSTANTS: lc_pdf(4) TYPE c VALUE '.PDF'.

CONCATENATE c_c

sy-repid

lc_pdf

INTO lv_filename1.

  • Convert Spool to PDF

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = v_rqident

no_dialog = c_x

dst_device = v_print_parms-pdest

IMPORTING

pdf_bytecount = lv_bytecount

TABLES

pdf = i_pdf

EXCEPTIONS

err_no_abap_spooljob = 1

err_no_spooljob = 2

err_no_permission = 3

err_conv_not_possible = 4

err_bad_destdevice = 5

user_cancelled = 6

err_spoolerror = 7

err_temseerror = 8

err_btcjob_open_failed = 9

err_btcjob_submit_failed = 10

err_btcjob_close_failed = 11

OTHERS = 12.

IF sy-subrc NE 0.

REFRESH : i_pdf.

ENDIF.

IF p_pdf IS NOT INITIAL.

  • To Download to PDF format

PERFORM download_w_ext(rstxpdft) TABLES i_pdf

USING lv_filename1

lc_pdf

'BIN'

lv_bytecount

lv_cancel.

ENDIF.

ENDFORM. " save_as_pdf

&----


*& Form save_as_rtf

&----


  • Subroutine to save as RTF Format

----


FORM save_as_rtf .

  • Declaration of local variables

DATA : lv_filename2 LIKE rlgrap-filename. "File name

  • Declaration of local constants

CONSTANTS: lc_rtf(4) TYPE c VALUE '.RTF'.

CONCATENATE c_c

sy-repid

lc_rtf

INTO lv_filename2.

  • Call the FM to convert to RTF Format

CALL FUNCTION 'RSPO_DOWNLOAD_SPOOLJOB'

EXPORTING

id = v_rqident

fname = lv_filename2.

ENDFORM. " save_as_rtf

&----


*& Form report_header

&----


  • To display the report header

----


FORM report_header .

  • Declaration of local variable

DATA : lv_title TYPE string.

lv_title = text-017 .

*--This function module is to maintain Header for the report.

CALL FUNCTION 'Z_REPORT_HEADER'

EXPORTING

report_header = lv_title

line_size = c_linsz

EXCEPTIONS

user_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

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

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

ENDIF.

ENDFORM. " report_header

&----


*& Form display_selection_criteria

&----


  • Subroutine to display the selction criteria in the output

----


FORM display_selection_criteria .

CALL FUNCTION 'RS_LIST_SELECTION_TABLE'

EXPORTING

report = sy-repid

seltext = c_x

newpage = space

TABLES

sel_tab = i_seltable

EXCEPTIONS

sel_tab_empty = 1

OTHERS = 2.

IF sy-subrc <> 0.

REFRESH i_seltable.

ENDIF.

ENDFORM. " display_selection_criteria

Reward if helpful.

Regards,

Nagaraj

Former Member
0 Kudos

Hi,

For generating spool you just need to call FM

'RSPO_SX_OUTPUT_TEXTDATA'.

Like :

DATA: BEGIN OF it_bukrs OCCURS 0,

bukrs LIKE t001k-bukrs,

END OF it_bukrs.

Data : g_splid TYPE rspoid ,

l_lines TYPE i.

SELECT DISTINCT bukrs FROM t001k INTO TABLE it_bukrs.

DESCRIBE TABLE it_bukrs LINES l_lines.

CALL FUNCTION 'RSPO_SX_OUTPUT_TEXTDATA'

EXPORTING

dest = g_lprnt "LOJP ur default printer name

rows = l_lines "No of lines passed to spool in table

startrow = 1

pages = 99

rqtitle = 'Batch Data Processing:-Error Log'(010) " Title indicated in SP02

immediately = space

IMPORTING

rqid = g_splid " Spool request no

TABLES

text_data = it_bukrs " data to be passed to spool.

EXCEPTIONS

name_missing = 1

name_twice = 2

not_found = 3

illegal_layout = 4

internal_error = 5

size_mismatch = 6

OTHERS = 7. "#EC NOTEXT

IF sy-subrc EQ 0.

ENDIF.

Message was edited by:

Anonymous

0 Kudos

THNKX DUDE

U SOLVED MA PROBLEM

REGARDS

BHANU

former_member223537
Active Contributor
0 Kudos
REPORT demo NO STANDARD PAGE HEADING. 

DATA: spfli_wa TYPE spfli, 
      sflight_wa TYPE sflight. 

DATA: print_parameters TYPE pri_params, 
      valid_flag       TYPE c LENGTH 1. 

START-OF-SELECTION. 

  CALL FUNCTION 'GET_PRINT_PARAMETERS' 
    IMPORTING 
      out_parameters       = print_parameters 
      valid                = valid_flag 
    EXCEPTIONS 
      invalid_print_params = 2 
      OTHERS               = 4. 

  IF valid_flag = 'X' AND sy-subrc = 0. 
    SELECT carrid connid 
           FROM spfli 
           INTO CORRESPONDING FIELDS OF spfli_wa. 
      WRITE: / spfli_wa-carrid, spfli_wa-connid. 
      HIDE:    spfli_wa-carrid, spfli_wa-connid. 
    ENDSELECT. 
  ELSE. 
    ... 
  ENDIF. 

AT LINE-SELECTION. 
  NEW-PAGE PRINT ON PARAMETERS print_parameters 
                    NO DIALOG. 
  SELECT * 
         FROM sflight 
         INTO sflight_wa 
         WHERE carrid = spfli_wa-carrid AND 
               connid = spfli_wa-connid. 
    WRITE: / sflight_wa-carrid, sflight_wa-connid, 
             sflight_wa-fldate ... 
  ENDSELECT. 
  NEW-PAGE PRINT OFF.