cancel
Showing results for 
Search instead for 
Did you mean: 

Smartform in pdf format.

Former Member
0 Kudos
107

Hi All,

Can anyone help me out on ,how to convert the Smartforms into pdf format?

Thx in advance.

SK.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

VISIT THIS LINK

PLZ REWARD POINTS IF IT HELPS YOU

Answers (7)

Answers (7)

Former Member
0 Kudos

Use the below code,Its working for me.After this give "download"

DATA: i_otf TYPE itcoo OCCURS 0 WITH HEADER LINE,

i_tline TYPE TABLE OF tline WITH HEADER LINE,

i_record LIKE solisti1 OCCURS 0 WITH HEADER LINE,

w_return TYPE ssfcrescl,

w_data TYPE sodocchgi1,

w_ctrlop TYPE ssfctrlop,

w_compop TYPE ssfcompop,

w_buffer TYPE string,"To convert from 132 to 255

v_form_name TYPE rs38l_fnam,

v_len_in LIKE sood-objlen,

v_len_out LIKE sood-objlen,

v_len_outn TYPE i,

v_lines_txt TYPE i,

v_lines_bin TYPE i.

data Itab1 type ZSTRUCT_T.

Start-OF-Selection.

select ADRNR LIFNR LAND1 from LFA1

into corresponding fields of table itab1

where LAND1 in S_LAND1.

call function 'SSF_FUNCTION_MODULE_NAME'

exporting

formname = 'ZSMART_S'

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_compop-tdnoprev = 'X'.

CALL FUNCTION v_form_name

EXPORTING

Itab1 = ITAB1

control_parameters = w_ctrlop

output_options = w_compop

user_settings = 'X'

IMPORTING

job_output_info = w_return

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

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.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

  • Convert PDF from 132 to 255.

LOOP AT i_tline.

  • Replacing space by ~

TRANSLATE i_tline USING ' ~'.

CONCATENATE w_buffer i_tline INTO w_buffer.

ENDLOOP.

  • Replacing ~ by space

TRANSLATE w_buffer USING '~ '.

DO.

i_record = w_buffer.

  • Appending 255 characters as a record

APPEND i_record.

SHIFT w_buffer LEFT BY 255 PLACES.

IF w_buffer IS INITIAL.

EXIT.

ENDIF.

ENDDO.

Former Member
0 Kudos

check this.

Former Member
0 Kudos

Former Member
0 Kudos

Hi All,

This piece of code is not working and I can not use the program RSTXPDFT4.Requirment is pdf preview just.

SK.

Former Member
0 Kudos

CALL FUNCTION v_form_name

EXPORTING

Itab1 = ITAB1

Itab2 = ITAB2

control_parameters = w_ctrlop

output_options = w_compop

user_settings = 'X'

IMPORTING

job_output_info = w_return

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

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.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

abdul_hakim
Active Contributor
0 Kudos

Hi

Check the below links..

Regards,

Abdul

Message was edited by: Abdul Hakim

FredericGirod
Active Contributor
0 Kudos

Hi Subrato,

you can create direct PDF with smartform (depend of your release)

or you can convert the spool with an external program, like this one : RSTXPDFT4

Rgd

Frédéric