Академический Документы
Профессиональный Документы
Культура Документы
shown below.
In the Text Name field enter the name of the standard text which we are going to create.
After entering the name as shown in the above screen press on the create button available. Next screen appears as shown below.
In the space provided we can enter the text which we needed and can save the standard text as shown below.
We have various options for formatting the text which we will be discussed below. We will not be able to see the preview in the same screen but
we can see the preview in print preview by selecting Text-> Print Preview option in the menu bar.
We also have a different text editor. Which we can use for entering and editing the text. But the difference is that we will be able to see the
alignment in the same screen where we enter the text. To see the other editor we need to click GOTO -> Change Editor. Then we will be able to
see the actual output.
Now let us see the various formatting options which we can use.
.
Now we can see few examples for the various formatting options. The formatting options are quite familiar to the user. Now let us see how the
output will look like with the formatting options.
Now we can see each of the formatting options with an example.
Default Paragraph*
Is the default paragraph we will get the output or display as we there wont be any change in alignment it will be defaulted.
B
Paragraph Justified
Is used when the paragraph needs to be justified. The paragraph which is given with this formatting option will be justified in the output.
Space Continuous Text
Is used to define continuous text i.e. when we need two or more lines in a same paragraph we can mention it as a continuous text by just
specifying space in the format option.
We can define the format for the paragraph as shown below
And the preview or the text in the output will appear as shown,
Centered
Is used to align the paragraph to center. So in the preview we can see the paragraph will be centre aligned.
L
Extended Line
Is used when we need to extended the line. When we want the current line to be displayed following the preceding line we can use this. This is
similar to space formatting option but if we give space the line will get appended to the previous line at the editing mode itself. But if we need the
line to be appended to the preceding line only at the output we can go for this option.
(
Raw line
We use this formatting option when we want to follow the same paragraph format as use previously. i.e. when we need to adapt the same
paragraph format of the previous paragraph used we go for this option. When we use this option the next line will also be append to the previous
line.
We can specify the formatting as shown below.
It looks like this when we just enter the text but after we press enter or save button the screen looks as shown below .
The second line of second paragraph is appended to its previous line. (Which will be indicated using a small symbol >at the end of the first line).
Now the output will be as shown
Line Feed
Using this formatting option will display the text in the next line. Its not related to formatting it performs the normal function as we use in write
statement to print the statement in next line
/=
This is same line extended line option but what it does is, it displays the content of the current line in the next line.
/(
This is same like raw line but when we want the preceding line to be displayed at the next line and we want only the paragraph format of the
previous paragraph to be imported we can use this option.
We can specify the formatting option as shown,
/:
Command Line
We use this when we use come command lines for our better understanding. These lines are not interpreted. The command line must end with in
a single line. Once we specify the line in this format the contents of this line will be converted to caps.
/
Comment Line*
We use this when we need to write comments, like we write in our normal programs. These statements will not be executed or interpreted this
only for our understanding.
We can specify the format as shown,
We can read this standard text using a function module and we can use it in an email body.
Read the text using a function module READ_TEXT. The sample code is shown below,
CALL FUNCTION 'READ_TEXT'
EXPORTING
client
= sy-mandt
id
= 'ST'
"Standard Text
language
= sy-langu
"System Language
name
= 'Z02EXAMPLE'
Name of Standard Text
object
= 'TEXT'
TABLES
lines
= t_lines
EXCEPTIONS
id
=1
language
=2
name
=3
not_found
=4
object
=5
reference_check
=6
wrong_access_to_archive = 7
OTHERS
= 8.
IF sy-subrc <> 0.
RETURN.
ENDIF.
LOOP AT t_lines INTO x_lines WHERE tdformat NE '/*'.
APPEND x_lines-tdline TO t_body.
ENDLOOP.
Now the table t_body will be having the contents of the standard text. This can be directly used in the email body.
The example program code for reading the standard text and using it in email is shown below,
REPORT Z02_EXAMPLE.
DATA : x_lines TYPE tline.
DATA : t_lines TYPE tline_t.
data : t_BODY TYPE soli_tab.
REFRESH: t_body.
CALL FUNCTION 'READ_TEXT'
EXPORTING
client
= sy-mandt
id
= 'ST' "Standard Text
language
= sy-langu "System Language
name
= 'Z02EXAMPLE'
object
= 'TEXT'
TABLES
lines
= t_lines
EXCEPTIONS
id
=1
language
=2
name
=3
not_found
=4
object
=5
reference_check
=6
wrong_access_to_archive = 7
OTHERS
= 8.
IF sy-subrc <> 0.
RETURN.
ENDIF.
LOOP AT t_lines INTO x_lines WHERE tdformat NE '/*'.
APPEND x_lines-tdline TO t_body.
ENDLOOP.
DATA: v_send_request TYPE REF TO cl_bcs,
" E-Mail Send Request
v_document
TYPE REF TO cl_document_bcs, " E-Mail Attachment
v_sender
TYPE REF TO if_sender_bcs, " Address of Sender
v_recipient
TYPE REF TO if_recipient_bcs, " Distribution List
v_bcs_exception TYPE REF TO cx_document_bcs, " BCS Exception
v_send_exception TYPE REF TO cx_send_req_bcs, " E-Mail sending Exception
v_addr_exception TYPE REF TO cx_address_bcs. " Address Exception
DATA : v_result TYPE sy-binpt,
v_message TYPE string,
v_sub TYPE so_obj_des,
v_rec TYPE ad_smtpadr.
TRY.
v_send_request = cl_bcs=>create_persistent( ).
v_send_request->set_status_attributes( i_requested_status = 'E' ).
* Creating Document
IF t_body IS NOT INITIAL.
v_sub = 'Email using Sstandard text editor as mail body'.
v_document = cl_document_bcs=>create_document(
i_type
= 'RAW'
i_importance = '5'
i_text
= t_body
i_subject = v_sub ).
ENDIF.
* Add document to send request
CALL METHOD v_send_request->set_document( v_document ).
* Get Sender Object
CALL METHOD v_send_request->set_sender
EXPORTING
i_sender = v_sender.
* E-Mail l_recipient
v_rec = Any email address which you need to sent.
v_recipient = cl_cam_address_bcs=>create_internet_address( v_rec ).
CALL METHOD v_send_request->add_recipient
EXPORTING
i_recipient = v_recipient
i_express = ''
i_copy
=''
i_blind_copy = ' '
i_no_forward = ' '.
For better understanding of the mail program you can find the article in the SDN with the name Step by Step Process of preparing E-mail with
HTML body and HTML attachment. This will give you a clear understanding about the Email logic used.
Thanks,
Sri Hari