Application Development and Automation 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: 
Read only

Function Module to print

Former Member
0 Likes
4,428

Hi all,

Anyone knows a function module that could perform print function?

Thanks all.

6 REPLIES 6
Read only

athavanraja
Active Contributor
0 Likes
1,754

print what ABAP list?

if yes

call function 'GET_PRINT_PARAMETERS'
       exporting
            destination    = loc_dest
            copies         = wf_copies
            list_name      = wf_listname
            list_text      = wf_listtext
            immediately    = 'X'
            release        = ' '
            new_list_id    = 'X'
            expiration     = wf_days
            line_size      = 200
            line_count     = 65
            layout         = 'X_65_200'
            sap_cover_page = 'X'
            receiver       = 'SAP*'
            department     = ''
            no_dialog      = 'X'
       importing
            out_parameters = wf_params
            valid          = wf_valid.

  if wf_valid <> space.
    new-page print on parameters wf_params no dialog.
    perform write_summary .
    new-page print off.
  endif .

inthe above code do the normal write within the form write_summary.

and in the function if you pass 'X' to immediately it will print immediately and if you pass blank, it will create a spool request

Regards

Raja

Read only

Former Member
0 Likes
1,754

You can use the following function to print a report

CALL FUNCTION 'PRINT_REPORT'

EXPORTING

NO_DIALOG = ' '

REPORT = L_REPID

EXCEPTIONS

ARCHIVE_INFO_NOT_FOUND = 1

OTHERS = 2.

Read only

Former Member
0 Likes
1,754

Hi,

You can try the function module SET_PRINT_PARAMETERS

Regards,

Ruthra

Read only

Former Member
0 Likes
1,754

Hi,

<b>Setting Print Parameters from within the Program</b>

If you use the print statements

1) NEW-PAGE PRINT ON

2) SUBMIT ... TO SAP-SPOOL

3) CALL FUNCTION 'JOB-SUBMIT'

you set the print parameters from within the program, using the corresponding options of the print statements. You can either display or suppress the Print parameters dialog box.

To ensure that the parameters are sent to the spool system properly and completely, you should always transfer the entire parameter set with the print statements. To create a parameter set, use the function module <b>GET_PRINT_PARAMETERS.</b>

Regards

Sudheer

Read only

Former Member
0 Likes
1,754

You can also view the following code :

  • Normal definition of the print parameters

DATA: PARAMS LIKE PRI_PARAMS,

VALID TYPE C.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING DESTINATION = 'LT50'

IMPORTING OUT_PARAMETERS = PARAMS

VALID = VALID.

IF VALID <> SPACE.

NEW-PAGE PRINT ON PARAMETERS PARAMS.

ENDIF.

  • Definition of the parameters for printing and archiving

DATA: PRI_PARAMS LIKE PRI_PARAMS,

ARC_PARAMS LIKE ARC_PARAMS,

VALID TYPE C.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

IMPORTING OUT_PARAMETERS = PRI_PARAMS

OUT_ARCHIVE_PARAMETERS = ARC_PARAMS

VALID = VALID.

IF VALID <> SPACE.

NEW-PAGE PRINT ON PARAMETERS PRI_PARAMS

ARCHIVE PARAMETERS ARC_PARAMS.

ENDIF.

  • Definition of the parameters for a background job

DATA: PARAMS LIKE PRI_PARAMS,

VALID TYPE C.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

EXPORTING MODE = 'BATCH'

REPORT = 'MYREPORT'

IMPORTING OUT_PARAMETERS = PARAMS

VALID = VALID.

IF VALID <> SPACE.

CALL FUNCTION 'JOB_OPEN' .... EXPORTING JOBCOUNT ...

SUBMIT MYREPORT VIA JOB 'MY_JOB' NUMBER JOBCOUNT

TO SAP-SPOOL WITHOUT SPOOL DYNPRO

SPOOL PARAMTERS PARAMS.

CALL FUNCTION 'JOB_CLOSE' ...

ENDIF.

  • Modifying the print parameters

CALL FUNCTION 'GET_PRINT_PARAMETERS' "Obtain print

EXPORTING NO_DIALOG = 'X' "parameters

IMPORTING OUT_PARAMETERS = PARAMS.

...

CALL FUNCTION 'GET_PRINT_PARAMETERS' "Modify print

EXPORTING NO_DIALOG = 'X' "parameters

IN_PARAMETERS = PARAMS

LIST_NAME = 'NEW-LIST'

IMPORTING OUT_PARAMETERS = PARAMS.

Read only

Former Member
0 Likes
1,754

@ all, thank you all!