OPEN DATASET p_file FOR OUTPUT IN BINARY MODE.
IF sy-subrc = 0.
TRANSFER lv_xstring TO p_file.
CLOSE DATASET p_file.
ENDIF.
DATA: BEGIN OF command_list OCCURS 0.
INCLUDE STRUCTURE sxpgcolist.
DATA: END OF command_list .
DATA: status LIKE btcxp3-exitstat,
commandname LIKE sxpgcolist-name VALUE 'ZSD_ENCRYPT',
sel_no LIKE sy-tabix.
* GET LIST OF EXTERNAL COMMANDS
CALL FUNCTION 'SXPG_COMMAND_LIST_GET'
EXPORTING
commandname = commandname
operatingsystem = sy-opsys
TABLES
command_list = command_list
EXCEPTIONS
OTHERS = 1.
CALL FUNCTION 'SXPG_COMMAND_CHECK'
EXPORTING
commandname = command_list-name
operatingsystem = sy-opsys
EXCEPTIONS
no_permission = 1
command_not_found = 2
parameters_too_long = 3
security_risk = 4
wrong_check_call_interface = 5
x_error = 6
too_many_parameters = 7
parameter_expected = 8
illegal_command = 9
communication_failure = 10
system_failure = 11
OTHERS = 12.
* In below concatenate I set the parameters to the ZIP command is going to be run in the server side.
* -P means the zip goes with password.
* LV_PASSWORD -> I set the password
* L_FILE_ZIP -> is the zip file name (destination)
* L_FILE -> is the file to be zipped (origin)
CONCATENATE '-j' '-P' lv_password l_file_zip l_file INTO v_dir_input SEPARATED BY space.
* C_EXTCOM is the command I created in SM49 before. In my case ZSD_ENCRYPT.
* C_OPER is the operating system. In S4 Hana normally is Linux.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = c_extcom
additional_parameters = v_dir_input
operatingsystem = c_oper
TABLES
exec_protocol = t_result
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
5 | |
3 | |
2 | |
2 | |
2 | |
2 | |
2 | |
1 |