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: 

ask for help about mail content

Former Member
0 Kudos

hi experts

I am trying to using workflow to send an email by using Send Mail Step.

and I have a variant for mail body, which type is char100, and then bind this variant to Send Mail Step's body.

but I find it can not break line, when the length of body is 100, it can only print out 80 characters, and the last 20 got lost, so I tried to break line in the body, I tried add <br> in the body variant, but it can not work.

can anybody help out?

many thanks

1 ACCEPTED SOLUTION

former_member217544
Active Contributor
0 Kudos

Hi,

At this point, I can think of one idea.Check this one.

if it_table1 is teh table with 100 character

and let say it_workflow is table with 80 characters.

Declare a string type variable and do this process.

DATA: it_string typr table of string,

wa_string type string.

loop at it_table into wa_table1.

concatenate wa_string wa_table1 into wa_string

separated by space.

endloop.

" at this point wa_string contains the complete data.

Now break the content of wa_string at 80 characters and append each 80 character record to it_workflow table.

" Now it_workflow table contains the records with 80 characters.

Hope thsi will help.

Regards,

Swarna Munukoti.

4 REPLIES 4

Former Member
0 Kudos

DATA : BEGIN OF tb_mailid OCCURS 0,

id(30) TYPE c,

END OF tb_mailid,

tb_receiver TYPE TABLE OF somlreci1,

tb_contents TYPE TABLE OF solisti1,

tb_packlist TYPE TABLE OF sopcklsti1,

wa_mailid LIKE LINE OF tb_mailid,

wa_receiver TYPE somlreci1,

wa_contents TYPE solisti1,

wa_doc TYPE sodocchgi1,

wa_packlist TYPE sopcklsti1,

wf_lines TYPE i.

  • append the maid ids

*CLEAR wa_mailid.

*wa_mailid-id = ' '.

*APPEND wa_mailid TO tb_mailid.

*

*CLEAR wa_mailid.

*wa_mailid-id = ' '.

*APPEND wa_mailid TO tb_mailid.

*

*CLEAR wa_mailid.

*wa_mailid-id = ' '.

*APPEND wa_mailid TO tb_mailid.

CLEAR wa_mailid.

wa_mailid-id = ' '.

APPEND wa_mailid TO tb_mailid.

  • fil the content data

CLEAR wa_contents.

wa_contents-line = 'This is test prg to check'.

APPEND wa_contents TO tb_contents.

CLEAR wa_contents.

wa_contents-line = 'EMail option in ABAP.'.

APPEND wa_contents TO tb_contents.

CLEAR wa_contents.

wa_contents-line = 'This is auto generated mail.'.

APPEND wa_contents TO tb_contents.

CLEAR wa_contents.

wa_contents-line = 'Please dont reply back.'.

APPEND wa_contents TO tb_contents.

  • fill the data to be passed to FM.

  • fill recievers data:

LOOP AT tb_mailid.

wa_receiver-receiver = tb_mailid-id.

TRANSLATE wa_receiver-receiver TO UPPER CASE.

wa_receiver-rec_type = 'U'.

wa_receiver-com_type = 'INT'.

APPEND wa_receiver TO tb_receiver.

CLEAR: tb_mailid, wa_receiver.

ENDLOOP.

  • fill the document data

wa_doc-obj_descr = 'Test Program'.

wa_doc-obj_name = 'Test'.

wa_doc-priority = '1'.

wa_doc-doc_size = 255.

  • fill packing list data

DESCRIBE TABLE tb_contents LINES wf_lines.

wa_packlist-head_start = 1.

wa_packlist-head_num = 0.

wa_packlist-body_start = 1.

wa_packlist-body_num = wf_lines.

wa_packlist-doc_type = 'R'.

APPEND wa_packlist TO tb_packlist.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = wa_doc

commit_work = 'X'

  • IMPORTING

  • SENT_TO_ALL =

  • NEW_OBJECT_ID =

TABLES

packing_list = tb_packlist

contents_txt = tb_contents

receivers = tb_receiver

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

.

IF sy-subrc <> 0.

WRITE 😕 sy-msgv1,

/ sy-msgv2,

/ sy-msgv3.

ELSE.

WRITE : 'Mail has been succesfully sent'.

ENDIF.

HOPE THIS WILL HELP YOU

WITH REGARDS

s.JANAGAR

Former Member
0 Kudos

Hi, CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1', put your content in the export tables CONTENTS_TXT, the lenght of each line is 255.

Hope this can help you.

0 Kudos

HI , thank you for your reply

but i think u got the wrong ideas, now I am using workflow to send email, there is a step in workflow called Send Email, I just need to bind the content to this step, and the content can not break line.

former_member217544
Active Contributor
0 Kudos

Hi,

At this point, I can think of one idea.Check this one.

if it_table1 is teh table with 100 character

and let say it_workflow is table with 80 characters.

Declare a string type variable and do this process.

DATA: it_string typr table of string,

wa_string type string.

loop at it_table into wa_table1.

concatenate wa_string wa_table1 into wa_string

separated by space.

endloop.

" at this point wa_string contains the complete data.

Now break the content of wa_string at 80 characters and append each 80 character record to it_workflow table.

" Now it_workflow table contains the records with 80 characters.

Hope thsi will help.

Regards,

Swarna Munukoti.