05-09-2006 4:42 PM
hi guys,
i have a problem to perform batch printing and process batch printing at a button click and here is the detail explanation of the problem.
The Front End Screen will be a selection screen with (1) radio buttons listing all form letters, a field for Date of the form, (2) a field for Employee Number (PERNR), (3) a field for Request Date, (4) a field for Request Reason, (5) <b>a selection for Print Now or Print Batch</b>, and (6) <b>a Process Batch button</b>.
when Radio Button for one of the Forms selected, the User will then select the Print Now or Print Batch option. If the Print Now option was selected, the selected form will be immediately generated and printed. If the Print Batch option has been selected, the data on the Front End Screen will be stored in a batch file for processing and printing en masse.
Screen when ready to print the batch file of forms. When the Process Batch button is selected, any forms that are stored in the batch file are then processed (created and printed). Forms may be printed multiple times (one for the employee, one for the employees supervisor and one for the personnel file). Each form detailed below will indicate the number of copies to be printed.
05-17-2006 3:55 PM
You would not try to buffer output in a file.
You should create a batch job with start date 99991231 and add printing programs to it as new steps when you click on button 'print batch'.
Then when you click on 'process batch' you release the job with flag 'immediate'.
05-17-2006 5:02 PM
hi François Henrotte,
i am really new to smartforms, Can u please explain in detail the process of "Print Batch" and " process Batch".
if u have sample code that would be really helpful.
05-24-2006 1:43 PM
Printing a Smartform is always about calling the function module generated for this form. Calling the FM is done from a printing program.
Put this program into a job using
CALL FUNCTION 'JOB_OPEN'
EXPORTING
jobname = name
IMPORTING
jobcount = number
EXCEPTIONS
cant_create_job = 1
invalid_job_data = 2
jobname_missing = 3
OTHERS = 4.
IF sy-subrc = 0.
" FOR each PERNR
SUBMIT submitable TO SAP-SPOOL
SPOOL PARAMETERS print_parameters
WITHOUT SPOOL DYNPRO
VIA JOB name NUMBER number
AND RETURN.
ENDIF.
then when you want to execute the job, call this:
CALL FUNCTION 'JOB_CLOSE'
EXPORTING
jobcount = number
jobname = 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.