Skip to Content
0
Former Member
Jan 18, 2008 at 07:46 AM

How to convert smartform into PDF format ?

295 Views

Hi All,

I tried to convert smartform into PDF format . But i am not getting. Could you please tell anyone where excatly i did mistake?

This is below code

REPORT ZSMARTFORM.

TABLES: equi , SSFCTRLOP.

DATA: FM_NAME TYPE RS38L_FNAM.

data: t_otf_from_fm TYPE ssfcrescl.

DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,

i_tline TYPE TABLE OF tline WITH HEADER LINE,

w_ctrlop TYPE ssfctrlop,

w_compop TYPE ssfcompop,

w_return TYPE ssfcrescl,

v_form_name TYPE rs38l_fnam,

v_len_in LIKE sood-objlen,

v_len_out LIKE sood-objlen,

v_len_outn TYPE i.

DATA: BEGIN OF I_equi OCCURS 0.

INCLUDE STRUCTURE equi.

DATA: END OF I_equi.

SELECT-OPTIONS S_equnr FOR equi-equnr.

SELECT * FROM equi WHERE equnr IN S_equnr.

MOVE-CORRESPONDING equi TO I_equi.

APPEND I_equi.

ENDSELECT.

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZTEST'

VARIANT = ' '

DIRECT_CALL = ' '

IMPORTING

FM_NAME = v_form_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.

w_ctrlop-getotf = 'X'.

w_ctrlop-no_dialog = 'X'.

w_ctrlop-preview = space.

*w_compop-tdnoprev = 'X'.

CALL FUNCTION v_form_name

EXPORTING

ARCHIVE_INDEX = ARCHIVE_INDEX

ARCHIVE_INDEX_TAB = ARCHIVE_INDEX_TAB

ARCHIVE_PARAMETERS = ARCHIVE_PARAMETERS

CONTROL_PARAMETERS = w_ctrlop

MAIL_APPL_OBJ = MAIL_APPL_OBJ

MAIL_RECIPIENT = MAIL_RECIPIENT

MAIL_SENDER = MAIL_SENDER

OUTPUT_OPTIONS = w_compop

USER_SETTINGS = 'X'

IMPORTING

DOCUMENT_OUTPUT_INFO = DOCUMENT_OUTPUT_INFO

JOB_OUTPUT_INFO = w_return

JOB_OUTPUT_OPTIONS = JOB_OUTPUT_OPTIONS

TABLES

i_equi = i_equi

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.

i_otf] = w_return-otfdata[.

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

MAX_LINEWIDTH = 132

ARCHIVE_INDEX = ' '

COPYNUMBER = 0

ASCII_BIDI_VIS2LOG = ' '

PDF_DELETE_OTFTAB = ' '

IMPORTING

BIN_FILESIZE = v_len_in

BIN_FILE = BIN_FILE

TABLES

otf = i_otf

lines = i_tline

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.

waiting your reply asap.

award will be for correct ans.

Thanks

Edited by: sasmita parida on Jan 18, 2008 1:11 PM