Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Store email texts and their translation

Former Member
0 Kudos

Hello everybody,

I've got to create an ABAP program that sends e-mail to a list of people (dynamically defined).

One part of the text of the e-mail is fixed, the other part is stored in a specific table (and changes).

I already coded the program itself, but for now I just use an hard-coded example text for the fixed part of the text.

I've got 2 questions:

1) What is the best way to store the fixed part of my text e-mail, knowing that I will have to have English, Spanish and maybe some other versions of it?

2) How can I include a link into the body of my e-mail?

Some recommended to use transaction se61, but I do not know for now how to retrieve texts stored with this transaction using ABAP and I'm not sure if it is a good solution.

Thanks in advance for your help.

Regards,

François

Edited by: Franis Pignon on Nov 10, 2008 9:14 PM

1 ACCEPTED SOLUTION

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

1) You should store your text as standard text via transaction SO10. You can then use the function module READ_TEXT to read the text into your program to include into the email.

2) to include links, you need to use HTML in your email body. Then when sending the email, you need to specifiy the document type as "HTM".

Here is an example.

report zrich_0002.

data: maildata   like sodocchgi1.
data: mailtxt    like solisti1 occurs 10 with header line.
data: mailrec    like somlrec90 occurs 0  with header line.

start-of-selection.

  clear:    maildata, mailtxt,  mailrec.
  refresh:  mailtxt, mailrec.


  maildata-obj_name = 'TEST'.
  maildata-obj_descr = 'Test Subject'.


* Set email body
  mailtxt  = '<html>'.
  append mailtxt.


  mailtxt  = '<body>'.
  append mailtxt.

  mailtxt
   = '<a href="http:\\www.sap.com" target="_blank">SAP Hyperlink</a> '.
  append mailtxt.

  mailtxt  = '</body>'.
  append mailtxt.

  mailtxt  = '</html>'.
  append mailtxt.



* Set reciever
  mailrec-receiver = <email address here>.
  mailrec-rec_type  = 'U'.
  append mailrec.



  call function 'SO_NEW_DOCUMENT_SEND_API1'
       exporting
            document_data              = maildata
            document_type              = 'HTM'
            put_in_outbox              = 'X'
       tables
            object_header              = mailtxt
            object_content             = mailtxt
            receivers                  = mailrec
       exceptions
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            others                     = 8.

Regards,

Rich Heilman

7 REPLIES 7

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

1) You should store your text as standard text via transaction SO10. You can then use the function module READ_TEXT to read the text into your program to include into the email.

2) to include links, you need to use HTML in your email body. Then when sending the email, you need to specifiy the document type as "HTM".

Here is an example.

report zrich_0002.

data: maildata   like sodocchgi1.
data: mailtxt    like solisti1 occurs 10 with header line.
data: mailrec    like somlrec90 occurs 0  with header line.

start-of-selection.

  clear:    maildata, mailtxt,  mailrec.
  refresh:  mailtxt, mailrec.


  maildata-obj_name = 'TEST'.
  maildata-obj_descr = 'Test Subject'.


* Set email body
  mailtxt  = '<html>'.
  append mailtxt.


  mailtxt  = '<body>'.
  append mailtxt.

  mailtxt
   = '<a href="http:\\www.sap.com" target="_blank">SAP Hyperlink</a> '.
  append mailtxt.

  mailtxt  = '</body>'.
  append mailtxt.

  mailtxt  = '</html>'.
  append mailtxt.



* Set reciever
  mailrec-receiver = <email address here>.
  mailrec-rec_type  = 'U'.
  append mailrec.



  call function 'SO_NEW_DOCUMENT_SEND_API1'
       exporting
            document_data              = maildata
            document_type              = 'HTM'
            put_in_outbox              = 'X'
       tables
            object_header              = mailtxt
            object_content             = mailtxt
            receivers                  = mailrec
       exceptions
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7
            others                     = 8.

Regards,

Rich Heilman

0 Kudos

Thank you very much. I think it's just what I needed! I use FM SO_OBJECT_SEND but I think I can use it the same way than yoursu2026

I've just been told that I HAVE to use se61 to store email texts because that's the way they dou2026 Don't know if it's the best solution, but anywaysu2026

I still have to figure out how to read texts stored using this transactionu2026

Thank you again

Former Member
0 Kudos

Hi Franis, use se61 can be a good idea.

You can find saved texts from table DOCKTL.

0 Kudos

Thank you Rodrigo!

0 Kudos

Humu2026 I can't find table "DOCKTL"u2026 Are you sure it is the right one?

Former Member
0 Kudos

Still have to figure out how to read text stored using se61

0 Kudos

To read text stored using SE61, you can use FM DOCU_GET_FOR_F1HELP