Application Development and Automation 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: 
Read only

sapscript convert to pdf

Former Member
0 Likes
2,777

Hi All ,

i want to convert sapscript to pdf .

this is standart code , i don't know very good sapscript.

Thanks..

LOOP AT it7trg01 WHERE mark EQ 'X'.

CLEAR l_counter.

READ TABLE sirket WITH KEY begda = it7trg01-begda

sskis = it7trg01-isskno.

CALL FUNCTION 'START_FORM'

EXPORTING

startpage = 'PAGE1'.

PERFORM write_form.

LOOP AT fpper WHERE isskno EQ sirket-sskis

AND begda EQ sirket-begda.

ADD 1 TO l_counter.

PERFORM write_window USING 'MAIN' 'MAIN'.

ENDLOOP.

CLEAR fpper.

IF l_counter LT 12.

l_counter = 12 - l_counter.

DO l_counter TIMES.

PERFORM write_window USING 'MAIN' 'MAIN'.

ENDDO.

ENDIF.

CALL FUNCTION 'END_FORM'.

ADD 1 TO itcpo-tdcopies.

ENDLOOP.

CALL FUNCTION 'CLOSE_FORM'.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,423

Hi,

Use otfdata tables parameter of Close form to convert sapscript to PDF..check the code below..

CALL FUNCTION 'CLOSE_FORM'

TABLES
OTFDATA = OTF.

CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
BIN_FILESIZE = BIN_SIZE

TABLES
OTF = otf
DOCTAB_ARCHIVE = DOC
LINES = TLINES.

CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = BIN_SIZE
FILENAME = 'C:\anees\test.pdf'
FILETYPE = 'BIN'
TABLES
DATA_TAB = TLINES.

12 REPLIES 12
Read only

Former Member
0 Likes
1,423

Hi,

To convert the sapscript output to pdf you will have to take the spool number and pass it to the program RSTXPDFT4.

This will convert the sapscript output into PDF.

Regards,

Ankur Parab

Read only

Former Member
0 Likes
1,424

Hi,

Use otfdata tables parameter of Close form to convert sapscript to PDF..check the code below..

CALL FUNCTION 'CLOSE_FORM'

TABLES
OTFDATA = OTF.

CALL FUNCTION 'CONVERT_OTF_2_PDF'
IMPORTING
BIN_FILESIZE = BIN_SIZE

TABLES
OTF = otf
DOCTAB_ARCHIVE = DOC
LINES = TLINES.

CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
BIN_FILESIZE = BIN_SIZE
FILENAME = 'C:\anees\test.pdf'
FILETYPE = 'BIN'
TABLES
DATA_TAB = TLINES.

Read only

0 Likes
1,423

hi

Ankur Parab yes it's true with spool number , but i don't find spool number in program .

Are you know how can i find it ?

avinas kodarapu i don't have a otfdata how can i find sapscript's otfdata ?

Thanks.

Read only

0 Likes
1,423

Hi,

In the CLOSE FORM FM you have the Tables Parameter OTFDATA .

CALL FUNCTION 'CLOSE_FORM'
TABLES
OTFDATA = OTF.                        " Use this

Later use CONVERT_OTF_2_PDF to convert PDF to OTF and Using GUI_DOWNLOAD download the PDF data.

Read only

0 Likes
1,423

thanks all besides Avinash Kodarapu

Read only

0 Likes
1,423

hey

but this table is empty :S

Read only

Former Member
0 Likes
1,423

Hi,

From the print program Call function 'END_FORM' ,the import parameter 'result' structure having "TDSPOOLID" field ,this is nothing but ,spool request no.,you have to pass this value to these function module...

plz,you can try this function module....

1.CONVERT_ABAPSPOOLJOB_2_PDF

2.CONVERT_OTFSPOOLJOB_2_PDF

3.CONVERT_OTF_2_PDF

4.CONVERT_OTF_2_PDF_ARCHIVELINK

Also,you can call the program "RSTXPDFT4" in Background Job in your print program.

I hope,it will help you...

<=<< Sharing Knowledge is a way to Innovative >=>>

By,

Yoga

Read only

Former Member
0 Likes
1,423

hey

but this table is empty :S

Read only

0 Likes
1,423

Hi,

You need to pass this in Open_form FM..

* Setting the options
options-tdcopies = 1 ."Number of copies
options-tdnoprev = c_x."No print preview
options-tdgetotf = c_x."Return of OTF table
options-tddest = c_locl."Spool: Output device

* Opening the form
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = c_form
device = c_printer
language = sy-langu
OPTIONS = options
IMPORTING
RESULT = w_res.

Read only

0 Likes
1,423

hi

i'm do it but error type : "for hr_fee_en absent CLOSE_FORM "

but i'm write at the bottom open form .

"hr_fee_en" my form name .

Read only

0 Likes
1,423

Hi,

Refer to this link..http://www.scribd.com/doc/454814/SAPSCRIPT-to-PDF

explained with example..

Read only

0 Likes
1,423

oh thanks Avinash Kodarapu