2015 Jan 26 9:21 AM
Hi All,
I am building a email body but I need to have the details separated on each row.
Even if I append the details to the email body internal table, they still show on the same row.
Below is my code:
data : subject_text(50) type c,
w_subject TYPE so_obj_des,
w_bodyx TYPE tdline,
w_main_text TYPE bcsy_text,
c_body_text1(50) TYPE c,
c_body_text2(50) TYPE c,
c_body_text3(50) TYPE c,
c_body_text4(50) TYPE c,
L_error_CNT(4) TYPE c,
l_error_WARN(4) TYPE c.
DATA: lo_send_request TYPE REF TO cl_bcs,
lo_recipient TYPE REF TO if_recipient_bcs,
lo_document TYPE REF TO cl_document_bcs,
c_raw TYPE char3 VALUE 'RAW',
c_x TYPE c VALUE 'X',
w_sent_to_all TYPE os_boolean,
lo_bcs_exception TYPE REF TO cx_bcs.
subject_text = 'Code inspector error notification:'.
l_error_cnt = lr_ci_tests->tree->err_cnt.
l_error_WARN = lr_ci_tests->tree->warn_cnt.
* Picking up the Subject
CONCATENATE subject_text request INTO w_subject SEPARATED BY ''.
* Picking up the body
c_body_text1 = 'Total number of errors:'.
c_body_text2 = 'Total number of warnings:'.
c_body_text3 = 'Transport request details:'.
c_body_text4 = 'Task number:'.
data: ls_e070 type e070,
lv_req_descr type as4text.
select single * into ls_e070 from e070 where trkorr = request.
if ls_e070-strkorr is not initial.
select single AS4TEXT
into lv_req_descr
from E07T
where trkorr = ls_e070-strkorr.
endif.
CONCATENATE c_body_text3 ls_e070-strkorr lv_req_descr INTO W_bodyx SEPARATED BY ''.
APPEND W_bodyx TO w_main_text.
clear W_bodyx.
CONCATENATE c_body_text4 request INTO W_bodyx SEPARATED BY ''.
APPEND W_bodyx TO w_main_text.
CLEAR w_bodyx.
CONCATENATE c_body_text1 l_error_cnt INTO w_bodyx SEPARATED BY ''.
APPEND w_bodyx TO w_main_text.
CLEAR w_bodyx.
CONCATENATE c_body_text2 l_error_WARN INTO w_bodyx SEPARATED BY ''.
APPEND w_bodyx TO w_main_text.
Output shows as below:
Transport request details: PDSK900832 Testing 12 Task number: PDSK901697
Total number of errors: 5
Total number of warnings: 0
How it should look like:
Transport request details: PDSK900832 Testing 12
Task number: PDSK901697
Total number of errors: 5
Total number of warnings: 0
Any help is much appreciated.
Best regards,
Elena
2015 Jan 26 9:33 AM
Hi Elena,
Please try with below code .
CONCATENATE c_body_text3 ls_e070-strkorr lv_req_descr INTO W_bodyx SEPARATED BY ''.
CONCATENATE W_bodyx CL_ABAP_CHAR_UTILITIES=>NEWLINE INTO W_bodyx."-->add new line
APPEND W_bodyx TO w_main_text.
clear W_bodyx.
CONCATENATE c_body_text4 request INTO W_bodyx SEPARATED BY ''.
CONCATENATE W_bodyx CL_ABAP_CHAR_UTILITIES=>NEWLINE INTO W_bodyx.
APPEND W_bodyx TO w_main_text.
CLEAR w_bodyx.
CONCATENATE c_body_text1 l_error_cnt INTO w_bodyx SEPARATED BY ''.
CONCATENATE W_bodyx CL_ABAP_CHAR_UTILITIES=>NEWLINE INTO W_bodyx.
APPEND w_bodyx TO w_main_text.
CLEAR w_bodyx.
CONCATENATE c_body_text2 l_error_WARN INTO w_bodyx SEPARATED BY ''.
CONCATENATE W_bodyx CL_ABAP_CHAR_UTILITIES=>NEWLINE INTO W_bodyx.
APPEND w_bodyx TO w_main_text.
Thanks
Hi All,
I am building a email body but I need to have the details separated on each row.
Even if I append the details to the email body internal table, they still show on the same row.
Below is my code:
data : subject_text(50) type c,
w_subject TYPE so_obj_des,
w_bodyx TYPE tdline,
w_main_text TYPE bcsy_text,
c_body_text1(50) TYPE c,
c_body_text2(50) TYPE c,
c_body_text3(50) TYPE c,
c_body_text4(50) TYPE c,
L_error_CNT(4) TYPE c,
l_error_WARN(4) TYPE c.
DATA: lo_send_request TYPE REF TO cl_bcs,
lo_recipient TYPE REF TO if_recipient_bcs,
lo_document TYPE REF TO cl_document_bcs,
c_raw TYPE char3 VALUE 'RAW',
c_x TYPE c VALUE 'X',
w_sent_to_all TYPE os_boolean,
lo_bcs_exception TYPE REF TO cx_bcs.
subject_text = 'Code inspector error notification:'.
l_error_cnt = lr_ci_tests->tree->err_cnt.
l_error_WARN = lr_ci_tests->tree->warn_cnt.
* Picking up the Subject
CONCATENATE subject_text request INTO w_subject SEPARATED BY ''.
* Picking up the body
c_body_text1 = 'Total number of errors:'.
c_body_text2 = 'Total number of warnings:'.
c_body_text3 = 'Transport request details:'.
c_body_text4 = 'Task number:'.
data: ls_e070 type e070,
lv_req_descr type as4text.
select single * into ls_e070 from e070 where trkorr = request.
if ls_e070-strkorr is not initial.
select single AS4TEXT
into lv_req_descr
from E07T
where trkorr = ls_e070-strkorr.
endif.
CONCATENATE c_body_text3 ls_e070-strkorr lv_req_descr INTO W_bodyx SEPARATED BY ''.
APPEND W_bodyx TO w_main_text.
clear W_bodyx.
CONCATENATE c_body_text4 request INTO W_bodyx SEPARATED BY ''.
APPEND W_bodyx TO w_main_text.
CLEAR w_bodyx.
CONCATENATE c_body_text1 l_error_cnt INTO w_bodyx SEPARATED BY ''.
APPEND w_bodyx TO w_main_text.
CLEAR w_bodyx.
CONCATENATE c_body_text2 l_error_WARN INTO w_bodyx SEPARATED BY ''.
APPEND w_bodyx TO w_main_text.
Output shows as below:
Transport request details: PDSK900832 Testing 12 Task number: PDSK901697
Total number of errors: 5
Total number of warnings: 0
How it should look like:
Transport request details: PDSK900832 Testing 12
Task number: PDSK901697
Total number of errors: 5
Total number of warnings: 0
Any help is much appreciated.
Best regards,
Elena
2015 Jan 26 9:33 AM
Hi Elena,
Please try with below code .
CONCATENATE c_body_text3 ls_e070-strkorr lv_req_descr INTO W_bodyx SEPARATED BY ''.
CONCATENATE W_bodyx CL_ABAP_CHAR_UTILITIES=>NEWLINE INTO W_bodyx."-->add new line
APPEND W_bodyx TO w_main_text.
clear W_bodyx.
CONCATENATE c_body_text4 request INTO W_bodyx SEPARATED BY ''.
CONCATENATE W_bodyx CL_ABAP_CHAR_UTILITIES=>NEWLINE INTO W_bodyx.
APPEND W_bodyx TO w_main_text.
CLEAR w_bodyx.
CONCATENATE c_body_text1 l_error_cnt INTO w_bodyx SEPARATED BY ''.
CONCATENATE W_bodyx CL_ABAP_CHAR_UTILITIES=>NEWLINE INTO W_bodyx.
APPEND w_bodyx TO w_main_text.
CLEAR w_bodyx.
CONCATENATE c_body_text2 l_error_WARN INTO w_bodyx SEPARATED BY ''.
CONCATENATE W_bodyx CL_ABAP_CHAR_UTILITIES=>NEWLINE INTO W_bodyx.
APPEND w_bodyx TO w_main_text.
Thanks
2015 Jan 26 9:51 AM
It worked.
Thank you very much.
Have a wonderful day ahead!
Best regards,
Elena
2015 Jan 26 9:45 AM
Dear Elena,
Send the Email body with HTML format. It is very easy..
Sending a mail in HTML format with multiple images in the body of the mail
Thanks
Tharaka
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |