0% found this document useful (0 votes)
380 views

Program To Trigger A Output During A Program

This document summarizes a program that prints an output using a specified document number. It opens a job, submits a report to print with the given parameters, and then closes the job if it was submitted successfully.

Uploaded by

KarunGaur
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
380 views

Program To Trigger A Output During A Program

This document summarizes a program that prints an output using a specified document number. It opens a job, submits a report to print with the given parameters, and then closes the job if it was submitted successfully.

Uploaded by

KarunGaur
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 1

FORM OUTPUT USING P_WA_ITEM_DOCUMENT_NUMB.

DATA: lv_number TYPE tbtcjob-jobcount,


lv_name TYPE tbtcjob-jobname VALUE 'PRINT_OUTPUT',
lv_print_parameters TYPE pri_params.

CALL FUNCTION 'JOB_OPEN'


EXPORTING
jobname = lv_name
IMPORTING
jobcount = lv_number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.

SUBMIT rsnast00 WITH s_kappl = 'V2'


WITH s_objky = P_WA_ITEM_DOCUMENT_NUMB
WITH s_kschl = 'WMTA'
TO SAP-SPOOL
SPOOL PARAMETERS lv_print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB lv_name NUMBER lv_number
AND RETURN.

IF sy-subrc = 0.
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = lv_number
jobname = lv_name
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
OTHERS = 8.
IF sy-subrc <> 0.
...
ENDIF.
ENDIF.
ENDIF.
ENDFORM.

You might also like