Skip to Content
0
Former Member
Apr 23, 2009 at 10:48 AM

how to use in submit with variant

3191 Views

Dear Freinds

As per the my requirement from my program i want to send the data to spool and from tehre i want to download as PDF .

for the standard program i have a variant . I want to use the variant which has been set for the standard program , but when iam using the below code it is calling the selection scren of the standar program and then i have execute that

standard program then only data going to spool

i dont want to have the selection and further me executing the standard program , i want the program to send the data directly to spool , i dont want to go to selection screen at all.

please correct me where i went wrong .

data :v_linsz LIKE sy-linsz value '132', " Line size

v_paart LIKE sy-paart value 'X_65_132'. " Paper Format

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = lv_job_name

IMPORTING

jobcount = lv_job_nr

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

if sy-subrc eq 0.

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

*-- Explicitly set line width, and output format so that

*-- the PDF conversion comes out OK

mstr_print_parms-linsz = v_linsz.

mstr_print_parms-paart = v_paart.

IF mstr_print_parms-pdest = space.

mstr_print_parms-pdest = 'LOCL'.

ENDIF.

SUBMIT RPCEDTX0

TO SAP-SPOOL WITHOUT SPOOL DYNPRO

SPOOL PARAMETERS mstr_print_parms

VIA SELECTION-SCREEN USING SELECTION-SET 'ZPDF'

VIA JOB lv_job_name NUMBER lv_job_nr

AND RETURN.

IF sy-subrc = 0.

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = lv_job_nr

jobname = lv_job_name

strtimmed = 'X'

IMPORTING

job_was_released = lv_job_released

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 syst-subrc NE 0.

MESSAGE i162(00) WITH

'An error occured while closing the background job.'.

STOP.

ENDIF.

ENDIF.

endif.

Please correct me or give me some sample code where it doesnt call thle selections screen and only pass the values and return using the variant .

regards

divya