cancel
Showing results for 
Search instead for 
Did you mean: 

email smartstyle formatted text with class CL_BCS

marco_weienseel
Explorer
0 Kudos

Hello,

i am sending an Email using class CL_BCS.

The eMail-Text is defined in a Smartforms Textmodule using Smartstyle.

I am reading the Textmodule using FM 'SSFRT_READ_TEXTMODULE'.

As a result i now have the text in an internal table of type TLINE_T (tdformat, tdline).


DATA: gt_mail_text               TYPE tline_t,
            lv_textmodule_name TYPE tdsfname,
            ls_langu                    TYPE ssfrlang,
            lls_mail_subj             TYPE so_obj_des,
            lt_mail_text               TYPE soli_tab.

lls_langu-langu1 = sy-langu.

CALL FUNCTION 'SSFRT_READ_TEXTMODULE'
      EXPORTING
        i_textmodule       = lv_textmodule_name
        i_languages        = ls_langu
      IMPORTING
        o_text                 = gt_mail_text
      EXCEPTIONS
        error                          = 1
        language_not_found = 2
        OTHERS                    = 3.
...
 ls_mail_subj = 'Test'.

  LOOP AT gt_mail_text INTO ls_text.
*    APPEND ls_text-tdline TO lt_mail_text.
    APPEND ls_text TO lt_mail_text.
  ENDLOOP.
...
ref_document = cl_document_bcs=>create_document(
*  i_type       = 'RAW'
  i_type        = 'SCR'  
  i_subjec    = ls_mail_subj
  i_text         = lt_mail_text ). 

Question:

How can i add the eMail-Text to my send request, so that the Smartstyle Formatting of my Textmodule is correctly displayed.

I have alreasy tried i_type RAW and SCR, but in both cases the text is not displayed formatted in the eMail, the tags of the formatting are written as part of the text, for example .

There is also a i_type OTF, so i thought about converting the Smartforms textmodule to OTF and adding this to the eMail-Document, but i don't know how.

I know i could also define my text in Transaction SO10 or SE61, but SO10 doesnt support Smartstyles, which i need for my Smartform, but thats another story.

Thank you very much for your help.

Edited by: Marco Weißenseel on Nov 9, 2010 10:54 AM

Accepted Solutions (1)

Accepted Solutions (1)

Clemenss
Active Contributor
0 Kudos

Hi Marco,

I don't know if this is possible.

If the text is includes in a (very simple) smartform, you can create HTML or PDF output and send that.

I remember there was a blog several years ago on how to send smartform output as HTML-formatted mail in mail body.

Regards,

Clemens

Answers (2)

Answers (2)

marco_weienseel
Explorer
0 Kudos

Hi Clemens,

i am already doing what you suggested with other Text Modules.

Customer writes name of text module into Customizing.

I pass the name through the interface to the smartform.

And add it to a text node, displaying it with formatting, works fine.

But in the current case i am not using the textmodule in smartforms, but inside my ABAP programm, after the smartform is called.

I am using the textmodule as a text container, where the customer can customize the E-Mail text.

Those textmodules can be formatted, but it seems that the Smartforms/Smartstyle technology is not (yet) compatible to the class cl_document_bcs.

I found a little workaround: set i_type to 'HTM' (allthough HTM is not part of the value table of the domain) and add HTML formatted text to the document --> it will be displayed HTML formatted.

Unfortunately this is no solution for me, because those smartforms textmodules can't be HTML formatted, only smartstyle.

I think for now the application will not support formatted E-Mail texts.

Thank You.

OttoGold
Active Contributor
0 Kudos

I´ve done the same thing - used smartform (+cust) to maintain the email text body for me (variables etc.). I am not sure if there are any other solutions, I didn´t find any. Otto

Clemenss
Active Contributor
0 Kudos

Hi Marco,

in a way, you are right.

CL_BCS can send whatever you want. But "formatted" text is ASCII enhanced with any kind of formatting options. They have to be interpreted by the receiving mail client.

One possible way is the pdf attachment that can be created from smartforms or sapscript output. Another way is to use HTML as format: Most if not all mail clients commonly used will detect HTML format and interpret it applying the formatting specified with HTML.

Until today, SAP/ABAP does not provide (as far as I know) an easy way to create HTML output from sapscript/smartform-formatted text.

A workaraound for you might be to have the user edit the text, save it and have it integrated in a form created after the save.

Regards,

Clemens

marco_weienseel
Explorer
0 Kudos

Hi,

thank you for your answer.

so you are suggesting, that i create a new smartform and only Include the textmodule.

Than call the Functionmodule of the new Smartform to get the OTF-Data.

Finally add the OTF-Data as eMail-Text to the BCS document.

But unfortunatly i can't do this, because the textmodule is created by the customer and he writes the name of the textmodule in our customizing, so my application knows which text to use.

Greetings

Edited by: Marco Weißenseel on Nov 11, 2010 1:40 PM

Clemenss
Active Contributor
0 Kudos

Hi Marco,

I think you can include the text in a text node in the smartform, set the name as something like &iv_runtime_text_name&, pass the text as parameter iv_runtime_text_name in the smartforms interface. If parameter is not available globally in the smartform, you can introduce a global field for that.

Regards,

Clemens