Hi Experts,
I have installed gpg4win-2.2.1 in my application server.and tested the gpg encryption commands in command prompt and it works ok.
I could be able to encrypt and decrypt ok using the pair keys(public&private+ passphrase) My text file located in the server's c drive.
Now I would like to execute this command via ABAP program to a file server location \\172.16.1.12\sapmnt\dataset\gpg\.
This were my steps:
First I created a ZENCRYPT command in tcode SM69. with the following settings :
- operating system windows NT
- Operating system command gpg
- Parameters for operating system command <blank>
- Additional Parameters allowed checkbox <selected>
Secondly,I created a z program with source code
REPORT zsxpg_command_encrypt.
DATA: l_exitcode TYPE btcxpgexit,
l_parms TYPE btcxpgpar,
l_status TYPE btcxpgstat,
pass1 TYPE string VALUE ' -r Administrator ',
pass2 TYPE string VALUE '-o "\\172.16.1.12\sapmnt\dataset\gpg\diary 2003-02.txt.gpg" ',
px_target2 TYPE string VALUE '-e "\\172.16.1.12\sapmnt\dataset\gpg\diary 2003-02.txt" ',
lt_protocol TYPE STANDARD TABLE OF btcxpm,
l_protocol TYPE btcxpm.
CONCATENATE pass1 pass2 px_target2 INTO l_parms SEPARATED BY space.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZPGP_ENCRYPT'
additional_parameters = l_parms
IMPORTING
status = l_status
exitcode = l_exitcode
TABLES
exec_protocol = lt_protocol
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
program_start_error = 6
program_termination_error = 7
x_error = 8
parameter_expected = 9
too_many_parameters = 10
illegal_command = 11
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry = 13
jobcount_generation_error = 14
OTHERS = 15.
IF sy-subrc NE 0OR l_status NE 'O' OR l_exitcode NE '0'.
* Failure
FORMAT COLOR COL_NEGATIVE.
WRITE: / 'Failed to Encrypt'.
FORMAT COLOR COL_NORMAL.
LOOP AT lt_protocol INTO l_protocol.
WRITE: / l_protocol-message+0(l_protocol-length).
ENDLOOP.
ELSE.
* Success
FORMAT COLOR COL_POSITIVE.
WRITE: / 'Successfully encrypt' .
ENDIF.
I Tried to check all forums if any one had succeeded in this but in vain.Can someone help me understand where am going wrong.
Thanks
Regds
Studentof Abap