How to Move file / call UNIX command using ABAP Program
Hi, ABAP Guru.
I need to Cut & Paste file (Move file from one location to another location) on Network Shared Drive using ABAP program.
But I can't figured out how to do this and what ABAP Command / FM / Method (and maybe UNIX command) that being used.
Please give me the advice.
Best regard and Thank you all.
Nattapash C.
all methods for your requirements should be in class CL_GUI_FRONTEND_SERVICES
Similar Messages
-
How to read data from an excel using abap program?
Hi
I have to write an abap program to read the contents of ms excel across various
sheets. Can any one help me regarding this
Thanks in advance
SatishHai Satish,
<b>You save all your Excel sheets as Text Tab Delimited.</b>
And then for each teext file can be uploaded into your daabase table.
See the Report that i have done.
REPORT Z_UPLOAD_TO_DATABASE_TABLE.
TABLES:
ZDETMAST. " Database table to be uploaded
Data declaration of the structure to hold ZDETMAST(zdetcode) data *
DATA:
BEGIN OF FS_ZDETMAST,
CNT(3) TYPE C, " Client
DETCODE(15) TYPE C, " Det Code
DETCAT(1) TYPE C, " Det category
DETTYPE(2) TYPE N, " Det type
DETDESC(30) TYPE C, " Det description
PFLAG(1) TYPE C, " Det Flag
TOTALDR(10) TYPE C, " Total DR
TOTALCR(10) TYPE C, " Total CR
END OF FS_ZDETMAST.
Internal table to hold ZDETMAST(zdetcode) data *
DATA:
T_ZDETMAST LIKE STANDARD TABLE OF FS_ZDETMAST.
Function Module to upload ZDETMAST Data
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'D:/ZDETMAST_2.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = 'DAT'
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
CHECK_BOM = ' '
VIRUS_SCAN_PROFILE =
IMPORTING
FILELENGTH =
HEADER =
TABLES
DATA_TAB = T_ZDETMAST
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_READ_ERROR = 2
NO_BATCH = 3
GUI_REFUSE_FILETRANSFER = 4
INVALID_TYPE = 5
NO_AUTHORITY = 6
UNKNOWN_ERROR = 7
BAD_DATA_FORMAT = 8
HEADER_NOT_ALLOWED = 9
SEPARATOR_NOT_ALLOWED = 10
HEADER_TOO_LONG = 11
UNKNOWN_DP_ERROR = 12
ACCESS_DENIED = 13
DP_OUT_OF_MEMORY = 14
DISK_FULL = 15
DP_TIMEOUT = 16
OTHERS = 17
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC <> 0.
LOOP AT T_ZDETMAST INTO FS_ZDETMAST.
WRITE:
/ FS_ZDETMAST-CNT,
FS_ZDETMAST-DETCODE,
FS_ZDETMAST-DETCAT,
FS_ZDETMAST-DETTYPE,
FS_ZDETMAST-DETDESC,
FS_ZDETMAST-PFLAG,
FS_ZDETMAST-TOTALDR,
FS_ZDETMAST-TOTALCR.
ENDLOOP. " LOOP AT T_ZDETMAST ...
LOOP AT T_ZDETMAST INTO ZDETMAST.
IF SY-TABIX GE 2.
INSERT ZDETMAST.
DELETE ZDETMAST.
ENDIF. " IF SY-TABIX EQ 2
ENDLOOP. " LOOP AT T_ZDETMAST
Hope this helps you a lot.
<b>You can also use ALSM_EXCEL_TO_INTERNAL_TABLE FM to have excel data in ITAB AND THEN YOU CAN INSERT DATA INTO DATABASE TABLE.</b>
<b>Reward points if it helps you.</b>
Regds,
Rama chary.Pammi -
Shortdump while calling UNIX command
Hi all,
I have a problem while trying to remove a file in UNIX platform in ABAP program.
It is working fine in the development and quality server, but not in production server.
Based on the debug result, the shortdump was thrown while executing "CALL 'SYSTEM' ID 'COMMAND' FIELD lv_command".
Below are the message return in the program shortdump
How to correct the error
You can check the authorization beforehand with the
function module AUTHORITY_CHECK_C_FUNCTION.
Short text
No authorization to call the C function "SYSTEM".
DATA: lv_command(100) TYPE C,
client_path LIKE RCGFILETR-FTAPPL,
server_path LIKE RCGFILETR-FTAPPL.
DATA: wa_files TYPE rsfillst,
it_files LIKE TABLE OF wa_files.
CALL FUNCTION 'SUBST_GET_FILE_LIST'
EXPORTING
dirname = gv_unix
filenm = '*'
TABLES
file_list = it_files
EXCEPTIONS
access_error = 1
OTHERS = 2.
IF sy-subrc = 0.
LOOP AT it_files INTO wa_files WHERE TYPE <> 'directory'.
CONCATENATE wa_files-dirname wa_files-name INTO server_path.
CONCATENATE p_fname wa_files-name INTO client_path.
CALL FUNCTION 'C13Z_FILE_DOWNLOAD_ASCII'
EXPORTING
i_file_front_end = client_path
i_file_appl = server_path
I_FILE_OVERWRITE = 'X'
EXCEPTIONS
FE_FILE_OPEN_ERROR = 1
FE_FILE_EXISTS = 2
FE_FILE_WRITE_ERROR = 3
AP_NO_AUTHORITY = 4
AP_FILE_OPEN_ERROR = 5
AP_FILE_EMPTY = 6
OTHERS = 7.
IF sy-subrc = 0.
concatenate 'rm -f' server_path into lv_command separated by space.
condense lv_command.
CALL 'SYSTEM' ID 'COMMAND' FIELD lv_command.
CLEAR: lv_command.
ENDIF.
ENDLOOP.
ENDIF.
Anyone knows why and how to resolve this?
Kindly provide your feedback and input. Thanks in advance.You don't have authorisation in PRD to remove files. If it is really required for you.
Take SU53 screen shot immediately once you get short dump and follow up with Basis Folks for required authorisation.
Thanks,
Raj -
Call Unix Command From Reports Using Java
Hi,
Could somebody please show me a sample coding to call Unix command from 10g report using java?
In metalink doc id 361857.1 does not show much.
Thanks,
neeminHi,
I have a problem with synchronization of the java commands.
In the Before Parammeter Form trigger, I have:
function BeforePForm return boolean is
rt ORA_JAVA.JOBJECT;
proc ORA_JAVA.JOBJECT;
v_txt varchar2(32000);
i integer := 0;
v_cd_modulo int;
v_arqlog text_io.file_type;
cursor c_evento is
select codigo,
nome
from
(select e.cd_evento || e.cd_edicao codigo
,nm_evento nome
from grh_ev_evento e
where e.CD_GRUPO in (select cd_grupo
from grh_ev_adm
where cd_usuario = (select cd_usuario
from usuario
where login_usuario = :AUTHID)))
order by substr(nome, 11);
begin
-- Create the context for logged user
if instr(upper(nvl(:AUTHID,'RWCLIENT')),'RWCLIENT') > 0 then
:AUTHID := :SSO_USUARIO;
end if ;
TCEENV.SET_TCEENV(:AUTHID);
if PK_SCA.SCA_GET_USER_RIGHTS(:sca_module_name, :AUTHID) IS NULL then
srw.message(100, 'Access denided!');
return (FALSE);
end if;
-- Create file in Report Server (UNIX)
v_txt := '<BR>' || htf.formSelectOpen('P_EV_EDICAO', 'Evento: ');
:p_file := '/u03/SCAWEB/repout/' || :sca_module_name || '_' ||
pk_sca.sca_encrypt(:AUTHID || to_char(systimestamp, 'ss.ff'));
v_arqlog := text_io.fopen (:p_file, 'A');
text_io.put_line (v_arqlog, v_txt);
for reg in c_evento loop
i := i + 1;
if i = 1 then
v_txt := '<OPTION SELECTED VALUE="' || reg.codigo || '">' || reg.nome;
else
v_txt := '<OPTION VALUE="' || reg.codigo || '">' || reg.nome;
end if;
text_io.put_line (v_arqlog, v_txt);
end loop;
v_txt := '</SELECT></CENTER></form></BODY> </HTML>';
text_io.put_line (v_arqlog, v_txt);
text_io.fclose (v_arqlog);
SRW.SET_AFTER_FORM_HTML(SRW.FILE_ESCAPE, :p_file);
rt := RUNTIME.GetRuntime();
proc := RUNTIME.exec(rt,'rm ' || :p_file);
return (TRUE);
end;
The problem is that there isn't a "synchronize" command, and the
RUNTIME.exec(rt,'rm ' || :p_file) don't works (it does nothing) because
the SRW.SET_AFTER_FORM_HTML has a large delay and the following
command is ignored.
How can I solve it?
thanks,
lmprestes -
Call unix command in sqlplus script
Hello, I wanna to know how to call a unix command in the sqlplus script.
For exemple,
I've a sqlplus script to lauch a oracle report, after the report is generated, I wanne to replace the output file in an other directory.
So that, I have to call the unix command mv here in the sqlplus script
How can I do it?**
I completed my situation:
I don't have dbms_scheduler untility in my database.
Thanks a lot for your help
Edited by: user11930885 on 17 janv. 2010 14:53Yes, at the begining, I'll tried the unix shell by calling SQL.
I've the problem of passing the parameters through.
It seems to me
we can use
Host in the SQLPLUS to run the unix command.
but I've written it in my sqlplus script, it doesn't work. so I wanna to find an exemple how to use HOST in sqlplus script?
I would have loved to give you an example..but its not unix on my laptop.
But what i can tell you is...u should be doing otherway round.
Not calling Unix commands from SQL but calling SQL's form unix.
You got shell scripts for that.
Write a shell script. Login to SQL execute your code.
exit from sql and then move your file with MV. That's it.
Do post how far you get after trying this. -
ASAP:stored proc calling Unix commands
i want an Oracle stored procedure to call unix commands as well as do sqlldr ... opern.
requirement is :
the stored procedure needs to do :
for all files in a Directory:
do
{ .. use sqlldr to insert data in tbls
.. move the processed file into another directory
so,for ls &mv commands i need the Command/way out.
nullHi Jorma,
It's been a while since I did it, but I successfully did what you
are trying to do. All I did was "load" the remote interface and
"stub" class into the database using the "loadjava" utility. My
environment was Oracle 8.1.7 on SUN (Sparc) Solaris 7.
Although I haven't tried it, you may be able to invoke a servlet
from your java stored procedure. The advantage over RMI is that
you don't need to generate and load a "stub" class. Naturally, you
would use the "java.net.URLConnection" class to invoke a servlet
on some web-server/servlet engine which you can communicate with
using "streams" -- java.io.InputStream and java.io.OutputStream
Also, I understand that there is now a "oc4jclient.jar" (not 100%
sure of the name) file that can be "loaded" into the database,
which allows you to contact EJB's in Oracle's OC4J product. I
think you can either do this directly, or indirectly using JMS
over Oracle AQ.
[JMS = Java Messaging Service]
[AQ = Advanced Queueing]
Good Luck,
Avi. -
EXS24 instrument created from audio region- How to move files?
In Logic Pro X. I have created an EXS24 instrument from an audio region with 3 well-separated sounds. The instrument in EXS24 editor shows a zone with 3 files. Each file is actually the same physical file, but, when examining the three separate "files" (what should I call them??), a different section is highlighted for each tone. I can set a note for each of these "files". This instrument plays perfectly.
So now I have 2 files in my project folder - a .exs one for the instrument, and ONE SINGLE .wav file somehow representing three different samples. I want to move them to ~Library/Application Support/Logic/folderName, where folderName is , say, myInstruments (for .exs) and mySamples (for .wav). When I do this, and erase the files in the project folder, I can load the instrument and the sample file into EXS24, but the sample file is recognized as one single tone - that is, in the EXS24 editor, there is only one file rather than 3, and that file has all three audio sounds.
How do I move these files correctly? Is there some way to get them created originally in the correct place?Hi keystrike,
This article will give you information about how to move files in Logic -
Logic Pro X: Move, copy, and convert audio files
Thanks for using Apple Support Communities.
Best,
Brett L -
Call unix commands from stored procedures
My stored procedure requires to call unix commands HOW DO I DO IT?
nulli do not know pl sql but in java you can use:
Runtime.getRuntime().exec("YOUR UNIX COMMAND");
real example:
Runtime.getRuntime().exec("ls");
but you must be careful with using that...
especially if you want to wait till the process finishes..
rgds, -
Execute unix command using java
Hello
Can we execute a unix command using java? If it is how we can execute. Is this affect the performance of the program.
ThanksI tried what you said. But its not working and returning error message,
java.io.IOException: CreateProcess: ls -a error=2
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
If i try this statement,
Runtime.getRuntime().exec("c\windows\notepad");
It is working fine.
Any idea about this.
Plz ........... -
Calling unix script using oracle forms
we have to call unix script using oracle forms , a trigger in form calls stored procedure on database
that stored procedure on database calls a oracle shared library
but since the only listener account for oracle on our unix server is oralist , whenever a call is made to the unix script from the oracle form , the unix script is executed by oralist user
but issue that we are having now is since oralist is specific for listening connections from orale we dont want to use this user to establish SFTP on it to avoid any issues with oralist
we want the sftp to be established on soem other useraccount , so is it possible to do something so that the script is executed by an account other that oralist.I'm not a Linux/Unix specialist, but I think this may work: let your database call a shell script that does a su command before running the actual script:
su - other_account
your_script.sh -
how do I run a unix command to quit ARD if it is running on a remote server I am trying to access?
killall "Remote Desktop"
Regards. -
Excute Unix command Using PL SQL
Greeting,
how can I execute shell unix commands from PL SQL and without passing by the Java virtual machine, because my database server is not very performant to support the heaviness of Java.
Thank you for ur help!!!Is this what you need ?
TEST@db102 SQL> create table test(dir varchar2(100), url varchar2(200));
Table created.
TEST@db102 SQL> insert into test values('/tmp','http://otn.oracle.com');
1 row created.
TEST@db102 SQL> commit;
Commit complete.
TEST@db102 SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[ora102 work db102]$ cat /tmp/wget.sh
#!/bin/bash
rm -f /tmp/index.html
/usr/bin/wget -P $1 $2
[ora102 work db102]$ sqlplus test/test
SQL*Plus: Release 10.2.0.1.0 - Production on Sat Jul 29 17:11:28 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
TEST@db102 SQL> DECLARE
2 v_dir varchar2(100);
3 v_url varchar2(200);
4 BEGIN
5 select dir, url into v_dir, v_url
6 from test;
7 DBMS_SCHEDULER.CREATE_JOB(
8 job_name=>'testjob',
9 job_type=>'EXECUTABLE',
10 job_action=>'/tmp/wget.sh',
11 number_of_arguments => 2,
12 enabled => FALSE);
13 dbms_scheduler.set_job_argument_value('testjob',1,v_dir);
14 dbms_scheduler.set_job_argument_value('testjob',2,v_url);
15 dbms_scheduler.enable('testjob');
16* end;
TEST@db102 SQL> /
PL/SQL procedure successfully completed.
TEST@db102 SQL>sorry for lost indentations, but tags do not help us these days.... -
How to move files between folders within Lightroom 3?
I would like to move a file from one folder to another within Lightroom 3 (let's not discuss why). I searched the threads but couldn't find the answer (maybe I missed it). When I click on a photo within grid view then drag and drop that file onto a different folder in the folder panel (to do the move), a little plus sign (copy) appears and a copy of the file is placed in the second folder. If I try to delete the photo from the original folder (to get the move), both copies of the file are removed. I've tried holding down all sorts of keys on the imac but cannot get the move to work. Ideally, I'd like to move a group of photos but cannot even move one. Does anyone know how to move files between folders in Lightroom 3?
Your suggestion works. Thank you for posting it.
Ron
2010/10/28 Dorin Nicolaescu-Musteață <[email protected]>
Try selecting the photos, right-clicking the target folder and choosing
"Move Selected Photos to This Folder".
> -
how to move files from mac to an external hard drive. Copy leaves the files on the mac hard dive. I am trying to free up space on the mac hard drive.
Whenever you migrate data to an external drive, the files will copy. Once the copy is done, simply delete the files from your internal drive.
-
How would 2 people call each other using facetime if both were in a foreign country but staying at different locations within that country?
It's tied to the Apple ID also - I believe it would use that to find the right person/device.
Perhaps this article would help: http://support.apple.com/kb/HT4319. It looks like you may want to go in through your contacts and make the call.
If you're concerned about data charges, put your phone in Airplane mode before trying to Facetime. That will prevent it from trying to make a call over your cellular data.
~Lyssa
Maybe you are looking for
-
Imported audiobook and iPhone videos not showing in main library.
Today I imported an Audible book I had downloaded by dragging the files onto the "Library" section of iTunes. The progress bar showed that the files were being imported and the book shows up in a smart playlist in the "Playlist" section but not in th
-
My Iphone gets hot and wont hold a charge for more than 8 hrs
My Iphone 5c gets hot even when i dont have a protective case on it but it is worse when it is charging. The battery will only hold a charge for at most 8hrs, i have taken it into the store and they always say nothing is wrong with it. I find that ha
-
I am unable to access my account after the start up of my pc
I am unable to access my account after the pc start up even as an administrator. Other account users are able to.
-
Prob with Totals in Smartforms
Hi, I am having a problem with Totals in my smartform. I am Printing SUBTOTALS , GRANDTOTALS and CARRYFORWARD of amounts in my smartform. My Problem comes with Carryforward total ( Balance forwarded to next page ). Its getting added to a first record
-
Flash animation in Forms 9.0.X
Is there a way to display a flash animation (.SWF) file in a version 9.0 form. The key here is without using webutil to create an OLE container. I'd like to use the out of the box functionality to do this. Thanks