2019 Aug 20 8:33 AM
Hello Experts!
I have read many posts on GPG encryption and I am not able to find the exact solution, hence raising a new thread.
Requirement: We have multiple files on AL11 directory we need to encrypt them and move the encrypted files to different folder (later to be consumed by third party).
What I have tried so far: I tried creating SM69 events with OS command as 'gpg', parameters of OS command '-e', additional parameters '-r <userid> <AL11 path of file>' - It is giving me error no public key.
Question 1: Where should I pass public key, with which command?
We have received public key which is around 1600 long characters and the FM 'SXPG_EXECUTE_COMMAND' additional parameters is only 255 characters.
Question 2: How to accommodate this along with file path?
Even I tried below code:
CALL 'SYSTEM' ID 'COMMAND' FIELD lv_cmd ID 'TAB' lt_tab[].
Where lv_cmd contains public key too alongwith AL11 path, But I am getting sy-subrc = 1, and lt_tab[] is empty.
FYI: GPG is installed @OS level.
Request you to guide me on correct path. I think I am very close to solution but very far too 😞
Any hint/help would be appreciated.
Regards
Virendra Kedia
2019 Aug 20 7:44 PM
Why do you have to do this in SAP? It seems like an independent process that could be done at the OS level, outside of SAP ERP.
As an alternative, instead of calling GPG (exe?) you could create a BAT file, assuming the key is not something dynamically generated from SAP.
2019 Aug 20 8:34 PM
Hi,
Just suggesting , download your file to location and encrypt it using bat file. This BAT file can call using SAP. You have to call BAT file in same download program.Execute bat file using below BAPI. In the bat file execute your exe file or encrypt software.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
EXPORTING
* DOCUMENT = "'C:\test\encrypt.bat'
APPLICATION = 'C:\test\encrypt.bat'
PARAMETER = ''
DEFAULT_DIRECTORY = ''
MAXIMIZED = ' '
MINIMIZED = 'X' "If you need the DOS window to be minimized
EXCEPTIONS
CNTL_ERROR = 1
ERROR_NO_GUI = 2
BAD_PARAMETER = 3
FILE_NOT_FOUND = 4
PATH_NOT_FOUND = 5
FILE_EXTENSION_UNKNOWN = 6
ERROR_EXECUTE_FAILED = 7
OTHERS = 8.
2019 Aug 21 8:06 AM
Undoubtedly, you should try GPG via Linux command line, and when OK, you will try to use SXPG_EXECUTE_COMMAND. Did you import the public key? It's nicely explained here for example: https://yanhan.github.io/posts/2017-09-27-how-to-use-gpg-to-encrypt-stuff.html?source=post_page-----...
2021 Jun 10 8:00 PM
Hi @virendra.kedia,
I have the similar requirement as your, Can you share me the solution information wich you have resolved the above requirment.
Thanks,
Suunil
2021 Jun 11 4:44 AM
Hello Sunil,
For this case we are uploading normal files in AL11 and then basis is encrypting it using some batch files with OS commands.
2021 Jun 11 11:42 AM
Hi virendra.kedia
Thank for the inforamtion,
It will be very helpful if you Can share the information how they are doing it OS command . you can share me through email sunilroys@gmail.com.
Thanks,
Suunil
2021 Jun 14 5:32 PM
Hello Sunil,
For this case we are uploading normal files in AL11 and then basis is encrypting it using some batch files with OS commands.