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: 

CONVERT_ABAPSPOOLJOB_2_PDF doesnt prompt to save the filename

Former Member
0 Kudos

Dear all

Here with this i m getting the spool but CONVERT_ABAPSPOOLJOB_2_PDF doesnt prompt to save the PDF file . Do i need to use GUI_DOWNLOAD along with this .

PlllllZZZZZZ...... suggest

SELECT SINGLE * FROM ZPLH WHERE VBELN = SSORD

AND POSNR = ITNO.

IF SY-SUBRC EQ 0.

DATA : v_jobcount LIKE tbtcjob-jobcount,

ZTEST LIKE TBTCJOB-JOBNAME.

*-- run in the background

CALL FUNCTION 'JOB_OPEN'

EXPORTING

jobname = 'ZTEST'

IMPORTING

jobcount = v_jobcount

EXCEPTIONS

cant_create_job = 1

invalid_job_data = 2

jobname_missing = 3

OTHERS = 4.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE 'E' NUMBER sy-msgno

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

EXIT.

ENDIF.

*-- submit the program in the background

SUBMIT ZPP_REP_ENCLOSURE_PACKLIST3

WITH JOBNO = SSORD

WITH LINENO = ITNO

USER sy-uname

TO SAP-SPOOL WITHOUT SPOOL DYNPRO

DESTINATION 'LOHP'

IMMEDIATELY 'X'

KEEP IN SPOOL 'X'

VIA JOB 'ZTEST' NUMBER v_jobcount AND RETURN.

IF SY-SUBRC = 0.

  • * Job scheduled successfully

ENDIF.

IF SY-SUBRC = 4.

  • *Job scheduling terminated by user

ENDIF.

IF SY-SUBRC = 8.

  • *Error in job scheduling (JOB_SUBMIT)

ENDIF.

IF SY-SUBRC = 12.

  • *Error in internal number assignment .

ENDIF.

*-- close the job

CALL FUNCTION 'JOB_CLOSE'

EXPORTING

jobcount = v_jobcount

jobname = 'ZTEST'

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.

  • MESSAGE ID sy-msgid TYPE 'W' NUMBER sy-msgno

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

ENDIF.

clear tbtcp.

STEP = 1.

select single listident from tbtcp

into tbtcp-listident

where jobname = 'ZTEST'

and jobcount = v_jobcount

and stepcount = step.

IF SY-SUBRC EQ 0.

move tbtcp-listident to spool_id.

ENDIF.

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

SRC_SPOOLID = SPOOL_ID

NO_DIALOG = ''

  • DST_DEVICE = 'LOHP' "E_DEVTYPE

  • PDF_DESTINATION = 'LOHP'

IMPORTING

PDF_BYTECOUNT = BTC

  • PDF_SPOOLID =

  • LIST_PAGECOUNT =

  • BTC_JOBNAME =

  • BTC_JOBCOUNT =

TABLES

PDF = T_SPOOL_2_PDF

EXCEPTIONS

ERR_NO_ABAP_SPOOLJOB = 1

ERR_NO_SPOOLJOB = 2

ERR_NO_PERMISSION = 3

ERR_CONV_NOT_POSSIBLE = 4

ERR_BAD_DESTDEVICE = 5

USER_CANCELLED = 6

ERR_SPOOLERROR = 7

ERR_TEMSEERROR = 8

ERR_BTCJOB_OPEN_FAILED = 9

ERR_BTCJOB_SUBMIT_FAILED = 10

ERR_BTCJOB_CLOSE_FAILED = 11

OTHERS = 12

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ELSE.

TEXT02 = ITNO.

MESSAGE I014(ZQOTBANK) WITH TEXT02.

ENDIF.

Thnx

Moni

2 REPLIES 2

FredericGirod
Active Contributor
0 Kudos

Hi MD,

I download the result of the function like this :

call function 'CONVERT_OTFSPOOLJOB_2_PDF'

exporting

src_spoolid = v_spoolid

NO_DIALOG = 'X'

IMPORTING

PDF_BYTECOUNT = v_numbytes

TABLES

PDF = it_pdf.

call function 'DOWNLOAD'

exporting

bin_filesize = v_numbytes

filetype = 'BIN'

importing

act_filename = v_filename

tables

data_tab = it_pdf.

Regards

Frédéric

Lakshmant1
Active Contributor
0 Kudos

Hi Monirujjaman,

Have a look at demo program RSTXPDFT4.

Thanks

Lakshman