cancel
Showing results for 
Search instead for 
Did you mean: 

Compatability issue between smart form FM & PDF conversion FM

Former Member
0 Kudos

Hi there,

I am trying to convert the OTF into PDF, the smartform FM gives the OTF (JOB_OUTPUT_INFO-OTFDATA) in a different format and the OTF to PDF conversion FM(SX_OBJECT_CONVERT_OTF_PDF) takes input in a different format, can anybody please suggest me how can I get this type conversion done.

Selvam A

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

here is the solution to first get the o/p in OTF and then covert this OTF to PDF

&----


*& Report ZRV_SSF1 *

*& *

&----


*& *

*& *

&----


REPORT zrv_ssf1 .

TABLES kna1.

SELECT-OPTIONS: s_kunnr FOR kna1-kunnr.

DATA: itab2 LIKE kna1 OCCURS 0 WITH HEADER LINE.

DATA: v_fm TYPE rs38l_fnam.

DATA: w_ctrlop TYPE ssfctrlop,

w_compop TYPE ssfcompop,

w_return TYPE ssfcrescl.

DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,

v_len_in LIKE sood-objlen,

i_tline TYPE TABLE OF tline WITH HEADER LINE,

binfilesize TYPE i.

START-OF-SELECTION.

SELECT * FROM kna1

INTO TABLE itab2

WHERE kunnr IN s_kunnr.

IF NOT itab2[] IS INITIAL.

*finding the SSF function module name

CALL FUNCTION 'SSF_FUNCTION_MODULE_NAME'

EXPORTING

formname = 'ZRV_PO'

IMPORTING

fm_name = v_fm

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'. <b>"here u get o/p in OTF</b>

w_ctrlop-no_dialog = 'X'.

w_compop-tdnoprev = 'X'.

*calling the smartform

CALL FUNCTION v_fm

EXPORTING

control_parameters = w_ctrlop

output_options = w_compop

user_settings = 'X'

IMPORTING

job_output_info = w_return

TABLES

itab1 = itab2

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[].

<b>*Here you convert OTF to PDF</b>

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_filesize = v_len_in

TABLES

otf = i_otf

lines = i_tline

EXCEPTIONS

err_max_linewidth = 1

err_format = 2

err_conv_not_possible = 3

OTHERS = 4.

IF sy-subrc <> 0.

ENDIF.

CALL FUNCTION 'GUI_DOWNLOAD'

EXPORTING

bin_filesize = binfilesize

filename = 'E:\ssf.pdf'

filetype = 'BIN'

TABLES

data_tab = i_tline.

ENDIF.

Regards,

Ravi