07-30-2009 1:20 PM
Dear All,
We have a requirement in which we need to send an excel sheet as an attachment( internal table to excel ) as readonly.
Sending and internal Table as excel sheet is done and making it as an attchment in a mail has been accomplished.
Now our requirement is to make the attched excel sheet read only(i.e the users getting the mails should not be in aposition to edit any cells of the worksheet.
The mail can be sent from any user. Please help.
Thanks in advance,
Regards,
Sai.
07-30-2009 1:56 PM
Hi,
You could use protection on the whole worksheet.
In Excel
Tools
Protection
Protect WorkSheet
or
There is another option,
With this function module you can make file non-transferrable, you can't make it read only with this function module.
Pass RECEIVERS-NO_FORWARD = 'X' in SO_NEW_DOCUMENT_ATT_SEND_API1 function module.
with regards,
Mamta Kumari
07-30-2009 2:10 PM
Thanks for the response.
The first option is user specific so We cannot set these properties for each and every user using our program.
And the second option is not working
Please help.
07-30-2009 2:51 PM
08-12-2009 11:04 AM
Dear Mamta,
I have tried this but in vain.
Please can you suggest something else.
Thank you
Sai
07-31-2009 4:28 AM
Hi,
Refer to the following code:
lv_doc_data-priority = '1'.
Populate the subject/generic message attributes
lv_doc_data-obj_langu = sy-langu.
lv_doc_data-obj_name = 'SAPRPT'.
lv_doc_data-obj_descr = 'Find Inactive PU/DU '.
lv_doc_data-sensitivty = 'F'.
lv_doc_data-NO_CHANGE = 'X'.
whan the parameter NO_CHANGE is set to 'X'. that means document cannot be changed.
now call the FM.
CALL FUNCTION 'SO_DOCUMENT_SEND_API1'
EXPORTING
document_data = lv_doc_data
sender_address = lv_sender_address
sender_address_type = lv_sender_address_type
commit_work = 'X'
TABLES
packing_list = it_packing_list
contents_txt = it_messages
receivers = it_receivers.
Revert back in any query. hope it helps.
Regards,
Rajesh Kumar
08-12-2009 10:55 AM
Dear Rajesh,
No_change is not working. Please can you suggest anything else.
Thank you,
Sai
08-12-2009 11:28 AM
Dear All,
Let me more clear on my requirement. I have to send some data from an abap program in an excel sheet to receivers mail id.
Thsi data should not to be changed by The receiver.
I am writing the code as below. Can anybody suggest how to make the excel sheet non editable..?
REPORT ZSTST_MAIL12.
DATA: send_request TYPE REF TO cl_bcs.
DATA: text TYPE bcsy_text.
DATA: att_text TYPE bcsy_text.
DATA: document TYPE REF TO cl_document_bcs.
DATA: sender TYPE REF TO cl_sapuser_bcs.
DATA: recipient TYPE REF TO if_recipient_bcs.
DATA: bcs_exception type ref to cx_bcs.
data: sent_to_all type os_boolean.
CONSTANTS: CON_TAB TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB,
CON_CRET TYPE C VALUE CL_ABAP_CHAR_UTILITIES=>CR_LF.
try.
* -------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
* -------- create and set document with attachment ---------------
* create document from internal table with text
APPEND 'Hello world!' TO text.
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = 'test created by BCS_EXAMPLE_2' ).
* add attachment to document
REFRESH text.
APPEND 'This is an attachment' TO text.
CALL METHOD document->add_attachment
EXPORTING i_attachment_type = 'XLS'
i_attachment_subject = 'My attachment'
i_attachment_size = '21'
i_att_content_text = text.
* add document to send request
CALL METHOD send_request->set_document( document ).
* --------- set sender -------------------------------------------
* note: this is necessary only if you want to set the sender
* different from actual user (SY-UNAME). Otherwise sender is
* set automatically with actual user.
sender = cl_sapuser_bcs=>create( SY-UNAME ).
CALL METHOD send_request->set_sender
EXPORTING i_sender = sender.
* --------- add recipient (fax) -----------------------
* create recipient - please replace fax number !!!
recipient = cl_cam_address_bcs=>CREATE_INTERNET_ADDRESS(
I_ADDRESS_STRING = 'emailid').
send_request->SET_SEND_IMMEDIATELY('X').
* add recipient with its respective attributes to send request
CALL METHOD send_request->add_recipient
EXPORTING
i_recipient = recipient
i_express = 'X'.
* ---------- send document ---------------------------------------
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.
* -----------------------------------------------------------
* * exception handling
* -----------------------------------------------------------
* * replace this very rudimentary exception handling
* * with your own one !!!
* -----------------------------------------------------------
catch cx_bcs into bcs_exception.
write: 'Fehler aufgetreten.'(001).
write: 'Fehlertyp:'(002), bcs_exception->error_type.
exit.
endtry.
Thanks and regards
Sai
08-12-2009 12:47 PM
Hi,
Am not sure if we can control excel settings from SAP to make it READ ONLY. Though you can try using PROTECT workbook wherein in u can define a password to open it. You can protect the excel work book using the method PROTECT of OLE objects. Check this link for scotts reply for a sample code on using the PROTECT method.
Regards,
Vik
08-22-2016 10:43 AM
02-01-2010 11:00 AM