cancel
Showing results for 
Search instead for 
Did you mean: 

Script out put in PDF format to the printer ?

Former Member
0 Kudos

Hi All ,

I have a peculiar problem in printing the script output . User don't want to down load the Script output into PDF document and then print , instead he wants the output in PDF format should go directly to the printer when he process the print .

In Other words .. If the program generates the Spool , in SP01 , the type should be PDF . Currently it is OTF .

How can the program sends the script output to the printer in PDF format ?

Thanks ,

dharma .

Accepted Solutions (0)

Answers (7)

Answers (7)

Former Member
0 Kudos

Hi Dharma

Check in the below link.

[http://www.sdn.sap.com/irj/scn/index;jsessionid=(J2EE3417700)ID1129874650DB11803751377484663529End?rid=/library/uuid/49e15474-0e01-0010-9cba-e62df8244556&overridelayout=true|http://www.sdn.sap.com/irj/scn/index;jsessionid=(J2EE3417700)ID1129874650DB11803751377484663529End?rid=/library/uuid/49e15474-0e01-0010-9cba-e62df8244556&overridelayout=true]

Former Member
0 Kudos

Can you try these below function module. It might help you

  • Open Form

CALL FUNCTION 'H99B_OPEN_LFORM_JOB'

  • Print Form

CALL FUNCTION 'H99B_OUTPUT_LFORM'

  • Close Form

CALL FUNCTION 'H99B_CLOSE_LFORM_JOB'

Refer standard program RPCEOYG0 and get inside the include RPCEOYGC and search for 'PDF' and you will see four perform for diffrent UK forms . Get inside any perfrom and see the code where they used the above function module to get the PDF output and you can print also. But when you run this standard program you don't see PDF output as it is disabled by SAP due to some problem.

But still you can try with the logic.

Thanks,

Prashanth J R

Former Member
0 Kudos

any break through? script output in the sense do u mean Purchase order?

Former Member
0 Kudos

Hi,

refer to the following code:

TABLES:likp,itcpo.

  • Internal table and variable Declaration

Data: gi_otf TYPE STANDARD TABLE OF itcoo,

gi_line TYPE TABLE OF tline,

bin_file TYPE i.

itcpo-tdgetotf = 'X'.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

device = 'PRINTER'

dialog = 'X'

form = 'YSCRIPT'

language = sy-langu

OPTIONS = itcpo

EXCEPTIONS

canceled = 1

device = 2

form = 3

OPTIONS = 4

unclosed = 5

mail_options = 6

archive_error = 7

invalid_fax_number = 8

more_params_needed_in_batch = 9

spool_error = 10

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

Then use start form,write form and end form.

CALL FUNCTION 'CLOSE_FORM'

TABLES

otfdata = gi_otf

EXCEPTIONS

unopened = 1

bad_pageformat_for_print = 2

send_error = 3

spool_error = 4

codepage = 5

OTHERS = 6.

IF sy-subrc 0.

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

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

ENDIF.

  • Convert data to PDF format

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

IMPORTING

bin_filesize = bin_file

used in GUI_DOWNLOAD

TABLES

otf = gi_otf

lines = gi_line

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

err_bad_otf = 4

OTHERS = 5.

IF sy-subrc 0.

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

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

ENDIF.

Hope it helps.

Regards

suma.

Former Member
0 Kudos

Hi,

Even i want to download the script to PDF format .

So i tried the above code given.

PDF format is getting downloaded. But it has no record in it...

that gi_off or datab has 0 Bytes

Suman

What should be the value of gi_otf?(It should be filled right??)

or Rajesh

What should be the value of datab?

Please help...

Regards,

Ranjitha

Former Member
0 Kudos

Hi,

To convert SAP Script or Smartforms output to PDF file use standard program

RSTXPDFT4.

Just run your form , create the spool request for your form than use this spool request in above program you will get your output in PDF format.

Hope this will solve your problem.

Regards,

Himanshu

Former Member
0 Kudos

Hi,

Refer to the following program.

TABLES: likp, lips,itcpo.

DATA: pdftab type standard TABLE OF tline,

datab TYPE standard TABLE OF itcoo.

itcpo-tdgetotf = 'X'.

CALL FUNCTION 'OPEN_FORM'

EXPORTING

DEVICE = 'PRINTER'

DIALOG = 'X'

FORM = 'Z1989_PRAC'

LANGUAGE = SY-LANGU

OPTIONS = itcpo

// call script using start_form and write_form.

CALL FUNCTION 'END_FORM'

IMPORTING

RESULT = gi_ofc

CALL FUNCTION 'CLOSE_FORM'

TABLES

OTFDATA = datab

EXCEPTIONS

UNOPENED = 1

BAD_PAGEFORMAT_FOR_PRINT = 2

SEND_ERROR = 3

SPOOL_ERROR = 4

CODEPAGE = 5

OTHERS = 6

.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

IMPORTING

BIN_FILESIZE = BINFILE

TABLES

otf = datab

lines = pdftab

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE = binfile

filename = 'D:\MYFILE.PDF' //give the address where u want output.

FILETYPE = 'BIN'

tables

data_tab = pdftab

Regards

Rajesh Kumar

Former Member
0 Kudos

Hi,

Use this FM to convert Spoll to PDF format

  • Function Module to Convert Spool to PDF file

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = w_rqident

no_dialog = 'X'

dst_device = 'LP01'

pdf_destination = 'X'

TABLES

pdf = t_pdf.

Regards

Krishna

Former Member
0 Kudos

Hi Krishna ,

It was not useful as it was for converting the ABAP List data to PDF .

Any other clues ..

dharma .