Skip to Content
author's profile photo Former Member
Former Member

Text wrap in sending a form by e-mail

Hi,

I have sent a form by e-mail.But the text in the form is getting wrapped. If I compare the PDF document in the e-mail with the normal print output the text is not in a readable format in PDF. Can anyone know what's the reason for this.

Regards,

Asha

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Oct 21, 2005 at 01:20 PM

    Hi Asha,

    Check with this code as given below..

    *&----


    *

    *& Report YSSN_SIMPLE_SMARTFORM *

    *& *

    *&----


    *

    *& *

    *& *

    *&----


    *

    report zhr_bhaskar_pdf_to_email message-id zmsg.

    parameters: p_vbeln type vbak-vbeln default '35'.

    data: it_items type table of vbap,

    v_fm_name type rs38l_fnam,

    v_tot_lines type i,

    v_sy_tabix type i,

    output_data type ssfcrescl. " To hold Output information

    constants:

    c_sep type c value '-', " Value -

    c_x type c value 'X', " Value X

    c_space type c value ' '. " Space

    *****MAIL START

    include .

    data: g_mail_rec_obj type swotobjid,

    g_mail_sen_obj type swotobjid,

    g_mail_app_obj type swotobjid,

    g_cont_par type ssfctrlop,

    folder type swc_object,

    begin of sofmfol_key,

    foldertype like sofm-foltp,

    folderyear like sofm-folyr,

    foldernumber like sofm-folno,

    type like sofm-doctp,

    year like sofm-docyr,

    number like sofm-docno,

    forwarder like soub-usrnam,

    end of sofmfol_key,

    bor_key like swotobjid-objkey,

    g_mail type so_name value 'madang@intelligroup.com',

    g_rectype type so_escape value 'U'. " 'B'.

    data: job_output_info type ssfcrescl,

    hotfdata like itcoo occurs 1 with header line,

    htline like tline occurs 1 with header line,

    x_objcont like soli occurs 1 with header line,

    ld_packing_list like soxpl occurs 1 with header line,

    x_object_hd_change like sood1 occurs 1 with header line,

    x_objhead like soli occurs 1 with header line,

    x_receivers like soos1 occurs 1 with header line,

    format_pdf(10) value 'PDF',

    doc_size(12) type c,

    hltlines type i,

    htabix like sy-tabix,

    fle1(2) type p,

    fle2(2) type p,

    off1 type p,

    hfeld(500) type c.

    tables: soud.

    *****MAIL END

    select *

    into table it_items

    from vbap

    where vbeln = p_vbeln.

    if it_items[] is initial.

    exit.

    endif.

    perform call_smartform.

    *&----


    *

    *& Form call_smartform

    *&----


    *

    • text

    *----


    *

    • --> p1 text

    • <-- p2 text

    *----


    *

    form call_smartform .

    *DATA: lx_control_parameters TYPE SSFCTRLOP,

    • lx_OUTPUT_OPTIONS type SSFCOMPOP.

    • lx_OUTPUT_OPTIONS-TDIMMED = ' '.

    • lx_OUTPUT_OPTIONS-TDfinal = 'X'.

    • lx_OUTPUT_OPTIONS-TDDELETE = 'X'.

    • lx_CONTROL_PARAMETERS-NO_CLOSE = 'X'.

    • lx_CONTROL_PARAMETERS-NO_OPEN = ' '.

    data: x_ssfcompop type ssfcompop,

    x_ssfctrlop like ssfctrlop,

    x_ssfcrescl type ssfcrescl.

    **MAIL

    g_cont_par-langu = sy-langu.

    g_cont_par-no_dialog = 'X'.

    g_cont_par-getotf = 'X'.

    g_cont_par-device = 'MAIL'.

    • Get BOR-Objects for Recipient, Sender und Applikation

    perform mail_recipient_object changing g_mail_rec_obj.

    perform mail_sender_object changing g_mail_sen_obj.

    perform mail_appl_object changing g_mail_app_obj.

    **MAIL

    *--Internal table is having more than 1 record

    if v_tot_lines gt 1.

    if v_sy_tabix = 1.

    *--For first record of table

    x_ssfctrlop-no_open = c_space.

    x_ssfctrlop-no_close = c_x.

    elseif v_sy_tabix = v_tot_lines.

    *--For last record of table

    x_ssfctrlop-no_open = c_x.

    x_ssfctrlop-no_close = c_space.

    else.

    x_ssfctrlop-no_open = c_x.

    x_ssfctrlop-no_close = c_x.

    endif.

    endif.

    • IF r_previ = c_x.

    x_ssfctrlop-preview = c_x.

    x_ssfctrlop-getotf = c_x.

    • ENDIF.

    call function 'SSF_FUNCTION_MODULE_NAME'

    exporting

    formname = 'YSSN_SMARTFORM'

    • VARIANT = ' '

    • DIRECT_CALL = ' '

    importing

    fm_name = v_fm_name

    • EXCEPTIONS

    • NO_FORM = 1

    • NO_FUNCTION_MODULE = 2

    • OTHERS = 3

    .

    if sy-subrc <> 0.

    message i000 with 'Smart form module name failure'.

    exit.

    endif.

    • CALL FUNCTION '/1BCDWB/SF00000199'

    call function v_fm_name

    exporting

    • ARCHIVE_INDEX =

    • ARCHIVE_INDEX_TAB =

    • ARCHIVE_PARAMETERS =

    control_parameters = g_cont_par

    mail_appl_obj = g_mail_app_obj

    mail_recipient = g_mail_rec_obj

    mail_sender = g_mail_sen_obj

    • OUTPUT_OPTIONS = lx_OUTPUT_OPTIONS

    • USER_SETTINGS = 'X'

    t_vbap = it_items

    • IMPORTING

    • DOCUMENT_OUTPUT_INFO =

    job_output_info = job_output_info

    • JOB_OUTPUT_OPTIONS =

    • EXCEPTIONS

    • FORMATTING_ERROR = 1

    • INTERNAL_ERROR = 2

    • SEND_ERROR = 3

    • USER_CANCELED = 4

    • OTHERS = 5

    .

    perform send_pdf_mail.

    endform. " call_smartform

    *&----


    *

    *& Form send_pdf_mail

    *&----


    *

    • text

    *----


    *

    • --> p1 text

    • <-- p2 text

    *----


    *

    form send_pdf_mail .

    data ld_binfile type xstring.

    • pdf_table type rcl_bag_tline,

    data: ld_originator like soos1-recextnam.

    • convert form

    loop at job_output_info-otfdata into hotfdata.

    append hotfdata.

    endloop.

    call function 'CONVERT_OTF'

    exporting

    format = format_pdf

    max_linewidth = 132

    importing

    bin_filesize = doc_size

    bin_file = ld_binfile

    tables

    otf = output_data-otfdata

    lines = htline

    exceptions

    err_max_linewidth = 1

    err_format = 2

    err_conv_not_possible = 3

    others = 4.

    *-Itab 134 Zeichen nach 255 Zeichen überführen

    describe table htline lines hltlines.

    describe field htline length fle1 in character mode.

    describe field x_objcont length fle2 in character mode.

    loop at htline.

    htabix = sy-tabix.

    move htline to hfeld+off1.

    if htabix = hltlines.

    fle1 = strlen( htline ).

    endif.

    off1 = off1 + fle1.

    if off1 ge fle2.

    clear x_objcont.

    x_objcont = hfeld(fle2).

    append x_objcont.

    shift hfeld by fle2 places.

    off1 = off1 - fle2.

    endif.

    if htabix = hltlines.

    if off1 gt 0.

    clear x_objcont.

    x_objcont = hfeld(off1).

    append x_objcont.

    endif.

    endif.

    endloop.

    x_object_hd_change-objnam = 'EMAIL'.

    x_object_hd_change-objdes = 'Smart Form'.

    x_object_hd_change-objla = sy-langu.

    x_object_hd_change-objsns = 'O'.

    x_object_hd_change-objlen = doc_size.

    x_object_hd_change-file_ext = 'TXT'.

    ld_packing_list-transf_bin = 'X'.

    ld_packing_list-head_start = 1.

    ld_packing_list-head_num = 0.

    ld_packing_list-body_start = 1.

    describe table x_objcont lines ld_packing_list-body_num.

    ld_packing_list-objtp = 'EXT'.

    ld_packing_list-objdes = 'Smart Form'.

    ld_packing_list-objla = sy-langu.

    ld_packing_list-objlen = doc_size.

    ld_packing_list-file_ext = 'PDF'.

    append ld_packing_list.

    x_receivers-recextnam = g_mail.

    x_receivers-recesc = 'E'.

    x_receivers-sndart = 'INT'.

    append x_receivers.

    ld_originator = 'madang@intelligroup.com'.

    • ld_originator = FSABE-USRNAM.

    call function 'SO_OBJECT_SEND'

    exporting

    object_hd_change = x_object_hd_change

    object_type = 'RAW'

    originator_type = 'B' "Einfügen

    originator = ld_originator "Einfügen

    tables

    • objcont = ld_text

    receivers = x_receivers

    packing_list = ld_packing_list

    att_cont = x_objcont

    att_head = x_objhead

    exceptions

    active_user_not_exist = 1

    communication_failure = 2

    component_not_available = 3

    folder_not_exist = 4

    folder_no_authorization = 5

    forwarder_not_exist = 6

    note_not_exist = 7

    object_not_exist = 8

    object_not_sent = 9

    object_no_authorization = 10

    object_type_not_exist = 11

    operation_no_authorization = 12

    owner_not_exist = 13

    parameter_error = 14

    substitute_not_active = 15

    substitute_not_defined = 16

    system_failure = 17

    too_much_receivers = 18

    user_not_exist = 19

    x_error = 20

    others = 21.

    endform. " send_pdf_mail

    *&----


    *

    *& Form mail_sender_object

    *&----


    *

    • text

    *----


    *

    • <--P_G_MAIL_SEN_OBJ text

    *----


    *

    form mail_sender_object changing p_mail_sen_obj.

    call function 'CREATE_SENDER_OBJECT_PPF'

    exporting

    ip_sender = sy-uname

    importing

    ep_sender_id = p_mail_sen_obj

    exceptions

    invalid_sender = 1

    others = 2.

    if sy-subrc <> 0.

    message id sy-msgid type sy-msgty number sy-msgno

    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    endif.

    endform. " mail_sender_object

    *&----


    *

    *& Form mail_appl_object

    *&----


    *

    • text

    *----


    *

    • <--P_G_MAIL_APP_OBJ text

    *----


    *

    form mail_appl_object changing p_mail_app_obj.

    • SELECT * FROM soud WHERE sapnam LIKE sy-uname AND deleted = ' '.

    • ENDSELECT.

    • IF sy-subrc NE 0.

    call function 'SO_USER_AUTOMATIC_INSERT'

    exporting

    sapname = sy-uname

    exceptions

    no_insert = 1

    sap_name_exist = 2

    x_error = 3

    others = 4.

    if sy-subrc ne 0.

    clear soud.

    else.

    select * from soud where sapnam like sy-uname and deleted = ' '.

    endselect.

    endif.

    • ENDIF.

    clear sofmfol_key.

    sofmfol_key-type = 'FOL'.

    sofmfol_key-year = soud-inbyr.

    sofmfol_key-number = soud-inbno.

    bor_key = sofmfol_key.

    if not bor_key is initial.

    swc_create_object folder 'SOFMFOL' bor_key.

    if sy-subrc = 0.

    swc_object_to_persistent folder p_mail_app_obj.

    if sy-subrc ne 0.

    clear p_mail_app_obj.

    endif.

    endif.

    else.

    clear p_mail_app_obj.

    endif.

    endform. " mail_appl_object

    *&----


    *

    *& Form mail_recipient_object

    *&----


    *

    • text

    *----


    *

    • <--P_G_MAIL_REC_OBJ text

    *----


    *

    form mail_recipient_object changing p_mail_rec_obj.

    call function 'CREATE_RECIPIENT_OBJ_PPF'

    exporting

    • IP_COUNTRY =

    • IP_FAXNO =

    ip_mailaddr = g_mail

    ip_type_id = g_rectype " 'U'

    importing

    ep_recipient_id = p_mail_rec_obj

    • EP_ADDRESS =

    • ET_RECIPIENT =

    exceptions

    invalid_recipient = 1

    others = 2.

    if sy-subrc <> 0.

    message id sy-msgid type sy-msgty number sy-msgno

    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

    endif.

    endform. " mail_recipient_object

    Hope this helps you.

    Regards,

    Sampath.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.