01-07-2015 4:27 PM
Hello Experts ,
I want to send a table in the mail Body. Number of rows in the table will be dynamic. Please suggest which Function module i should use to achieve this.
Here in the below case, number of entries are dynamic. Is it possible to achieve through some function module. WOrk flow are not configured in system.
Example :
Dear <Dynamical text >,
Below are the payment details.
XXXXXX | XXXX | XXXX | XXXXXX | XXXXXXX | XXXXX | XXXXXX | Amount |
100 | |||||||
100 | |||||||
100 | |||||||
100 | |||||||
100 | |||||||
100 | |||||||
100 | |||||||
100 | |||||||
Total Cost |
|
|
|
|
|
| 800 |
BR,
Nikhil Kulkarni
01-07-2015 4:53 PM
Hi, yes, you can do it with html tags like this:
//...Firsts lines before the loop at table into workarea....
<table style="width:100%">
<tr>
<td>field1</td>
<td>field2</td>
<td>field3</td>
</tr>
LOOP AT table INTO workarea.
<tr>
<td>workarea-value1</td>
<td>workarea-value2</td>
<td>workarea-value3</td>
</tr>
ENDLOOP.
//....TOTALS CALCULATED CODE....
<tr>
<td>TOTAL COST</td>
<td>Value2</td>
<td>Value3</td>
</tr>
</table>
FUNCTION TO USE SO_NEW_DOCUMENT_SEND_API1
with rec_type = 'U' if is a list of address or 'C' for a distribution list in structure receivers
Regards,
Alberto
01-07-2015 5:39 PM
Hello Alberto,
Thanks alot for quick response. Can you provide some sample code. I am little confused with this. Please provide min parameters which i need to pass to USE SO_NEW_DOCUMENT_SEND_API1 function module. Thanks very much once again.
BR,
Nikhil Kulkarni
01-07-2015 4:54 PM
01-07-2015 5:42 PM
01-07-2015 7:48 PM
hi nikhil,
you can create dynamic tables as below code.
TYPE-POOLS: slis.
FIELD-SYMBOLS: <t_dyntable> TYPE STANDARD TABLE, “ Dynamic internal table name
<fs_dyntable>, “ Field symbol to create work area
<fs_fldval> type any. “ Field symbol to assign values
PARAMETERS: p_cols(5) TYPE c. “ Input number of columns
DATA: t_newtable TYPE REF TO data,
t_newline TYPE REF TO data,
t_fldcat TYPE slis_t_fldcat_alv,
t_fldcat TYPE lvc_t_fcat,
wa_it_fldcat TYPE lvc_s_fcat,
wa_colno(2) TYPE n,
wa_flname(5) TYPE c.
* Create fields .
DO p_cols TIMES.
CLEAR wa_it_fldcat.
move sy-index to wa_colno.
concatenate 'COL'
wa_colno
into wa_flname.
wa_it_fldcat-fieldname = wa_flname.
wa_it_fldcat-datatype = 'CHAR'.
wa_it_fldcat-intlen = 10.
APPEND wa_it_fldcat TO t_fldcat.
ENDDO.
* Create dynamic internal table and assign to FS
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
it_fieldcatalog = t_fldcat
IMPORTING
ep_table = t_newtable.
ASSIGN t_newtable->* TO <t_dyntable>.
* Create dynamic work area and assign to FS
CREATE DATA t_newline LIKE LINE OF <t_dyntable>.
ASSIGN t_newline->* TO <fs_dyntable>.
you can do mail sending process using HTML tags.Using cl_bcs .
please refer below document.
Thanks,
Marimuthu.K