cancel
Showing results for 
Search instead for 
Did you mean: 

sandard Smart Form output into PDF format.

Former Member
0 Kudos
59

Hi to all,

Any one please guide me, how to convert sandard Smart Form output into PDF format.

Regards,

Thanesh

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Answers (3)

Answers (3)

Former Member
0 Kudos

hi thanesh,

the below code may help you.

data: FM_NAME TYPE RS38L_FNAM.

DATA: W_BIN_FILESIZE TYPE I,

T_OTF TYPE ITCOO OCCURS 0 WITH HEADER LINE,

T_PDF_TAB TYPE TLINE OCCURS 0 WITH HEADER LINE,

W_FILESIZE TYPE I,

WA_CTRLOP TYPE SSFCTRLOP,

WA_OUTOPT TYPE SSFCOMPOP,

T_OTFDATA TYPE SSFCRESCL.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = <ur form name>

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

FM_NAME = FM_NAME

EXCEPTIONS

NO_FORM = 1

NO_FUNCTION_MODULE = 2

OTHERS = 3

.

if sy-subrc <> 0.

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

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

endif.

WA_CTRLOP-GETOTF = 'X'.

WA_CTRLOP-NO_DIALOG = 'X'.

WA_OUTOPT-TDNOPREV = 'X'.

call function <function module generated for ur form>

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

CONTROL_PARAMETERS = WA_CTRLOP

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

OUTPUT_OPTIONS = WA_OUTOPT

USER_SETTINGS = 'X'

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

JOB_OUTPUT_INFO = T_OTFDATA

  • JOB_OUTPUT_OPTIONS =

EXCEPTIONS

FORMATTING_ERROR = 1

INTERNAL_ERROR = 2

SEND_ERROR = 3

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

T_OTF[] = T_OTFDATA-OTFDATA[].

call function 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

MAX_LINEWIDTH = 132

  • ARCHIVE_INDEX = ' '

  • COPYNUMBER = 0

IMPORTING

BIN_FILESIZE = W_BIN_FILESIZE

  • BIN_FILE =

tables

OTF = T_OTF

LINES = T_PDF_TAB

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.

call function 'WS_DOWNLOAD'

EXPORTING

BIN_FILESIZE = W_BIN_FILESIZE

  • CODEPAGE = ' '

FILENAME = 'D:\TEST11.PDF'

FILETYPE = 'BIN'

  • MODE = ' '

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • COL_SELECT = ' '

  • COL_SELECTMASK = ' '

  • NO_AUTH_CHECK = ' '

IMPORTING

FILELENGTH = W_FILESIZE

tables

data_tab = T_PDF_TAB

  • FIELDNAMES =

EXCEPTIONS

FILE_OPEN_ERROR = 1

FILE_WRITE_ERROR = 2

INVALID_FILESIZE = 3

INVALID_TYPE = 4

NO_BATCH = 5

UNKNOWN_ERROR = 6

INVALID_TABLE_WIDTH = 7

GUI_REFUSE_FILETRANSFER = 8

CUSTOMER_ERROR = 9

NO_AUTHORITY = 10

OTHERS = 11

.

if sy-subrc = 0.

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

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

WRITE: / 'SUCCESSFULLY CONVERTED'.

endif.

former_member196280
Active Contributor
0 Kudos

Go thorugh this[link.|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/d937ec90-0201-0010-0ca8-b6cb3b6dd1ef], it will guide you step wise.

Regards,

SaiRam

Former Member
0 Kudos

Hi Thanesh,

After the call to smartform, pass the generated Sppol number to the below function module.

CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'