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: 

Scripts to pdf

Former Member
0 Kudos
233

Hi all,

When i click on Print button in VA22 , it creates a script .

I need to convert that script into a pdf.

Can we do it like this ........

capture the Spool Request number and then convert it to PDF format.

if it is correct.........

How do i capture the Spool Request?

and then how to convert the spool request into a PDF ?

kindly guide me in doing this.

regards.

suki

1 ACCEPTED SOLUTION

Former Member
0 Kudos
178

Hi Suki,

<b>SAP have created a standard program RSTXPDFT4 to convert your Sapscripts spools into a PDF format.

Specify the spool number and you will be able to download the sapscripts spool into your local harddisk.

Please note that it is not restricted to sapsciprts spool only. Any reports in the spool can be converted using the program 'RSTXPDFT4'.

</b>

1.Go to sp01 and get the spool number

2.Run the program RSTXPDFT4 in se38

3. Give the spool number and mention the directory and filename where to want to store the pdf file

4. press execute

<b>If u want to convert OTF into pdf by using a program use,

CONVERT_OTF_2_PDF or SX_OBJECT_CONVERT_OTF_PDF function modules in u r program.</b>

CALL FUNCTION 'CONVERT_OTF_2_PDF'

IMPORTING

bin_filesize = pdf_bytecount

TABLES

otf = otf_data

doctab_archive = lt_docs

lines = pdfout

EXCEPTIONS

err_conv_not_possible = 1

err_otf_mc_noendmarker = 2

OTHERS = 3.

( or )

CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'

EXPORTING

FORMAT_SRC = 'OTF'

FORMAT_DST = 'PDF'

DEVTYPE = 'ASCIIPRI'

LEN_IN = LEN_IN

IMPORTING

LEN_OUT = LEN_OUT

TABLES

CONTENT_IN = OTF_TAB

CONTENT_OUT = ITAB2

EXCEPTIONS

ERR_CONV_FAILED = 1

OTHERS = 2.

6 REPLIES 6

Former Member
0 Kudos
179

Hi Suki,

<b>SAP have created a standard program RSTXPDFT4 to convert your Sapscripts spools into a PDF format.

Specify the spool number and you will be able to download the sapscripts spool into your local harddisk.

Please note that it is not restricted to sapsciprts spool only. Any reports in the spool can be converted using the program 'RSTXPDFT4'.

</b>

1.Go to sp01 and get the spool number

2.Run the program RSTXPDFT4 in se38

3. Give the spool number and mention the directory and filename where to want to store the pdf file

4. press execute

<b>If u want to convert OTF into pdf by using a program use,

CONVERT_OTF_2_PDF or SX_OBJECT_CONVERT_OTF_PDF function modules in u r program.</b>

CALL FUNCTION 'CONVERT_OTF_2_PDF'

IMPORTING

bin_filesize = pdf_bytecount

TABLES

otf = otf_data

doctab_archive = lt_docs

lines = pdfout

EXCEPTIONS

err_conv_not_possible = 1

err_otf_mc_noendmarker = 2

OTHERS = 3.

( or )

CALL FUNCTION 'SX_OBJECT_CONVERT_OTF_PDF'

EXPORTING

FORMAT_SRC = 'OTF'

FORMAT_DST = 'PDF'

DEVTYPE = 'ASCIIPRI'

LEN_IN = LEN_IN

IMPORTING

LEN_OUT = LEN_OUT

TABLES

CONTENT_IN = OTF_TAB

CONTENT_OUT = ITAB2

EXCEPTIONS

ERR_CONV_FAILED = 1

OTHERS = 2.

0 Kudos
178

Hi Sree,

is there any way i can capture the spool request automatically????

suki.

Former Member
0 Kudos
178

in the user exit u can get the spool request number and using this u can run HRHAP_DOC_CONVERT_SMF_TO_PDF or CONVERT_OTF_2_PDF to convert data to PDF.

Former Member
0 Kudos
178

Hi,

You are right, when we run/Execute the Script, A spool will be generated, we need to capture the Spool no and we can generate the PDF fiel from that Spool

Visit this link for SAMple code of SAPSCRIPT to PDF.:

http://www.sapgenie.com/abap/pdf_creation.htm

and check the following weblog for code samples.

/people/sap.user72/blog/2004/11/10/bsphowto-generate-pdf-output-from-a-bsp

chk this one

http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm

some function modules useful would be

CONVERT_OTF

SO_NEW_DOCUMENT_ATT_SEND_API1 to send mails with attachments

plzz refer to this link..it will solve ur problem

Regards

Sudheer

Former Member
0 Kudos
178

Do this.

1st SELECT * FROM TSP01

2nd CALL FUNCTION 'CONVERT_OTFSPOOLJOB_2_PDF'

EXPORTING

SRC_SPOOLID = TSP01-RQIDENT "(Spool number)

the above FM will return you the PDF in your internal table.

Regards

Lakshmikanth

Former Member
0 Kudos
178

Hi Suki,

check the below links may be useful for you...

http://www.erpgenie.com/abap/pdf_creation.htm

~~Guduri