cancel
Showing results for 
Search instead for 
Did you mean: 

CONVERT_OTFSPOOLJOB_2_PDF is not working with more than 200 pages

Former Member
0 Kudos

HI all,

i am trying to print out Inspection Results (OTFs generated by QGA3 Transaction) via the CONVERT_OTFSPOOLJOB_2_PDF funtion module.

But if the Inspection Results have more than 200 pages the FM only creates a PDF without content.

The PDF is there but it has 0 bytes.

This is how i fill the FM:

CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = i_spool

no_dialog = 'X'

IMPORTING

pdf_bytecount = wl_numbytes

pdf_spoolid = wl_pdfspoolid

btc_jobname = wl_jobname

btc_jobcount = wl_jobcount

TABLES

pdf = tl_pdf

EXCEPTIONS

err_no_otf_spooljob = 1

err_no_spooljob = 2

err_no_permission = 3

err_conv_not_possible = 4

err_bad_dstdevice = 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.

Does anyone have an idea ?

Thanks and Regards

Volker

Accepted Solutions (0)

Answers (1)

Answers (1)

brad_bohn
Active Contributor
0 Kudos

That's because the function reverts to background processing when the page size is over 99 pages (see the code). I posted how to handle this a while back but basically you can either use RSPO_RETURN_SPOOLJOB directly or you can continue to use your current function but you have to poll for the completion of the job (BP_JOB_STATUS_GET) and then get the resulting spool in RAW format with RSPO_RETURN_SPOOLJOB then convert it:


FIELD-SYMBOLS: <fs_line> TYPE x.
DATA: gv_pdf TYPE xstring.

CALL FUNCTION 'RSPO_RETURN_SPOOLJOB'
  EXPORTING
    rqident              = p_spono
    desired_type         = 'RAW'
  TABLES
    buffer               = gt_buffer
  EXCEPTIONS
    no_such_job          = 1
    job_contains_no_data = 2
    selection_empty      = 3
    no_permission        = 4
    can_not_access       = 5
    read_error           = 6
    type_no_match        = 7
    OTHERS               = 8.

LOOP AT gt_buffer INTO gs_buffer.
  ASSIGN gs_buffer TO <fs_line> CASTING TYPE x.
  CONCATENATE gv_pdf <fs_line> INTO gv_pdf IN BYTE MODE.
ENDLOOP.