cancel
Showing results for 
Search instead for 
Did you mean: 

print sales order in PDF

0 Kudos

Hi,

I want to print sales order in PDF.

Print Program :SD_SDOC_PRINT01

Print Form:SD_SDOC_FORM01

Output TYpe : BA00

Order Type : OR

It is giving error. Serious error in message text. Pl help

SB

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

U copy the Standard driver program 'Print Program :SD_SDOC_PRINT01' into a custom Z program and then configure the custom program to the output type in NACE transaction.

in the copied Z program now write the code to generate PDF output.

FYI, use FM 'SSFCOMP_PDF_PREVIEW' to get the output in PDF. first u have to cpnvert the FORM output data into OTF data then pass this OTF table data to the below FM..

call function 'SSFCOMP_PDF_PREVIEW'

exporting

i_otf = otf[]

exceptions

convert_otf_to_pdf_error = 1

cntl_error = 2

others = 3.

Rgds,

Pavan

0 Kudos

Hi,

This program is to print in PDF form. It will not print smartform.

SB

Answers (1)

Answers (1)

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.