‎2006 Nov 20 6:16 PM
Hi,
I have a requirement to call NOTEPAD.exe and call a TXT file from one local directory and save it in another local directory.
How to do this?
Thanks
aRs
‎2006 Nov 20 6:22 PM
You have to create an external command in SM49 which calls notepad.exe . Then from the ABAP program, use function module SXPG_CALL_SYSTEM to invoke the command.
‎2006 Nov 20 6:29 PM
‎2006 Nov 20 6:31 PM
‎2006 Nov 20 6:34 PM
Hi Rich,
I need to save automatically to another directory, User interaction is not needed. and also i need not use FTP to move the file.
Thanks
aRs
‎2006 Nov 20 6:37 PM
‎2006 Nov 20 6:40 PM
‎2006 Nov 20 6:37 PM
Hi Rich,
Why i tried to use NOTEPAD.exe and save to another directory is of formating. Initially TXT files are not formatted by using NOTEPAD.exe and save i am getting proper formated text. But simply copying the files formatting not happended properly using "frontend->file_copy"
Thanks
aRs
‎2006 Nov 20 6:48 PM
What if you were to upload it and download it, would the formatting happen then?
report zrich_0001.
data: istr type table of string.
data: str_file type string.
parameters: p_file1 type localfile default 'C:file.txt'.
parameters: p_file2 type localfile default 'C:sapfile.txt'.
str_file = p_file1.
call method cl_gui_frontend_services=>gui_upload
exporting
filename = str_file
changing
data_tab = istr.
str_file = p_file2.
call method cl_gui_frontend_services=>gui_download
exporting
filename = str_file
changing
data_tab = istr.
Regards,
Rich Heilman
‎2006 Nov 20 6:54 PM
Hi Rich,
We had a customised NOTEPAD.exe (written a new notepad.exe in Visual C++) that truncated the txt string to 132, and special characters get converted while saving.
Thanks
aRs
‎2006 Nov 20 6:57 PM
I see, so in other words, you must open notepad in order to have the formatting happen. So if that is the case, you can use the EXECUTE method that I mentioned above, but the user will need to save it to the directory. I don't think that you can manipulate Notepad via OLE programming.
Regards,
Rich Heilman
‎2006 Nov 20 7:04 PM
Hi Rich,
I am looking for functionality like this
For example
DIR > T.TXT
Here t.txt have all dir entries
Is it possible same functionality if am calling this exe and results will go another file?
Thanks for your replies
ars
‎2006 Nov 20 7:09 PM
‎2006 Nov 20 7:29 PM
Hi Rich,
If i am calling the EXE file like this.
appl = 'cmd'.
param = '/c YNOTEPAD.exe c:\test1.txt > c:\temp\test1.txt'.
call method cl_gui_frontend_services=>execute
exporting
application = appl
parameter = param
I tried like this way. but result not coming. Is anything i have to add to paramter statement here?
Thanks
aRs
‎2006 Nov 20 7:32 PM
oops I misspelled the paramters while typing here
param = '/c YNOTEPAD.exe c:\test1.txt > c:\temp\test1.txt'.
I am giving like this way
param = 'c:\YNOTEPAD.exe c:\test1.txt > c:\temp\test1.txt'.
Thanks
‎2006 Nov 20 8:04 PM
If I understand correctly, you want to pass the contents of c:\text1.txt as input to c:\YNOTEPAD.exe and capture the formatted version into c:\temp\test1.txt.
It sounds like your YNOTEPAD program is still a text editor and that the formatting occurs on the save. The addition of "> c:\temp\test1.txt" is used to capture standard output. Unless the command line execution of "c:\ynotepad.exe c:\test1.txt" generates standard output, the "> c:\temp\test1.txt" addition won't work.