Skip to Content
0
Former Member
Jun 24, 2008 at 07:45 PM

problem in sending the smartform as email for other language except english

36 Views

Hi Experts,

I could not send the smartform as an attachment for other languages, but where as i could send it in english.

The program is working fine with print priview but not when sending the SF as an attachment

(in other languages except english).

Please do find the below code which i used to send the smartform as an attachment.

Please let me know if there is any mistake in the code.

wa_ctrlop-LANGU = nast-spras.

wa_ctrlop-getotf = 'X'.

wa_ctrlop-no_dialog = 'X'.

wa_compop-tdnoprev = 'X'.

CALL FUNCTION lf_fm_name "'/1BCDWB/SF00000197'

EXPORTING

control_parameters = wa_ctrlop

output_options = wa_compop

user_settings = 'X'

is_ekko = l_doc-xekko

is_pekko = l_doc-xpekko

is_nast = l_nast

iv_from_mem = l_from_memory

iv_druvo = iv_druvo

iv_xfz = iv_xfz

IMPORTING

job_output_info = wa_return

TABLES

it_ekpo = l_doc-xekpo[]

it_ekpa = l_doc-xekpa[]

it_pekpo = l_doc-xpekpo[]

it_eket = l_doc-xeket[]

it_tkomv = l_doc-xtkomv[]

it_ekkn = l_doc-xekkn[]

it_ekek = l_doc-xekek[]

it_komk = l_xkomk[]

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.

*Convert the data from OTF to PDF format

it_otf[] = wa_return-otfdata[].

CALL FUNCTION 'CONVERT_OTF'

EXPORTING

format = 'PDF'

max_linewidth = 132

IMPORTING

bin_filesize = l_len_in

bin_file = lp_xcontent

TABLES

otf = it_otf

lines = it_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.

TRY.

  • ---------- create persistent send request ----------------------

send_request = cl_bcs=>create_persistent( ).

len = XSTRLEN( lp_xcontent ).

  • transform to solix tab

lt_solix =

cl_document_bcs=>xstring_to_solix(

ip_xstring = lp_xcontent ).

  • Create Body to the E-mail.

APPEND Text-005 TO l_text.

  • Attachment Name

l_ponumber = text-004.

CONCATENATE l_ponumber l_doc-xekko-ebeln INTO l_ponumber.

  • Subject for the E-Mail.

l_subject = text-001.

CONCATENATE l_subject l_doc-xekko-ebeln INTO l_subject.

*create document E-Mail.

*TRY.

CALL METHOD cl_document_bcs=>create_document

EXPORTING

i_type = 'RAW'

i_subject = l_subject

i_length = '13'

i_language = nast-spras

  • i_importance =

  • i_sensitivity =

i_text = l_text

  • i_hex =

  • i_header =

  • i_sender =

receiving

RESULT = l_email_object

.

  • CATCH cx_document_bcs .

*ENDTRY.

  • CALL METHOD cl_document_bcs=>create_document

  • EXPORTING

  • i_type = 'RAW'

  • i_subject = l_subject

  • i_length = '13'

  • i_text = l_text

  • RECEIVING

  • result = l_email_object.

*Create PDF Document

bcs_doc = cl_document_bcs=>create_document(

i_type = 'PDF'

i_subject = l_ponumber

i_length = len

i_language = nast-spras

i_hex = lt_solix

).

*Type casting

obj_pdf_file ?= bcs_doc.

  • Add PDF document as an attachment

CALL METHOD l_email_object->add_document_as_attachment

EXPORTING

im_document = obj_pdf_file.