‎2005 Apr 08 11:17 AM
Hallo,
I have a problem with the new method execute.
We have used gui_exec to run a bat-file with
> command = c:\file.bat
> parameter = "c:\my file.txt"
Now we do the same with the execute.
> application = c:\file.bat
> parameter = "c:\my file.txt"
but this does not work.
It works without the quotes, when the path
has no blanks in it. But it's the user
how chose the path ...
Regards,
Christine
‎2005 Apr 08 11:44 AM
Hello,
I suppose the problem isn't GUI_EXEC, but the batch-file. If I create a batch file like this:
notpad %1
and execute
GUI_EXEC with
command = c:temptest.bat and
parameter = "C:TEMPNEU TEXTDATEI.TXT"
(first without, second with quotes), everything works fine...
Hope this helps (please reward me if it does
Joerg
‎2005 Apr 08 12:31 PM
Hello Joerg,
the gui_exec works, the problem is the new
cl_gui_frontend_services=>execute!
We have also modify the batch with something like
notepad "%*"
but this doesn't work with NT.
I have noticed this:
I can debug the batch-file when I call it like
this:
call method cl_gui_frontend_services=>Execute
exporting
application = c:\test.bat
parameter = 'c:\te st.txt'
or
parameter = c:\te st.txt
but the dos-window close immediatly without
showing anything when I use
parameter = "c:\te st.txt"
Any ideas??
Regards,
Christine
‎2005 Apr 08 12:54 PM
Hello Christine,
When I look at the source of cl_gui_fronent_services->execute, I see that command an parameters are simply concatenated and then transferred to a FM where they are then sent to the SAP GUI "as is":
concatenate name space parameter into name separated by space.
Could you put the following debugging code at the start of your batch file in order to test what's going on exactly:
echo >dump.txt Command line: {%*}
set cnt=1
:loop
if 1%1==1 goto end
echo >>dump.txt Command line arg #%cnt%: {%1}
shift
set /a cnt=%cnt% + 1
goto loop
:end
rem Rest of batch file starts here.
Regards, Joerg
‎2005 Apr 11 11:40 AM
Hello Joerg,
thanks for the debugging code for the batch.
I have done a lot of tests with NT and XP:
***************************
para = l_parameter.
com = l_application.
*CALL FUNCTION 'GUI_EXEC'
EXPORTING
COMMAND = com
PARAMETER = para.
or
CALL METHOD CL_GUI_FRONTEND_SERVICES=>EXECUTE
EXPORTING
APPLICATION = l_application
PARAMETER = l_parameter.
*********************************************
Testing with NT
With the GUI_EXEC I get the file dump.txt with:
Command line: { "D:\test mit leer\mit_.txt"}
Command line arg #1: {"D:\test mit leer\mit_.txt"}
The same with EXECUTE: there is no dump.txt-file.
Testing with XP:
both the GUI_EXEC and the EXECUTE are writing
the dump.txt-file with the same content as above.
So the problem is only with NT and there are
only a few with it left. They have to use path
without blank or use XP ...!
Thanks for your help.
Regards,
Christine
‎2005 Apr 12 8:29 AM
Hi Christine!
Would you mind closing this thread?
Regards, Joerg