cancel
Showing results for 
Search instead for 
Did you mean: 

Want to create function module which will convert smartform into PDF

Former Member
0 Kudos

Hi All ,

Requirement : I want to create a function module which will convert smartform

into PDF .

Could you please help me out ..

Thanks in advance

rahul

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos
Former Member
0 Kudos

Hi Anitha ,

when I am trying to excute your prog I am still getting error ..

could you please help me out .

Error :

Incorrect parameter with CALL FUNCTION.

regards

rahul

Former Member
0 Kudos

Hi All ,

when I am excuting this report(zsuresh_test) and by passing the smartform name FOPCR_STANDARD_F1

I am getting error :

Incorrect parameter with CALL FUNCTION

*******************************************************************

REPORT zsuresh_test.

  • Variable declarations

DATA:

w_form_name TYPE tdsfname VALUE 'FOPCR_STANDARD_F1',

w_fmodule TYPE rs38l_fnam,

w_cparam TYPE ssfctrlop,

w_outoptions TYPE ssfcompop,

W_bin_filesize TYPE i, " Binary File Size

w_FILE_NAME type string,

w_File_path type string,

w_FULL_PATH type string.

  • Internal tables declaration

  • Internal table to hold the OTF data

DATA:

t_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,

  • Internal table to hold OTF data recd from the SMARTFORM

t_otf_from_fm TYPE ssfcrescl,

  • Internal table to hold the data from the FM CONVERT_OTF

T_pdf_tab LIKE tline OCCURS 0 WITH HEADER LINE.

  • This function module call is used to retrieve the name of the Function

  • module generated when the SMARTFORM is activated

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = w_form_name

  • VARIANT = ' '

  • DIRECT_CALL = ' '

IMPORTING

fm_name = w_fmodule

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.

  • Calling the SMARTFORM using the function module retrieved above

  • GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF

  • format of the output

w_cparam-no_dialog = 'X'.

w_cparam-preview = space. " Suppressing the dialog box

" for print preview

w_cparam-getotf = 'X'.

  • Printer name to be used is provided in the export parameter

  • OUTPUT_OPTIONS

w_outoptions-tddest = 'LP01'.

CALL FUNCTION w_fmodule

EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

control_parameters = w_cparam

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

output_options = w_outoptions

  • USER_SETTINGS = 'X'

IMPORTING

  • DOCUMENT_OUTPUT_INFO =

job_output_info = t_otf_from_fm

  • 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_otf_from_fm-otfdata[].

  • Function Module CONVERT_OTF is used to convert the OTF format to PDF

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

FORMAT = 'PDF'

MAX_LINEWIDTH = 132

  • ARCHIVE_INDEX = ' '

  • COPYNUMBER = 0

  • ASCII_BIDI_VIS2LOG = ' '

  • PDF_DELETE_OTFTAB = ' '

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.

  • To display File SAVE dialog window

CALL METHOD cl_gui_frontend_services=>file_save_dialog

  • EXPORTING

  • WINDOW_TITLE =

  • DEFAULT_EXTENSION =

  • DEFAULT_FILE_NAME =

  • FILE_FILTER =

  • INITIAL_DIRECTORY =

  • WITH_ENCODING =

  • PROMPT_ON_OVERWRITE = 'X'

CHANGING

filename = w_FILE_NAME

path = w_FILE_PATH

fullpath = w_FULL_PATH

  • USER_ACTION =

  • FILE_ENCODING =

EXCEPTIONS

CNTL_ERROR = 1

ERROR_NO_GUI = 2

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

  • Use the FM GUI_DOWNLOAD to download the generated PDF file onto the

  • presentation server

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

BIN_FILESIZE = W_bin_filesize

filename = w_FULL_PATH

FILETYPE = 'BIN'

  • APPEND = ' '

  • WRITE_FIELD_SEPARATOR = ' '

  • HEADER = '00'

  • TRUNC_TRAILING_BLANKS = ' '

  • WRITE_LF = 'X'

  • COL_SELECT = ' '

  • COL_SELECT_MASK = ' '

  • DAT_MODE = ' '

  • CONFIRM_OVERWRITE = ' '

  • NO_AUTH_CHECK = ' '

  • CODEPAGE = ' '

  • IGNORE_CERR = ABAP_TRUE

  • REPLACEMENT = '#'

  • WRITE_BOM = ' '

  • TRUNC_TRAILING_BLANKS_EOL = 'X'

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • IMPORTING

  • FILELENGTH =

tables

data_tab = T_pdf_tab

  • FIELDNAMES =

  • EXCEPTIONS

  • FILE_WRITE_ERROR = 1

  • NO_BATCH = 2

  • GUI_REFUSE_FILETRANSFER = 3

  • INVALID_TYPE = 4

  • NO_AUTHORITY = 5

  • UNKNOWN_ERROR = 6

  • HEADER_NOT_ALLOWED = 7

  • SEPARATOR_NOT_ALLOWED = 8

  • FILESIZE_NOT_ALLOWED = 9

  • HEADER_TOO_LONG = 10

  • DP_ERROR_CREATE = 11

  • DP_ERROR_SEND = 12

  • DP_ERROR_WRITE = 13

  • UNKNOWN_DP_ERROR = 14

  • ACCESS_DENIED = 15

  • DP_OUT_OF_MEMORY = 16

  • DISK_FULL = 17

  • DP_TIMEOUT = 18

  • FILE_NOT_FOUND = 19

  • DATAPROVIDER_EXCEPTION = 20

  • CONTROL_FLUSH_ERROR = 21

  • OTHERS = 22

.

IF sy-subrc <> 0.

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

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

ENDIF.

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Sharma,

Look at this code...

this is working for me.

&----


*& Report Z_CONVERT_OTP_TO_PDF

*&

&----


*&

*&

&----


report z_convert_otp_to_pdf.

  • Variable declarations

data:

w_form_name type tdsfname value 'SF_EXAMPLE_01',

w_fmodule type rs38l_fnam,

w_cparam type ssfctrlop,

w_outoptions type ssfcompop,

w_bin_filesize type i , " Binary File Size

w_file_name type string,

w_file_path type string,

w_full_path type string.

  • Internal tables declaration

  • Internal table to hold the OTF data

data:

t_otf type itcoo occurs 0 with header line,

  • Internal table to hold OTF data recd from the SMARTFORM

t_otf_from_fm type ssfcrescl,

  • Internal table to hold the data from the FM CONVERT_OTF

t_pdf_tab like tline occurs 0 with header line.

data: carr_id type sbook-carrid,

fm_name type rs38l_fnam.

parameter: p_custid type scustom-id default 1.

select-options: s_carrid for carr_id default 'LH' to 'LH'.

parameter: p_form type tdsfname default 'SF_EXAMPLE_01'.

data: customer type scustom,

bookings type ty_bookings,

connections type ty_connections.

  • get data

select single * from scustom into customer where id = p_custid.

check sy-subrc = 0.

select * from sbook into table bookings

where customid = p_custid

and carrid in s_carrid

order by primary key.

select * from spfli into table connections

for all entries in bookings

where carrid = bookings-carrid

and connid = bookings-connid

order by primary key.

  • This function module call is used to retrieve the name of the Function

  • module generated when the SMARTFORM is activated

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = w_form_name

  • VARIANT = ' '

  • DIRECT_CALL = ' '

importing

fm_name = w_fmodule

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.

  • Calling the SMARTFORM using the function module retrieved above

  • GET_OTF parameter in the CONTROL_PARAMETERS is set to get the OTF

  • format of the output

w_cparam-no_dialog = 'X'.

w_cparam-preview = space. " Suppressing the dialog box

w_cparam-getotf = 'X'. " for print preview

w_outoptions-tddest = 'Locl'.

call function '/1BCDWB/SF00000098'

exporting

  • ARCHIVE_INDEX = ARCHIVE_INDEX

  • ARCHIVE_INDEX_TAB = ARCHIVE_INDEX_TAB

  • ARCHIVE_PARAMETERS = ARCHIVE_PARAMETERS

control_parameters = w_cparam "CONTROL_PARAMETERS

  • MAIL_APPL_OBJ = MAIL_APPL_OBJ

  • MAIL_RECIPIENT = MAIL_RECIPIENT

  • MAIL_SENDER = MAIL_SENDER

output_options = w_outoptions

  • USER_SETTINGS = 'X'

customer = customer

bookings = bookings

connections = connections

importing

  • DOCUMENT_OUTPUT_INFO = DOCUMENT_OUTPUT_INFO

job_output_info = t_otf_from_fm

  • JOB_OUTPUT_OPTIONS = 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_otf_from_fm-otfdata[].

call function 'CONVERT_OTF'

exporting

format = 'PDF'

max_linewidth = 132

  • ARCHIVE_INDEX = ' '

  • COPYNUMBER = 0

  • ASCII_BIDI_VIS2LOG = ' '

  • PDF_DELETE_OTFTAB = ' '

importing

bin_filesize = w_bin_filesize

  • BIN_FILE = 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.

  • Use the FM DOWNLOAD to download the generated PDF file onto the

  • presentation server

call function 'DOWNLOAD'

EXPORTING

BIN_FILESIZE = w_bin_filesize

  • CODEPAGE = ' '

FILENAME = 'C:\Documents and Settings\manikandansi\Desktop\Untitled1.pdf'

FILETYPE = 'BIN'

  • ITEM = ' '

  • MODE = ' '

  • WK1_N_FORMAT = ' '

  • WK1_N_SIZE = ' '

  • WK1_T_FORMAT = ' '

  • WK1_T_SIZE = ' '

  • FILEMASK_MASK = ' '

  • FILEMASK_TEXT = ' '

  • FILETYPE_NO_CHANGE = ' '

  • FILEMASK_ALL = ' '

  • FILETYPE_NO_SHOW = ' '

  • SILENT = 'S'

  • COL_SELECT = ' '

  • COL_SELECTMASK = ' '

  • NO_AUTH_CHECK = ' '

  • IMPORTING

  • ACT_FILENAME = ACT_FILENAME

  • ACT_FILETYPE = ACT_FILETYPE

  • FILESIZE = FILESIZE

  • CANCEL = CANCEL

tables

data_tab = t_pdf_tab

  • FIELDNAMES = FIELDNAMES

  • EXCEPTIONS

  • INVALID_FILESIZE = 1

  • INVALID_TABLE_WIDTH = 2

  • INVALID_TYPE = 3

  • NO_BATCH = 4

  • UNKNOWN_ERROR = 5

  • GUI_REFUSE_FILETRANSFER = 6

  • OTHERS = 7

.

if sy-subrc <> 0.

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

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

endif.

this may helpful for u...

Regards,

Mani

Former Member
0 Kudos

Hi Manikandan,

I am getting this error when I am excuting your program:

Function parameter "BOOKINGS" is unknown.

thanks for ur time & effort ..

Former Member
0 Kudos

Solved..!

Former Member
0 Kudos

Hi,

In the Function module

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = c_formname

IMPORTING

fm_name = v_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.

you need to pass the Smartform name to <b>c_formname</b>, so that the function module name will come to <b>v_fm_name</b>

Regards

Sudheer

Former Member
0 Kudos

Hi Sudheer ,

I have pass the form name 'FOPCR_STANDARD_F1'

still I am getting error

' Incorrect parameter with CALL FUNCTION ' ,

I am new to smartform ..could you please help me out..

Thanks for your time & effort .

Rahul

Former Member
0 Kudos

Hi Sharma,

Can you please explain me, what error you are getting exactly ?

regards,

  • Dj

Former Member
0 Kudos

Hi Dj ,

When I am trying to excute my report( smartform to pdf conversion) I am getting

ERROR : OTF end command // missing in OTF .

( CONVERT TO OTF TO PDF from this function module) .

***************************************************************************************

REPORT YPR_SMARTFORM.

DATA: it_otf TYPE STANDARD TABLE OF itcoo,

it_docs TYPE STANDARD TABLE OF docs,

it_lines TYPE STANDARD TABLE OF tline,

st_job_output_info TYPE ssfcrescl,

st_document_output_info TYPE ssfcrespd,

st_job_output_options TYPE ssfcresop,

st_output_options TYPE ssfcompop,

st_control_parameters TYPE ssfctrlop,

v_len_in TYPE so_obj_len,

v_language TYPE sflangu VALUE 'E',

v_e_devtype TYPE rspoptype,

v_bin_filesize TYPE i,

v_name TYPE string,

v_path TYPE string,

v_fullpath TYPE string,

v_filter TYPE string,

v_uact TYPE i,

v_guiobj TYPE REF TO cl_gui_frontend_services,

v_filename TYPE string,

v_fm_name TYPE rs38l_fnam.

CONSTANTS c_formname TYPE tdsfname VALUE 'ZTEST'.

CALL FUNCTION 'SSF_GET_DEVICE_TYPE'

EXPORTING

i_language = v_language

i_application = 'SAPDEFAULT'

IMPORTING

e_devtype = v_e_devtype.

st_output_options-tdprinter = v_e_devtype.

*st_output_options-tdprinter = 'locl'.

st_control_parameters-no_dialog = 'X'.

st_control_parameters-getotf = 'X'.

***.................GET SMARTFORM FUNCTION MODULE NAME.................

***

***CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

***EXPORTING

****formname = c_formname

***formname = 'FOPCR_STANDARD_F1'

***IMPORTING

***fm_name = v_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.

...........................CALL SMARTFORM............................

CALL FUNCTION '/1BCDWB/SF00000062'

  • EXPORTING

  • ARCHIVE_INDEX =

  • ARCHIVE_INDEX_TAB =

  • ARCHIVE_PARAMETERS =

  • CONTROL_PARAMETERS =

  • MAIL_APPL_OBJ =

  • MAIL_RECIPIENT =

  • MAIL_SENDER =

  • OUTPUT_OPTIONS =

  • USER_SETTINGS = 'X'

  • PWB_DATA =

  • C =

  • FSCD_DUNNING_STR_DUNN_HEAD =

  • IMPORTING

  • DOCUMENT_OUTPUT_INFO =

  • JOB_OUTPUT_INFO =

  • 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.

**CALL FUNCTION v_fm_name

**EXPORTING

**control_parameters = st_control_parameters

**output_options = st_output_options

**IMPORTING

**document_output_info = st_document_output_info

**job_output_info = st_job_output_info

**job_output_options = st_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.

**ELSE.

**

.........................CONVERT TO OTF TO PDF.......................

CALL FUNCTION 'CONVERT_OTF_2_PDF'

IMPORTING

bin_filesize = v_bin_filesize

TABLES

otf = st_job_output_info-otfdata

doctab_archive = it_docs

lines = it_lines

EXCEPTIONS

err_conv_not_possible = 1

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

........................GET THE FILE NAME TO STORE....................

CONCATENATE 'smrt' '.pdf' INTO v_name.

CREATE OBJECT v_guiobj.

CALL METHOD v_guiobj->file_save_dialog

EXPORTING

default_extension = 'pdf'

default_file_name = v_name

file_filter = v_filter

CHANGING

filename = v_name

path = v_path

fullpath = v_fullpath

user_action = v_uact.

IF v_uact = v_guiobj->action_cancel.

EXIT.

ENDIF.

..................................DOWNLOAD AS FILE....................

MOVE v_fullpath TO v_filename.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = v_bin_filesize

filename = v_filename

filetype = 'BIN'

TABLES

data_tab = it_lines

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22.

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.

Thanks for your time .

former_member673464
Active Contributor
0 Kudos

hi try this code..

Calling the Smart form, then it returns the OTF data in Return.

Converting the OTF data into required format using the Function Module CONVERT_OTF_2_PDF.

Download the File

&----


*& Report ZTEST_NREDDY_PDF

*&

&----


*&

*&

&----


REPORT ZTEST_NREDDY_PDF.

DATA: it_otf TYPE STANDARD TABLE OF itcoo,

it_docs TYPE STANDARD TABLE OF docs,

it_lines TYPE STANDARD TABLE OF tline,

st_job_output_info TYPE ssfcrescl,

st_document_output_info TYPE ssfcrespd,

st_job_output_options TYPE ssfcresop,

st_output_options TYPE ssfcompop,

st_control_parameters TYPE ssfctrlop,

v_len_in TYPE so_obj_len,

v_language TYPE sflangu VALUE 'E',

v_e_devtype TYPE rspoptype,

v_bin_filesize TYPE i,

v_name TYPE string,

v_path TYPE string,

v_fullpath TYPE string,

v_filter TYPE string,

v_uact TYPE i,

v_guiobj TYPE REF TO cl_gui_frontend_services,

v_filename TYPE string,

v_fm_name TYPE rs38l_fnam.

CONSTANTS c_formname TYPE tdsfname VALUE 'ZTEST'.

CALL FUNCTION 'SSF_GET_DEVICE_TYPE'

EXPORTING

i_language = v_language

i_application = 'SAPDEFAULT'

IMPORTING

e_devtype = v_e_devtype.

st_output_options-tdprinter = v_e_devtype.

*st_output_options-tdprinter = 'locl'.

st_control_parameters-no_dialog = 'X'.

st_control_parameters-getotf = 'X'.

.................GET SMARTFORM FUNCTION MODULE NAME.................

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = c_formname

IMPORTING

fm_name = v_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.

...........................CALL SMARTFORM............................

CALL FUNCTION v_fm_name

EXPORTING

control_parameters = st_control_parameters

output_options = st_output_options

IMPORTING

document_output_info = st_document_output_info

job_output_info = st_job_output_info

job_output_options = st_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.

ELSE.

.........................CONVERT TO OTF TO PDF.......................

CALL FUNCTION 'CONVERT_OTF_2_PDF'

IMPORTING

bin_filesize = v_bin_filesize

TABLES

otf = st_job_output_info-otfdata

doctab_archive = it_docs

lines = it_lines

EXCEPTIONS

err_conv_not_possible = 1

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

........................GET THE FILE NAME TO STORE....................

CONCATENATE 'smrt' '.pdf' INTO v_name.

CREATE OBJECT v_guiobj.

CALL METHOD v_guiobj->file_save_dialog

EXPORTING

default_extension = 'pdf'

default_file_name = v_name

file_filter = v_filter

CHANGING

filename = v_name

path = v_path

fullpath = v_fullpath

user_action = v_uact.

IF v_uact = v_guiobj->action_cancel.

EXIT.

ENDIF.

..................................DOWNLOAD AS FILE....................

MOVE v_fullpath TO v_filename.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = v_bin_filesize

filename = v_filename

filetype = 'BIN'

TABLES

data_tab = it_lines

EXCEPTIONS

file_write_error = 1

no_batch = 2

gui_refuse_filetransfer = 3

invalid_type = 4

no_authority = 5

unknown_error = 6

header_not_allowed = 7

separator_not_allowed = 8

filesize_not_allowed = 9

header_too_long = 10

dp_error_create = 11

dp_error_send = 12

dp_error_write = 13

unknown_dp_error = 14

access_denied = 15

dp_out_of_memory = 16

disk_full = 17

dp_timeout = 18

file_not_found = 19

dataprovider_exception = 20

control_flush_error = 21

OTHERS = 22.

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.

regards,

veeresh

Former Member
0 Kudos

Hi Veereshbabu ,

Thanks for your reply .

when I am trying to excute your report I am getting this error .

Error

Short text

Function module " " not found.

Rahul