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: 

Printing PO in PDF

Former Member
0 Kudos

Hello experts,

I have a requirement to print PO in PDF. Current PO print in Standard SAPSCRIPT (MEDRUCK). Is there a way I can configure through the NACE transaction code to make it print in PDF. What is the best way to print PO in PDF? Do I need to convert SAPSCRIPT to Smartform and then create PDF??

Please suggest ...

1 ACCEPTED SOLUTION

Former Member
0 Kudos

hey

u can also check this link

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

if it is useful don't forget to reward the points

Regards

naveen

2 REPLIES 2

Former Member
0 Kudos

hi dp,

u can try with this code

i mean u can call the fm 'CONVERT_OTFSPOOLJOB_2_PDF'

data: it_pdf like tline occurs 10 with header line,

xi_pdf like tline occurs 0 with header line,

html like solisti1 occurs 0 with header line,

xi_temp like bapiqcmime occurs 0 with header line,

xi_mime(255) type c occurs 0 with header line.

*-Convert OTF Spool to PDF

call function 'CONVERT_OTFSPOOLJOB_2_PDF'

EXPORTING

src_spoolid = p_spool

no_dialog = ' '

IMPORTING

pdf_bytecount = l_bytecount

TABLES

pdf = it_pdf

EXCEPTIONS

err_no_otf_spooljob = 1

err_no_spooljob = 2

err_no_permission = 3

err_conv_not_possible = 4

err_bad_dstdevice = 5

user_cancelled = 6

err_spoolerror = 7

err_temseerror = 8

err_btcjob_open_failed = 9

err_btcjob_submit_failed = 10

err_btcjob_close_failed = 11.

if sy-subrc = 0.

xi_pdf[] = it_pdf[].

  • -Reformat the line to 255 characters wide (code from SAP)

clear: l_temp, l_offset, xi_temp.

describe table xi_pdf lines l_lines.

describe field xi_pdf length l_lineslen.

describe field xi_temp length l_mimelen.

loop at xi_pdf.

l_tabix = sy-tabix.

move xi_pdf to l_temp+l_offset.

if l_tabix = l_lines.

l_lineslen = strlen( xi_pdf ).

endif.

l_offset = l_offset + l_lineslen.

if l_offset ge l_mimelen.

clear xi_temp.

xi_temp = l_temp(l_mimelen).

append xi_temp.

shift l_temp by l_mimelen places.

l_offset = l_offset - l_mimelen.

endif.

if l_tabix = l_lines.

if l_offset gt 0.

clear xi_temp.

xi_temp = l_temp(l_offset).

append xi_temp.

endif.

endif.

endloop.

loop at xi_temp.

xi_mime(255) = xi_temp-line.

append xi_mime.

endloop.

  • -Final Data

html[] = xi_mime[].

Former Member
0 Kudos

hey

u can also check this link

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

if it is useful don't forget to reward the points

Regards

naveen