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: 

Enquiry in taking printout

Former Member
0 Kudos

Hi frnds,

On executing my report program, I need to take the print from the internal table values.

Can anyone help.

Pooja

1 REPLY 1

Former Member
0 Kudos

Hi

Try like this by scheduling your report in background by writing the following code in your report and defining the print paramaters

IF p_bjob = 'X'.

CONCATENATE sy-cprog sy-datum sy-uzeit

INTO jobname SEPARATED BY '_'.

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = jobname

IMPORTING

jobcount = jobcount

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

CALL FUNCTION 'GET_PRINT_PARAMETERS'

IMPORTING

out_archive_parameters = arc_params

out_parameters = print_params

valid = valid

EXCEPTIONS

archive_info_not_found = 1

invalid_print_params = 2

invalid_archive_params = 3

OTHERS = 4.

IF valid = chk.

SUBMIT ZCUSTOMERREP

WITH s_cust IN s_cust

AND RETURN

USER sy-uname

VIA JOB jobname

NUMBER jobcount

TO SAP-SPOOL

SPOOL PARAMETERS print_params

ARCHIVE PARAMETERS arc_params

WITHOUT SPOOL DYNPRO.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = jobcount

jobname = jobname

strtimmed = 'X'

EXCEPTIONS

cant_start_immediate = 1

invalid_startdate = 2

jobname_missing = 3

job_close_failed = 4

job_nosteps = 5

job_notex = 6

lock_failed = 7

invalid_target = 8

OTHERS = 9.

IF sy-subrc <> 0.

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

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

ELSE.

MESSAGE i029 WITH jobname.

ENDIF.

ELSE.

MESSAGE s000 WITH text-003.

STOP.

ENDIF.

ENDIF.

Regards

Anji