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: 

print and preview pdf of script without saving

Former Member
0 Kudos

hi,

can anyone check the code and tell me what iam missing

I don't want to save the pdf file i want to print it or see it under print preview.

WAITING FOR REPLIES

DATA: PDFTAB TYPE TABLE OF TLINE WITH HEADER LINE,

DATATAB TYPE TABLE OF ITCOO WITH HEADER LINE.

DATA: BINFILESIZE TYPE I,

FILE_NAME TYPE STRING,

FILE_PATH TYPE STRING,

FULL_PATH TYPE STRING.

data: begin of itcpp.

include structure itcpo.

data: end of itcpp.

itcpp-tdcopies = 1.

itcpp-tdimmed = 'X'.

itcpp-tddelete = 'X'.

itcpp-tdnewid = ' '.

ITCPP-tddest = 'LP01'.

ITCPP-tdgetotf = 'X'.

itcpp-tdpreview = 'X'.

Call function 'OPEN_FORM'

exporting

device = 'PRINTER'

dialog = 'X'

  • form = 'Z_LIST '

form = space

language = sy-langu

options = itcpp.

call function 'START_FORM'

exporting

  • ARCHIVE_INDEX =

form = 'ZTEST'

  • LANGUAGE = ' '

  • STARTPAGE = ' '

  • PROGRAM = ' '

  • MAIL_APPL_OBJECT =

  • IMPORTING

  • LANGUAGE =

  • EXCEPTIONS

  • FORM = 1

  • FORMAT = 2

  • UNENDED = 3

  • UNOPENED = 4

  • UNUSED = 5

  • SPOOL_ERROR = 6

  • OTHERS = 7

.

LOOP AT ITAB.

call function 'WRITE_FORM'

exporting

element = 'HEAD'

function = 'SET'

window = 'MAIN'

.

ENDLOOP.

CALL FUNCTION 'CLOSE_FORM'

IMPORTING

RESULT = itcpp

  • RDI_RESULT =

TABLES

OTFDATA = DATATAB[]

EXCEPTIONS

UNOPENED = 1

BAD_PAGEFORMAT_FOR_PRINT = 2

SEND_ERROR = 3

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

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

MAX_LINEWIDTH = 132

  • ARCHIVE_INDEX = ' '

IMPORTING

BIN_FILESIZE = BINFILESIZE

TABLES

OTF = DATATAB[]

LINES = PDFTAB[]

EXCEPTIONS

ERR_MAX_LINEWIDTH = 1

ERR_FORMAT = 2

ERR_CONV_NOT_POSSIBLE = 3

OTHERS = 4

.

IF SY-SUBRC <> 0.

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

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

ENDIF.

*ENDIF.

I am seeing data in datatab and pdf tab

Pls suggest the changes to be made

Thanks in advance

4 REPLIES 4

Former Member
0 Kudos

any suggestions on this post.

I have tried different ways but iam not sucessfull.

I don't want to save it.

what the spool and regular printing.

if i use then i need to go sp01 and print it,is this right?

if thats the case then the spool think doesn't work for m.

as soon as i execute the driver program , if i select the print preview it should in PDF AND WHEN I CLICK PRINT IT SHOULD BE IN PDF ,THIS IS MY REQUIREMENT.

any help would be greatly appreciated.

Thanks in advance

Former Member
0 Kudos

Hi Deepthi,

I don't think your requirement can be satisfied without saving it in your desktop. You save the pdf file in your system and use CL_GUI_PDF_VIEWER to automatically load the PDF file from the local system.

Regards,

SP.

0 Kudos

Hi guys ,has anyone did this

i want to print the script in pdf format without saving on say desktop and i don't know what spool is .

my requirement is iam bale to print the script but i want to do it pdf format.is it possible,if yes please let me know what changes i need to make to my code

Thanks in advance

0 Kudos

Hi Deepthi,

What is the Script (Billing,invoice,quotation etc)

Go to the Tcode for (Example if it Billing vf03) and in menu select issue output option and there you can see print and print preview.

If you want to print without saving,you can do that.

But make sure your layout configured in NACE.