cancel
Showing results for 
Search instead for 
Did you mean: 

PDF Printing Issue (Converting to Spool and back to PDF)

Former Member
0 Kudos

Hi,

I have a document which has minimum of 25 pages. This document is designed using BSP. When i print this document in DEV this is printed without any issue, but when we print in QA this doesn't print and keeps going on and on and finally we get session time out.

And now we got some information that this issue occurs because of Memory Management. So now we have to convert the data first to spool and from the spool we have to convert the same to PDF and then try to print.

I have no idea about the spool. So could someone help me regarding this.

Thanks in advance.

Accepted Solutions (1)

Accepted Solutions (1)

nikhil_chitre
Active Participant
0 Kudos

hello,

you can make use of the below mentioned FM's

CONVERT_ABAPSPOOLJOB_2_PDF

CONVERT_OTFSPOOLJOB_2_PDF

Regards,

Nikhil

Former Member
0 Kudos

Hi Nikhil,

I have went through this FM's.

This is used to convert from spool to PDF. Before that i want to convert the data to Spool.

nikhil_chitre
Active Participant
0 Kudos

Try building your code with FM " CALL FUNCTION 'GET_PRINT_PARAMETERS'

you will have to submit your program and then

Read spool from table tsp01.

refer to the SAP help demo code below.

DATA: number TYPE tbtcjob-jobcount,

name TYPE tbtcjob-jobname VALUE 'JOB_TEST',

print_parameters TYPE pri_params.

...

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.

SUBMIT submitable TO SAP-SPOOL

SPOOL PARAMETERS print_parameters

WITHOUT SPOOL DYNPRO

VIA JOB name NUMBER number

AND RETURN.

IF sy-subrc = 0.

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.

ENDIF.

Regards,

Nikhil

Former Member
0 Kudos

Hi Nikhil,

Thanks for your information.

Will try this.

Regards,

Karthik

Answers (1)

Answers (1)

venkat_o
Active Contributor
0 Kudos

Hi Karthik, <li>Try this way to get spool.

REPORT ZTEST_NOTEPAD.
  DATA:G_LAY     TYPE PRI_PARAMS-PAART,
       G_LINES   TYPE PRI_PARAMS-LINCT,
       G_COLS    TYPE PRI_PARAMS-LINSZ,
       G_VAL     TYPE C.
  DATA:W_PRIPAR  TYPE PRI_PARAMS,
       W_ARCPAR  TYPE ARC_PARAMS.
  PARAMETERS:
      P_DATA(10) TYPE C.
  START-OF-SELECTION.
    G_LAY   = 'X_65_132'.
    G_LINES = 65.
    G_COLS  = 132.
    "Read, determine, change spool print parameters and archive parameters
    CALL FUNCTION 'GET_PRINT_PARAMETERS'
      EXPORTING
        IN_ARCHIVE_PARAMETERS  = W_ARCPAR
        IN_PARAMETERS          = W_PRIPAR
        LAYOUT                 = G_LAY
        LINE_COUNT             = G_LINES
        LINE_SIZE              = G_COLS
        NO_DIALOG              = 'X'
      IMPORTING
        OUT_ARCHIVE_PARAMETERS = W_ARCPAR
        OUT_PARAMETERS         = W_PRIPAR
        VALID                  = G_VAL.
    IF G_VAL  NE SPACE AND SY-SUBRC = 0.
      W_PRIPAR-PRREL = SPACE.
      W_PRIPAR-PRIMM = SPACE.
      NEW-PAGE PRINT ON
        NEW-SECTION
        PARAMETERS W_PRIPAR
        ARCHIVE PARAMETERS W_ARCPAR
        NO DIALOG.
    ENDIF.
    WRITE 'Output in spool'.
    NEW-PAGE PRINT OFF.
    CALL FUNCTION 'ABAP4_COMMIT_WORK'.
    DATA:TEXT TYPE STRING.
    CONCATENATE 'Spool' SY-SPONO 'is generated' INTO TEXT SEPARATED BY SPACE.
    MESSAGE TEXT  TYPE 'S'.
<li>Use CONVERT_ABAPSPOOLJOB_2_PDF function module to convert spool to Pdf. you get pdf data in internal table . Then Download it preseentation server and print. Thanks Venkat.O