2009 Dec 17 4:48 AM
He Friends ,
I am sending some data in excel sheet as a attachemnt by Email , It is working fine , Now the requirement is that I have to protect some cells of this excel sheet . Please advise How can I do It.
I am using the following code for generating excel sheet.
Regards
SS
constants:
con_tab type c value cl_abap_char_utilities=>horizontal_tab,
con_cret type c value cl_abap_char_utilities=>cr_lf.
---appending heading to Internal table of Email
it_objbin = w_longtext.
append it_objbin. clear it_objbin.
loop at it_mail where lifnr = wa_mail-lifnr.
concatenate 'S.No.' 'PARTICULARS'
'DATA AVAILABLE AS PER OUR SYSTEM '
'KINDLY MENTION, IF ANY CHANGE' into it_objbin
separated by con_tab.
append it_objbin.
clear it_objbin.
do 27 times. " no fields in internal table
assign component sy-index of structure it_mail to <field>.
if sy-subrc <> 0.
exit.
endif.
Look for Commas in the field value. If it exists, put quotes around
value so that the file opens correctly with all the columns aligned
in Excel.
search <field> for ',' in character mode.
If search for commas are successful.
if sy-subrc = 0.
concatenate '"' <field> '"' into <field> in character mode.
endif.
if sy-index = 1.
i_dload-dload = <field>.
shift: i_dload-dload left deleting leading space.
else.
Put Comma as a separator for values in IT_DLOAD internal table
shift: i_dload-dload left deleting leading space.
CONCATENATE i_dload-dload <field> INTO i_dload-dload
SEPARATED BY ',' IN CHARACTER MODE.
endif.
data sno type string.
data st_n type string.
st_n = " ".
sno = sy-index.
if sy-index = 1.
st_n = 'Vendor Code '.
endif.
if sy-index = 2.
st_n = 'Name '.
endif.
if sy-index = 3.
st_n = 'Street '.
endif.
if sy-index = 4 .
st_n = 'Street '.
endif.
if sy-index = 5.
st_n = 'Street 4 '.
endif.
if sy-index = 6.
st_n = 'City '.
endif.
if sy-index = 7 .
st_n = 'Postal Code '.
endif.
if sy-index = 8 .
st_n = 'Telephone '.
endif.
if sy-index = 9 .
st_n = 'Mobile No. '.
endif.
if sy-index = 10 .
st_n = 'Fax No. '.
endif.
if sy-index = 11 .
st_n = 'E-Mail Address '.
endif.
if sy-index = 12 .
st_n = 'Contact Person '.
endif.
if sy-index = 13 .
st_n = 'Region Code '.
endif.
if sy-index = 14 .
st_n = 'Region Name '.
endif.
if sy-index = 15 .
st_n = 'ECC No. '.
endif.
if sy-index = 16 .
st_n = 'Excise Registration No.'.
endif.
if sy-index = 17 .
st_n = 'Excise Range '.
endif.
if sy-index = 18 .
st_n = 'Excise Division '.
endif.
if sy-index = 19 .
st_n = 'Excise Commissionerate '.
endif.
if sy-index = 20 .
st_n = 'CST number '.
endif.
if sy-index = 21 .
st_n = 'LST number '.
endif.
if sy-index = 22 .
st_n = 'Permanent Account Number '.
endif.
if sy-index = 23 .
st_n = 'SME Status (Micro/Small/Medium)'.
endif.
if sy-index = 24 .
st_n = 'Bank No.(IFSC Code) '.
endif.
if sy-index = 25 .
st_n = 'Bank Account No. '.
endif.
if sy-index = 26 .
st_n = 'PAN Reference Number'.
endif.
if sy-index = 27 .
st_n = 'Service Tax Regn No.'.
endif.
concatenate sno st_n <field> into it_objbin
separated by con_tab.
it_objbin = <field>."i_dload-dload.
append it_objbin.
clear it_objbin.
if p_letter = 'X'.
concatenate sno st_n <field> into it_mail_data
separated by ','.
append it_mail_data.
clear it_mail_data.
endif.
enddo.
endloop.
He Friends ,
I am sending some data in excel sheet as a attachemnt by Email , It is working fine , Now the requirement is that I have to protect some cells of this excel sheet . Please advise How can I do It.
I am using the following code for generating excel sheet.
Regards
SS
constants:
con_tab type c value cl_abap_char_utilities=>horizontal_tab,
con_cret type c value cl_abap_char_utilities=>cr_lf.
---appending heading to Internal table of Email
it_objbin = w_longtext.
append it_objbin. clear it_objbin.
loop at it_mail where lifnr = wa_mail-lifnr.
concatenate 'S.No.' 'PARTICULARS'
'DATA AVAILABLE AS PER OUR SYSTEM '
'KINDLY MENTION, IF ANY CHANGE' into it_objbin
separated by con_tab.
append it_objbin.
clear it_objbin.
do 27 times. " no fields in internal table
assign component sy-index of structure it_mail to <field>.
if sy-subrc <> 0.
exit.
endif.
Look for Commas in the field value. If it exists, put quotes around
value so that the file opens correctly with all the columns aligned
in Excel.
search <field> for ',' in character mode.
If search for commas are successful.
if sy-subrc = 0.
concatenate '"' <field> '"' into <field> in character mode.
endif.
if sy-index = 1.
i_dload-dload = <field>.
shift: i_dload-dload left deleting leading space.
else.
Put Comma as a separator for values in IT_DLOAD internal table
shift: i_dload-dload left deleting leading space.
CONCATENATE i_dload-dload <field> INTO i_dload-dload
SEPARATED BY ',' IN CHARACTER MODE.
endif.
data sno type string.
data st_n type string.
st_n = " ".
sno = sy-index.
if sy-index = 1.
st_n = 'Vendor Code '.
endif.
if sy-index = 2.
st_n = 'Name '.
endif.
if sy-index = 3.
st_n = 'Street '.
endif.
if sy-index = 4 .
st_n = 'Street '.
endif.
if sy-index = 5.
st_n = 'Street 4 '.
endif.
if sy-index = 6.
st_n = 'City '.
endif.
if sy-index = 7 .
st_n = 'Postal Code '.
endif.
if sy-index = 8 .
st_n = 'Telephone '.
endif.
if sy-index = 9 .
st_n = 'Mobile No. '.
endif.
if sy-index = 10 .
st_n = 'Fax No. '.
endif.
if sy-index = 11 .
st_n = 'E-Mail Address '.
endif.
if sy-index = 12 .
st_n = 'Contact Person '.
endif.
if sy-index = 13 .
st_n = 'Region Code '.
endif.
if sy-index = 14 .
st_n = 'Region Name '.
endif.
if sy-index = 15 .
st_n = 'ECC No. '.
endif.
if sy-index = 16 .
st_n = 'Excise Registration No.'.
endif.
if sy-index = 17 .
st_n = 'Excise Range '.
endif.
if sy-index = 18 .
st_n = 'Excise Division '.
endif.
if sy-index = 19 .
st_n = 'Excise Commissionerate '.
endif.
if sy-index = 20 .
st_n = 'CST number '.
endif.
if sy-index = 21 .
st_n = 'LST number '.
endif.
if sy-index = 22 .
st_n = 'Permanent Account Number '.
endif.
if sy-index = 23 .
st_n = 'SME Status (Micro/Small/Medium)'.
endif.
if sy-index = 24 .
st_n = 'Bank No.(IFSC Code) '.
endif.
if sy-index = 25 .
st_n = 'Bank Account No. '.
endif.
if sy-index = 26 .
st_n = 'PAN Reference Number'.
endif.
if sy-index = 27 .
st_n = 'Service Tax Regn No.'.
endif.
concatenate sno st_n <field> into it_objbin
separated by con_tab.
it_objbin = <field>."i_dload-dload.
append it_objbin.
clear it_objbin.
if p_letter = 'X'.
concatenate sno st_n <field> into it_mail_data
separated by ','.
append it_mail_data.
clear it_mail_data.
endif.
enddo.
endloop.
2009 Dec 17 5:04 AM
2009 Dec 17 7:34 AM
Thanks for ur reply .
I have created the excel sheel by using cl_abap_char_utilities=>horizontal_tab as field seprator for this . Can I protect some cells of this excel sheet.
Regards
SS
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |