Skip to Content

Objective


    • Password Store in ‘Y’ Table for the Respective User in Encrypted format .
    • To Export Excel Sheet with Password Protected(i.e. Decrypted format) both Cell and Worksheet.

  • Upload some User ID’s and it’s respective Password into Custom “Y” table.

S1.png

Screen Shot # 0

/wp-content/uploads/2013/08/s1_1_265408.png

Screen Shot # 1

User Name               : SMRUTI

Encrypted Password: QUJBUEA0MA==

Decrypted Password: ABAP@40

  • In your Custom Upload Program use below code for Encryption of Password , Which will store in above ‘Y’ Table.
    • Using CALL METHOD CL_HTTP_UTILITY=>IF_HTTP_UTILITY~ENCODE_BASE64 Encrypt the password text


/wp-content/uploads/2013/08/s2_265412.png

Screen Shot # 2

Note:

PASSWORD    : ABAP@40            ( Decrypted Password )

PASSWORD1  : QUJBUEA0MA== (Encrypted Password )

  • Now OLE ABAP Code using OLE2_OBJECT.

/wp-content/uploads/2013/08/s3_265414.png

Screen Shot # 3

/wp-content/uploads/2013/08/s4_265415.png

Screen Shot # 4

/wp-content/uploads/2013/08/s5_265416.png

Screen Shot # 5

Create Object for Excel using EXCEL.APPLICATION .

/wp-content/uploads/2013/08/s6_265417.png

Screen Shot # 6

/wp-content/uploads/2013/08/s7_265418.png

Screen Shot # 7

/wp-content/uploads/2013/08/s8_265419.png

Screen Shot # 8

S9.png

Screen Shot # 9

Using  CALL METHOD CL_GUI_FRONTEND_SERVICES=>CLIPBOARD_EXPORT to Clipboard.

S10.png

Screen Shot # 10

Using  CALL METHOD CL_HTTP_UTILITY=>IF_HTTP_UTILITY~DECODE_BASE64 decrypt the encrypted text (i.e. password) .

/wp-content/uploads/2013/08/s11_265422.png

Screen Shot # 11

  • Now Output

         Enter your Excel File Name with Path and User Name as a below Screen Shot.

        

        Note: If User Name in Lower Case then Click on Check box


/wp-content/uploads/2013/08/s12_265423.png

Screen Shot #12

After pressing Execute button or F8 Key you got Exported data( i.e. Password Protected ) in Excel Sheet , look as below Screen Shot .

/wp-content/uploads/2013/08/s13_265424.png

Screen Shot # 13

Now Check is your Worksheet, if you want to edit the Cell in work sheet then one password pop window show to ask for password Check below Screen Shot.

Here I want to edit the Division as Per below Screen Shot , then you see one Password Pop-up window appear for asking password , Until Correct Password you unable to edit the data

/wp-content/uploads/2013/08/s14_265425.png

Screen Shot # 14

Now I am try to enter wrong password see below screen shot.


/wp-content/uploads/2013/08/s15_265426.png

Screen Shot # 15


Reason of this below OLE ABAP Code line number 131 to 136 .

/wp-content/uploads/2013/08/s16_265427.png

Screen Shot # 16

Then I Enter Correct Password now Check below screen shot and now I am able to edit only where already data are available, mean within Range (i.e. A1:D11)


/wp-content/uploads/2013/08/s17_265428.png

Screen Shot # 17

Suppose you want add One row in Exported Excel Sheet that also protected by Password, Check below Screen Shot.

/wp-content/uploads/2013/08/s18_265429.png

Screen Shot # 18

Now you Un-Protect the Sheet using Un-protect Sheet in Review (i.e. here I using MS-Excel 2010)

/wp-content/uploads/2013/08/s19_265433.png

Screen Shot # 19

After pressing above Unprotected Sheet icon, then you pass password for Unprotected the Sheet.

S20.png

Screen Shot # 20

Reason of below OLE ABAP Code , Call below method “PROTECT” for Password

S21.png

Screen Shot # 21

S22.png

Screen Shot # 22

Note : Here i am using both Cell and Worksheet using one Password (i.e. fetch Encrypted Password from “Y” Table then Decrypt before assign to Excel Sheet ), you can take different password as per your requirement .

Source Code Available in Wiki link SAP Community Network Wiki – Code Gallery – ABAP – OLE2 Code with Dynamic Password Protected usin…

Regard’s

Smruti



To report this post you need to login first.

12 Comments

You must be Logged on to comment or reply to a post.

    1. Venkata Giridhar Post author

      Thanks Ramesh ,

      The Main difference is Password Concept , which is hard coded in wiki , but here i using dynamic password (i.e. fetching from custom table )with Encrypt and Decrypt functionality .

      (0) 
  1. John K

    Hi,

    Nice Work. But my humble advise is paste the code as well as screen shot then only we came to see the code clearly or else attach the code document at the end of the post. If you have time do this.

    Regards,

    John.

    (0) 
  2. Ashok Sahu

    Hi Smruti,

    I have a requirement where I have to send an excel as an attachment in an email and the attachment should be password protected. Please let me know how to do this.

    Thanks,

    Ashok Sahu

    (0) 

Leave a Reply