Professional Documents
Culture Documents
Community
Janagar Sundaramoorthy
February 25, 2016
| 16 minute read
Original requirement:
Requirement is to retrieve the all the files attached in Content repository though GOS for a
particular document and pull formatted text from SO10 and attach those attachments
retrieved from Archiving and send it as a HTML mail , but before sending mail the client can
modify the content , add the receivers whoever needs the mail and also they can able to edit
the attachments (ie., delete or add whichever they need) .
Recently we had a requirement , where the client wants to edit the content of the mail being
sent and modify the attachments as they need on the go and send that mail in HTML mail
format.
1. How to retrieve the contents from Archieve server(ie., Sharepoint /SAP content repository)?
2. How to enable the user to edit the attachments and edit the body of the mail on the go?
https://blogs.sap.com/2016/02/25/how-to-read-content-repository-attachments-and-convert-mail-sent-from-clbcsshortmessage-to-html-message-… 1/11
1/11/22, 8:25 AM How to read content repository attachments and convert mail sent from cl_bcs=>short_message to HTML message along wit…
3. The last challenge is emerged from the solution given from the step 2 (No other go we found
in the short time , may be you viewers should able to provide it).
Despite of these challenges we faced some other issues , that i’ll be explain as and when we
move through the blog.
Detailed steps:
There are many blogs which says how to retrieve the normal attachments from GOS. But there
are only one or two blog which i found for retriving the archieved document(Stored in
Sharepoint (Via Gimmal setup) / SAP content repository.
The above code helps in retrieving the all the document details attached to GOS ( attachments
through store business document) 3. How to Read the description of the Archived
attachment:Normally for Archive objects , we wont be able to track the actual name of the
object and to enable this specific note 1451769 has to be implemented.It has to be queried
from the table TOAAT table by passing the ARC_DOC_ID obtained from LIT_CONNECTION
Table.
https://blogs.sap.com/2016/02/25/how-to-read-content-repository-attachments-and-convert-mail-sent-from-clbcsshortmessage-to-html-message-… 2/11
1/11/22, 8:25 AM How to read content repository attachments and convert mail sent from cl_bcs=>short_message to HTML message along wit…
4.To read the individual attachment and move to Dynamic screen where the user can
able to edit the attachements and edit the body of the mail:
https://blogs.sap.com/2016/02/25/how-to-read-content-repository-attachments-and-convert-mail-sent-from-clbcsshortmessage-to-html-message-… 3/11
1/11/22, 8:25 AM How to read content repository attachments and convert mail sent from cl_bcs=>short_message to HTML message along wit…
38. ***end of change done by Janagar (for file name Note: 1451769)
39. DESCRIBE TABLE lit_bdata LINES lv_len .
40. lv_len = lv_len * 2 * 255.
41. lv_len1 = lv_len.
42. lref_document = cl_document_bcs=>create_document(
43. i_type = lc_a_type “lc_i_type “ changed by janagar
44. ****added by janagar
45. i_length = lv_len1
46. i_hex = lit_bdata[]
47. ****end of addition by janagar
48. i_subject = lv_att ).
49. APPEND lref_document TO lit_attachments.
50. ENDIF.
51. ENDIF.
52. ENDLOOP.
53. UNASSIGN <lfs_connections>.
54. CALL METHOD lref_send_request->set_document( lref_document ).
55. ENDIF.
56. IF i_link = abap_true.
57. lwa_object = i_object.
58. ENDIF.
59. * Sender infor
60. lref_sender = cl_cam_address_bcs=>create_internet_address(
61. i_sender ).
62. lref_send_request->set_sender( lref_sender ).
63. IF i_t_emails[] IS NOT INITIAL.
64. LOOP AT i_t_emails ASSIGNING <lfs_emails>.
65. IF <lfs_emails> IS ASSIGNED.
66. lv_mail = <lfs_emails>-smtp_addr.
67. lref_rec = cl_cam_address_bcs=>create_internet_address( lv_mail ).
68. lwa_recipients-recipient = lref_rec.
69. APPEND lwa_recipients TO lit_recipients.
70. ENDIF.
71. ENDLOOP.
72. UNASSIGN <lfs_emails>.
73. ENDIF.
74. lref_send_request = cl_bcs=>short_message(
75. i_subject = i_subject
76. i_text = i_t_note
77. i_recipients = lit_recipients
78. i_sender = lref_sender
79. i_attachments = lit_attachments
https://blogs.sap.com/2016/02/25/how-to-read-content-repository-attachments-and-convert-mail-sent-from-clbcsshortmessage-to-html-message-… 4/11
1/11/22, 8:25 AM How to read content repository attachments and convert mail sent from cl_bcs=>short_message to HTML message along wit…
I_T_NOTE is been populated by retriveing the text dynamically from the Standard text and
replace the variables in the standard text by usingTEXT_SYMBOL_REPLACE function module.
Now we have done everything we want and now the main challenge here is how to read the
modified content and attachment done by the user.
I have debugged and managed to get the enhancement place , where i can get the attachments
dynamically.When we call the short message there will a FM called SO_DYNP_OBJECT_SEND ,
this will enable the popup to populate the values and edit the attachments dynamically and
also convert the Text contents to HTML contents. The original popup out of this code will be
like below
https://blogs.sap.com/2016/02/25/how-to-read-content-repository-attachments-and-convert-mail-sent-from-clbcsshortmessage-to-html-message-… 5/11
1/11/22, 8:25 AM How to read content repository attachments and convert mail sent from cl_bcs=>short_message to HTML message along wit…
Now the attachments here are visible as BIN because if i keep it as JPG , when the user double
clicks on the attachments it gives the error and now in binary mode if the user prompts save it
to JPG as in our case it is only JPG attached to the GOS content repository.
For converting the above contents to html the following enhancement has to be created. create
an implicit enhancement at the end of SO_DYNP_OBJECT_SEND function module and
following steps has to be followed.
a) Convert the text format internally , OBJCONT has the body of the text container.
https://blogs.sap.com/2016/02/25/how-to-read-content-repository-attachments-and-convert-mail-sent-from-clbcsshortmessage-to-html-message-… 6/11
1/11/22, 8:25 AM How to read content repository attachments and convert mail sent from cl_bcs=>short_message to HTML message along wit…
4. ENDLOOP.
5. * Add Font and html tag at the start of the code
6. objcont-LINE = ‘<html><body> <basefont face=”Arial” size=”2″>’.
7. INSERT objcont INTO objcont INDEX 1.
8. *Add the image or company logo at the end of end of the mail , just add the
following Tag
9. * Add Image
10. cl_mime_repository_api=>get_api( )->get(
11. EXPORTING i_url = `/SAP/PUBLIC/xxx.jpg`
12. IMPORTING e_content = lv_current ).
13. ****
14. Add end tag to HTML.
15. objcont-LINE = ‘</body></html>’.
16. APPEND objcont.
https://blogs.sap.com/2016/02/25/how-to-read-content-repository-attachments-and-convert-mail-sent-from-clbcsshortmessage-to-html-message-… 7/11
1/11/22, 8:25 AM How to read content repository attachments and convert mail sent from cl_bcs=>short_message to HTML message along wit…
https://blogs.sap.com/2016/02/25/how-to-read-content-repository-attachments-and-convert-mail-sent-from-clbcsshortmessage-to-html-message-… 8/11
1/11/22, 8:25 AM How to read content repository attachments and convert mail sent from cl_bcs=>short_message to HTML message along wit…
Alert Moderator
Assigned Tags
Thanks for going through the blog and provide your feedback or suggestions below as this is
ABAP Extensibility my first blog.
cl bcs
gos
htm mail
https://blogs.sap.com/2016/02/25/how-to-read-content-repository-attachments-and-convert-mail-sent-from-clbcsshortmessage-to-html-message-… 9/11
1/11/22, 8:25 AM How to read content repository attachments and convert mail sent from cl_bcs=>short_message to HTML message along wit…
Store PDF into the IXOS ,Saperion and other Archiving systems and mass print as spool in backend
By
Vijaya Chintarlapalli Feb 01, 2016
Related Questions
GOS Attachment Print/E-mail/Fax Document
By
Rahul Kamble Jun 08, 2009
SO_DOCUMENT_SEND_API1
By
Former Member Oct 03, 2007
Coffee Corner
Join the new Coffee Corner Discussion Group.
https://blogs.sap.com/2016/02/25/how-to-read-content-repository-attachments-and-convert-mail-sent-from-clbcsshortmessage-to-html-messag… 10/11
1/11/22, 8:25 AM How to read content repository attachments and convert mail sent from cl_bcs=>short_message to HTML message along wit…
Find us on
Newsletter Support
https://blogs.sap.com/2016/02/25/how-to-read-content-repository-attachments-and-convert-mail-sent-from-clbcsshortmessage-to-html-messag… 11/11