Application Development and Automation 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: 
Read only

cl_document_bcs=>create_document

Former Member
0 Likes
2,231

Hi All,

I am using create_document method to send email that comprises of listing internal table as email body. However since the data of internal table varies in length the formatting does not look good. Is there a way to achieve the output in a table format?

|Plant|Material |Description |Batch

|ABCD|MAT1 |Descritption1234 |BATCH1

|ABCD|MAT1 |Descritption1 |BATCH2

Thanks for you help.

1 ACCEPTED SOLUTION
Read only

MarcinPciak
Active Contributor
0 Likes
1,237

If you send the content as text, simply wrapp your data with html <table> tag. This way formating of columns can be controlled by means of tag attributes.

Regards

Marcin

3 REPLIES 3
Read only

MarcinPciak
Active Contributor
0 Likes
1,238

If you send the content as text, simply wrapp your data with html <table> tag. This way formating of columns can be controlled by means of tag attributes.

Regards

Marcin

Read only

0 Likes
1,237

Hello Marcin,

Thanks for your quick reply. I looked at the documenation but was not much of help.

Appreciate if you can copy a small example which can help me understand.

Thank you once again.

Read only

0 Likes
1,237

Some draft


data body type string.
data l_htmlext type soli_tab,

"create html format string
concatenate body '<html><body><table>' into body.

loop at itab1.
  "here add table content within rows (<tr>) and cells (<td>)
  concatenate body '<tr><td>' itab1-field1 '</td><td>' itab1-field2 '</td></tr>' into body.
endloop.
"close table
concatenate body '</table>' into body.

"here add your other tables
"...

"now close html format
concatenate body '</body></html>' into body.

"transfer to table type
call function 'SCMS_STRING_TO_FTEXT'
exporting text = body tables ftext_tab = l_htmltext.

"Set your document to accept html body 
document = cl_document_bcs=>create_document( i_type = 'HTM'
                                     i_text = l_htmltext  ... ).
                                     

Regards

Marcin