Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

SXPG_COMMAND_EXECUTE - Can't exec external program

massimo_sforza
Participant
0 Likes
1,294

Hi All,

I have read and tried all the suggestions in previous discussion... but still i'm not able to solve my problem.

I have to run the file "encrypt.bat" in my local pc with windows

C:\folder\encrypt.bat

with some parameters adding by the program

(It creates a new file pdf with a password)

in SM69 i customized in this way

Command name: Z_CREA_PWD

Operating system: WINDOWS NT

Type: Customer

for the Definition parameters i tried a lot of things. The last is:

Operating system command: cmd

Parameters for operating system command: C:\folder\encrypt.bat

Additional Parameters Allowed: X

This is my little example program:

DATA: LV_PARAM  LIKE  SXPGCOLIST-PARAMETERS,

       OPERATINGSYSTEM LIKE  SXPGCOLIST-OPSYSTEM VALUE 'WINDOWS NT',

       LV_STATUS LIKE  EXTCMDEXEX-STATUS.

PARAMETERS: p_file1 LIKE rlgrap-filename DEFAULT 'C:\folder\file1.pdf',

                          p_file2 LIKE rlgrap-filename DEFAULT 'C:\folder\file2.pdf',

                         P_PWD   TYPE sld_password DEFAULT 'pswd01'.

START-OF-SELECTION.

   CONCATENATE p_pwd p_pwd p_file1 p_file2 INTO lv_param SEPARATED BY space.

   CALL FUNCTION 'SXPG_COMMAND_EXECUTE'

     EXPORTING

       commandname                   = 'Z_CREA_PWD'

       additional_parameters         = lv_param

       OPERATINGSYSTEM               = OPERATINGSYSTEM

     IMPORTING

       status                        = lv_status

*    TABLES

*      exec_protocol                 = lt_exec

     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 <> 0.

   ENDIF.

but always I got this message:

Can't exec external program (No such file or directory)                                                                                                                                             External program terminated with exit code 1

Where am i wrong?

Thanks a lot

KR

Massi

1 REPLY 1
Read only

former_member191569
Active Participant
0 Likes
637

This message was moderated.