‎2010 Sep 01 5:42 PM
Hi Experts
I using the FM SO_NEW_DOCUMENT_SEND_API1 to send mail to the managers regarding his subordinates time sheets.
I have concatenated different variables in to work area of object_content by keeping 'Concatenate respecting Blanks'.
So I am getting blanks also perfectly formatted.
In this way I am filling the internal table object_content successfully, with all the required spaces necessary.
In debugging I can see that the table object_content is perfectly formatted.
But in the mail the format is missing, There I am getting unbelievable gaps, depending upon the data I am inserting into
the table Object_Content.
I have supplied the Document Size also perfectly in the Object_Header.
Is there any thing more to do to achieve correct formating, (ie As it is was in the table object_content)
Thanks and Regards
Avinash
‎2010 Sep 01 7:19 PM
Use HTML and table tags, not to mention class CL_BCS if you have it available.
‎2010 Sep 02 1:22 PM
Hi Brad
I didn't exactly got what you are saying. Can you please elaborate.
Thanks and Regards
Avinash
‎2010 Sep 02 1:54 PM
Use HTML to format your email body instead of plain text with spaces. HTML tables are a far easier and more precise way to format text positioning, not to mention the other options you have with design elements to make your emails user friendly and professional looking.
If you are on NW 6.0 or higher, stop using the email function and start using the CL_BCS class.
‎2010 Sep 02 3:16 PM
Now I have used the CL_BCS Class also, But the same issue is coming.
I have populated all my data in to text of the example BCS_EXAMPLE_4.
and used the same code as it was in BCS_EXAMPLE_4 (to mail a sapuser).
But still the problem is existing.
‎2010 Sep 02 3:20 PM
‎2010 Sep 02 3:23 PM
Use the following method to get rid of the error:
Convert the text string into UTF-16LE binary data including
byte-order-mark. Mircosoft Excel prefers these settings
all this is done by new class cl_bcs_convert (see note 1151257)
TRY.
cl_bcs_convert=>string_to_solix(
EXPORTING
iv_string = lv_string
iv_codepage = '4103' "suitable for MS Excel, leave empty for other doc types
iv_add_bom = 'X'
IMPORTING
et_solix = binary_content
ev_size = size ).
CATCH cx_bcs.
ENDTRY.
You can refer to the program BCS_EXAMPLE_7 for more info.
‎2010 Sep 02 3:24 PM
Can You tell me how to use HTML? Can you give me any sample program or like to go with HTML.
‎2010 Sep 02 3:26 PM
Hi,
CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'
EXPORTING
document_data = doc_chng
document_type = 'HTM'
And use normal html Tags for formatting.(Space, bold.....)
‎2010 Sep 02 3:43 PM
Can You tell me how to use HTML? Can you give me any sample program or like to go with HTML.
Sorry, this is not a training site for basics. Any examples that I have are macro-based for re-usability and would probably not make sense to you. A good developer should be familiar with HTML - there are many sites on the internet that have tutorials. For tables, focus on the <table>, <tr>, and <td> tags. Maybe Thomas or someone else has blogged about it...search SDN as well.
‎2010 Sep 02 4:41 PM
I have Tried The HTML Tags also.
In debugging I can see the text table filled with blanks if data is not there in a concatenated variable
and then I have used span style="padding-left:20px to put space between two columns.
In debugging it is all fine and while mail comes it is deleting the empty spaces of the concatenated variable.
‎2010 Sep 02 5:02 PM
Your HTML and formatting is probably wrong then, but without posting any code, no one is going to be able to tell you the issue...
‎2010 Sep 03 12:35 PM
CONCATENATE: '<P>'
wa_managers_copy-pernr
'<span style="padding-left:20px">'
wa_managers_copy-pernr_name
'<span style="padding-left:20px">'
wa_managers_copy-pernr_kostl
'<span style="padding-left:20px">'
wa_catsdb-workdate
'<span style="padding-left:20px">'
string
'<P>'
INTO wa_object_content-line
SEPARATED BY space
RESPECTING BLANKS.
APPEND: wa_object_content TO it_object_content[].
APPEND: wa_object_content TO text.
w_cr_lf = cl_abap_char_utilities=>cr_lf.
LOOP AT text INTO wa_text.
CONCATENATE w_data wa_text w_cr_lf INTO w_data.
CLEAR wa_text.
ENDLOOP.
w_size = '5000'.
TRY.
cl_bcs_convert=>string_to_solix(
EXPORTING
iv_string = w_data
iv_codepage = ''
iv_add_bom = '' "for other doc types
IMPORTING
et_solix = it_bin_data
ev_size = w_size ).
CATCH cx_bcs.
* p_fail = 'X'.
ENDTRY.
TRY.
send_request = cl_bcs=>create_persistent( ).
document = cl_document_bcs=>create_document(
i_type = 'HTM'
* i_text = text
i_hex = it_bin_data
i_length = '5000'
i_subject = 'test created by BCS_EXAMPLE_3' ).
CALL METHOD send_request->set_document( document ).
sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD send_request->set_sender
EXPORTING
i_sender = sender.
recipient = cl_sapuser_bcs=>create( i_user = 'MNGR02' ).
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
CALL METHOD send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = sent_to_all ).
IF sent_to_all = 'X'.
WRITE text-003.
ENDIF.
COMMIT WORK.
‎2010 Sep 03 12:36 PM
The above is the Code I have written.
I have Tried with Binary Data Also using HTML Tags Correctly.
Please let me know if there is any problem in the Code Written.
I couls not able to understand the issue.
When I Trigger the same mail to internet address, that is Receiver type 'U' , It is going with correct format.
But here I am sending mail to SAPUSER, So here I am getting problem in the format.
Will the Tcode SBWP will show the data like that only or will there be any furthur things to be followed to send a mail
to SAPUSER.
Thanks and Regards
Avinash