ABAP Unix
Hi gurus,
In my requirement i need to write unix script also along with abap .. i still did not get any spec for this so to give more information to you.
But i never worked Unix and abap together...
Can you pls tell me why and when we use Unix scripting with ABAP?
how can we use UNiX in SAP system?
any sample unix scripts... will be appreciated..
Thanx in Advance
Giri.
I don't send PDFs around.
"Unix" is a generic Term for an operating system (see http://en.wikipedia.org/wiki/Unix).
Since I don't know why you need to execute Unix scripts from SAP I can't tell you what you need to do in order to accomplish that. I can just say, that it's possible to do so (external commands using transaction SE49).
It can be used to e. g. copy files to a (non-SAP)-System, do FTP and many other things.
Markus
Similar Messages
-
Small question related to Unix and ABAP
Hi Guys,
I had a new SAP ABAP requirment in which they are asking for unix shell scripting.
I am just wondering as what unix shell scripting has to do in SAP ?
Please throw some light on this....
Regards,
Tushar.Hi Tushar,
Please Close your previous thread by marking helpful answers...
for this question ...
Check these links out
monitor ABAP from UNIX
Re: execute unix in ABAP
Unix commands in ABAP
Download to Unix
these Links definitely find helpful to you...
Regards,
Santosh -
Stop CIF queues always during online Backup on SCM system
Hello,
On Upgrade Guide "SAP SCM 5.1 ABAP UNIX Oracle Version 1.00" under
chapter 3.4 --> Backup before prepare JAVA we found this :
"Before performing a database backup, you have to stop the CIF queues in your
SAP SCM system in order to ensure a consistent recovery state."
Is this relevant for every online backups (also outside from Upgrading)?
Should we stop the CIF queues on daily online backups too? Or is this a special-feature during Upgrade?
BR
Ray PuruckerHello,
Do you have above said log file available ?
Instead of the option 'Overflow log path', did you try rollforward with the option of timestamp (point in time) (till the time you have the log files) Or with the option overflow log path but with 'NORETRIEVE' as well ?
For the query status command, Last committed transaction time stamp is not what you thought.
Please revise the command options,
http://publib.boulder.ibm.com/infocenter/db2luw/v8/index.jsp?topic=/com.ibm.db2.udb.doc/core/r0001978.htm
'It is looking for log file S0000XXX.LOG whose time stamp is older than the time stamp of online backup.'
If you want to restore only until the online backup, then use the option End of Backup and stop - to rollforward until the last log when backup was in progress
Thanks -
Hi All,
I am new to ABAP. as per our client requirement we need to call background job though a abap code.
How can we retrive background jobs? where/in which tabl are names of backghround job saved?Hi,
please check out the below link it will help you
http://help.sap.com/saphelp_46c/helpdata/en/73/69ef3d55bb11d189680000e829fbbd/content.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/4a/2d513897110872e10000009b38f889/content.htm
http://www.finance.utoronto.ca/fast/qrg/nav/commonrptfcns/runrptbackgr.htm
the following list is the available system tables
ADCP Person/Address assignment (central address administration)
ADIRACCESS Table to store keys for TADIR objects
ADR2 Telephone numbers (central address admin.)
ADRP Persons (central address administration)
APQD DATA DEFINITION Queue
APQI Queue info definition
D010SINF ABAP- Information about ABAP program source code
E071 Change and Transport System- Object Entries of Requests/Tasks
E07T Change and Transport System- Short Texts for Requests/Tasks
ENLFDIR Additional Attributes for Function Modules
INDX System table INDX
NAST Message Status
STXH STXD SAPscript text file header
T005 Countries
T005S Taxes- Region (Province) Key
T005U Taxes- Region Key- Texts
T006 Units of Measurement
T015M Names of the months
T247 Month name and short text
T777A Building Addresses
TADIR Directory of Repository Objects
TBTCO Job status overview table
TBTCP Batch job step overview
TFDIR Function Module
TFTIT Function Module Short Text
TSP03L Spool- Long device names
TSTC SAP Transaction Codes
TSTCT Transaction Code Texts
TUTYP User Types in Current Price List in SAP System
TUZUS Special versions
TVARV Table of variables in selection criteria
TVDIR View Directory
US930 Data Relevant to Measurement for User Master Record
USR01 User master record (runtime data)
USR02 Logon data
USR04 User master authorizations
USR06 Additional Data per User
USR14 Surchargeable Language Versions per User
USR21 Assign user name address key
ARCH_OBJ Objects for archiving and reorganization
BTCUED Description of user event IDs for background processing
BTXSUPB BSI- Upgrade-Information
CCCFLOW Client Copy Control Flow
DBSTATC DB Optimizer Control (Statistics Creation)
DEVACCESS Table for development users
DEVL OBSOLETE- Do not use (See TCETRAL)
E070 Change and Transport System- Header of Requests/Tasks
E070L CTS- Index for Assigning Numbers to Requests/Tasks
INSTVERS Documentation for installation Status and History
PAT03 Patch Directory
SDBAC DBA Action Table
T100 Messages
TAPLT Program Application Long Texts
TASYS OBSOLETE- Do not use, see TCEDELI
TDEVC Development Classes
TEMSE Temp Sequential table.
TLOCK Change and Transport System- Lock Table
TNAPR Processing programs for output. Can be very handy to find the print program for a SAPScript.
TNAST Printed output control table
TPFET Table of profile parameters
TPFHT Profile header, administration data for profiles in DB
TPROT Table contains all DD tables to be logged
TRBAT Communication Table for Transport Control
TRDIRT Title texts for programs in TRDIR
TRESN Table of Naming Conventions in ABAP Workbench
TRJOB Job ID for Coordinating Batch-ABAP/UNIX for Transports
TSP03C Spool- Device Description Extension
TST03 TemSe data
TSYST OBSOLETE- Do not use (see TCESYST)
TWSYS OBSOLETE- Do not use (See TCETRAL)
USOBT Relation transaction - authorization object
USR03 User address data
USR05 User Master Parameter ID
USR12 User master authorization values
USR40 Table for illegal passwords
USR41 User master- Additional data
UST04 User masters
VARIT Variant texts
VARID Variant directory
D010TAB Table for Use Report---Tables
DD02L SAP tables
DD02T R/3 DD- SAP table texts
DD03L Table Fields
DD03T DD- Texts for fields (language dependent)
EDIDC IDOC Control Records
EDIDOT Short description of IDoc types
EDID2 IDOC segments (version 3.1)
EDID4 IDOC segments (version 4.6)
EDSEA EDI- Table of all segments of current release
VRSX2 Central Table for Version Management (Report Source)
TSE05 Can add parameters to the INSERT COMMAND (IC). Then, when you insert command, your info appears in the editor. Useful for comment blocks, common section of code, etc.
CDPOS Change document items
CDHDR Change document header
T529A governs the foreground sequence of infotypes the system will use to prompt the user during online and batch processing. You will have to code your BDC to follow that sequence of creating infotypes.
T588Z governs the dynamic event processing that will only take place during online user inputs. For BDC's you will have to create separate BDC's to handle any infotypes that are inserted dynamically by this table.
T588M Infotype Screen Control
***********please reward points if the information is helpful to you************* -
SEVERE ERROR in Upgrade Phase ADDON_SPEC2
I`m trying to upgrade R/3 Release 4.6C to SAP ECC 6.0 SR3 (7.0) Abap:
Unix - Oracle.
I found no errors in log files.
I have successfully completed all the PREPARE PHASES.
Source System:
SAP release: R/3 Release 4.6C
DB version: 10.2.0.2
S.O. version: HP-UX B.11.23 U ia64
Kernel: 46D_Ext
Target System:
SAP release: ECC 6.0 R/3 (7.0)
DB version: 10.2.0.2
S.O. version: HP-UX B.11.23 U ia64
Please help,
Regards,
Erickmore SAPup.log
UPGRADEPHASE ADDON_SPEC2
...started at 20090219124818
Phase log file: 'ADDONSPEC2.LOG'
..finished at 20090219124818 with SEVERE ERROR(S).
...begin dialogue at 20090219124818
...end dialogue at 20090219135001
..answered at 20090219135001.
-> decided to exit.
more ADDONSPEC2.SAV
#---- MASKING file ADDONSPEC2.LOG from /usr/sap/put/log
#---- TIME: 20090219124818
1 ETQ201XEntering upgrade-phase "ADDON_SPEC2" ("20090218183020")
2 ETQ367 Connect variables are set for standard instance access
4 ETQ399 System-nr = '01', GwService = 'sapgw01'
4 ETQ399 Environment variables:
4 ETQ399 dbs_ora_schema=SAPSP1
4 ETQ399 auth_shadow_upgrade=0
ADDONSPEC2.SAV: END
more ADDONSPEC2.LOG
1 ETQ201XEntering upgrade-phase "ADDON_SPEC2" ("20090219124818")
2 ETQ367 Connect variables are set for standard instance access
4 ETQ399 System-nr = '01', GwService = 'sapgw01'
4 ETQ399 Environment variables:
4 ETQ399 dbs_ora_schema=SAPSP1
4 ETQ399 auth_shadow_upgrade=0
Some idea,
Erick -
I want to execute UNIX COMMAND in ABAP
Hi All,
I want to execute a UNIX XOMMAND sh <scriptname> <filename> to replace divsion codes.in ABAP.
But, I came to know that we can't (2) or try the following program but unfortunately the command CALL SYSTEM is not supported by SAP. If you are on R/3 2.1 - 2.2x you can get some idea's from the program SAPMSOS0.
REPORT ZUNIXCOM .
DATA: U_COMMAND(200).
Table for system messages
DATA: BEGIN OF RT OCCURS 100 ,
LINE(100) ,
END OF RT .
START-OF-SELECTION .
MOVE 'unix command' to U_COMMAND .
REFRESH RT.
CALL 'SYSTEM' ID 'COMMAND' FIELD U_COMMAND
ID 'TAB' FIELD RT-SYS .
LOOP AT RT.
WRITE : / RT-LINE .
ENDLOOP.
So please can u help me how to call a unix command from ABAP. it is very urgent. I want complete details and all possible solutions
<removed_by_moderator>
Thanks,
gyanaraj
Edited by: Julius Bussche on Aug 26, 2008 11:29 AMSelvaraj Gyanaraj wrote:>
> So please can u help me how to call a unix command from ABAP.
I was about to help you.
>it is very urgent.
I changed my mind.
>I want complete details and all possible solutions
I'm glad I changed my mind.
>Points are surely rewarded.
Too late. -
Hi All,
I need to use unix command (MOVE) in ABAP code for transfering a file from one directory to another directory.
Can any one help with how to used unix commands in ABAP?
Thanks in advance.
Regards,
HemendraThe recommended approach always used to be to use transaction SM69 to define a "soft" command name to the operating system command so that it could be configured to work across Windows, Unix etc. For example:
Command name OS Type OS command Parameters for operating system command
Z_FILE_MOVE SunOS Customer mv ? ?
You can then call function module SXPG_COMMAND_EXECUTE (quite well documented) to actually perform the command passing in the appropriate number of parameters.
Jonathan -
Hi,
I need to call the following unix command in ABAP to encrypt a file on the app server .
crypt password <org filename> new_filename
1 But when i run it using call 'SYSTEM' .. i get message security risk , command not executed ..
2 I also created the command in SM69 and tries to run it but same error.
3 I also created a shell script , but i get another message when i try to run sh ...
Please help to find out a way to make it work ..
KunalHi kunal,
1. probably ur basis team might be able to help u.
2. even if we have authorisations thru sap
to run external os command,
the actual OS user on application server
must have the right for it
and access/write/read/modify
for the files (provided thru the command)
in question.
3. Due to this , the systems gives the message
of SECURITY RISK.
regards,
amit m. -
How to generate a empty file in AL11 using ABAP and unix command
Hi Experts,
when load infopackage triggers it will search file from AL11 if file is available it will get loaded successfully. When there is no file in AL11 error while opening file (orgin A) and the load will fail. At this level i have to write a abap code using unix command to generate a empty file.
Is there any way to achieve the above requirement.
Thanks
VaraHi,
If i get your requirement properly then you want to create a blank file if there is no file on the application server so that your infopackage does not fail, am i correct.
If this is your requirement then this can be easily done if you use process chain to load the file via infopackage. Follow the following steps:
1. Add a ABAP program before the infopackage and check if the file is present on the server or not. Use a simple ABAP statement OPEN DATASET <FNAME>. Check the SY-SUBRC after this statement if it is not 0 then it means that the file does not exist on the application server.
2. Once you have established that the file is not present create a flat file using a code similar to the below one
OPEN DATASET FILENAME FOR OUTPUT IN TEXT MODE
MESSAGE D_MSG_TEXT.
IF SY-SUBRC NE 0.
WRITE: 'File cannot be opened. Reason:', D_MSG_TEXT.
EXIT.
ENDIF.
* Transferring Data
LOOP AT INT_table.
TRANSFER INT_table-field1 TO FILENAME.
ENDLOOP.
* Closing the File
CLOSE DATASET FILENAME.
3. Add your infopackage step after this ABAP program in your process chain.
I hope this helps.
Best Regards,
Kush Kashyap -
Trying to print ABAP List in Unix
I am new to SAP and I am trying to print using unix as my host spooler. I am printing to a Xerox machine connected to a print server. I am just trying to print the test ABAP list you get when you go into SPAD and select Utilities/ouput devices then select ABAP List. When I print this I get nothing but ABCD and a bunch of numbers. I am trying to figure if the ABAP list is supposed to be that way or if something is wrong with my driver.
Hello Rodney,
What device type did you specify in the SPAD Output Device definition? You need to make sure you select a device type which is compatible with the printer. If the printer supports postscript printer language, then you need to select the 'Post2' or 'postscpt' device types. If the printer support PCL, then test with 'hplj4' device type. Most likely the currently selected device type is not compatible with the printer and therefore creates a print file which the printer cannot interpret.
Regards,
Nathan -
Hi Champs,
I need integerate UNIX application in my ABAP program. Below are the list of requirements for which UNIX will be required:
1) Need to move a file from one directory to another in Application server.UNIX command can be
MV Source Target
2) Need to search for a file in certain Directory.UNIX command can be
LS <file> Directiories where in files to be search.
Please can you help me out how to integerate UNIX code with ABAP report.
Regards,
Nishant KhimesraNishant,
To move a file from one directory to another in Application server.
DATA: command LIKE rs37a-line.
DATA: BEGIN OF tabl OCCURS 0,
line(2000),
END OF tabl.
command = 'mv /tmp/file1.txt /usr/tmp/file1.txt'.
CALL 'SYSTEM' ID 'COMMAND' FIELD command
ID 'TAB' FIELD tabl-*sys*.
To search for a file in certain Directory.
DATA: command LIKE rs37a-line.
DATA: BEGIN OF tabl OCCURS 0,
line(2000),
END OF tabl.
command = 'ls /tmp/file1.txt '.
CALL 'SYSTEM' ID 'COMMAND' FIELD command
ID 'TAB' FIELD tabl-*sys*.
Regards
Sabu -
Execute unix script from abap.
Hi friends,
I have a abap report which generate a text file in<b> /usr/tmp/</b> directory . Now i have a unix script which encript the text file. I want to this from abap report. How I can do this . and in which path I should keep this unix script Please help.
RegardsHi,
try the below code
parameters : p_sfile(60) lower case
"File to be moved
"Eg : /home/in/SFILE1.txt
p_dfile(60) lower case.
"File's Destination
"Eg: /home/archive/SFILE1.txt
data : t_btcxpm
like btcxpm occurs 0,
p_addparam
like sxpgcolist-parameters.
concatenate
'/home/ABAP/scripts/Archive_file.sh'
p_sfile
p_dfile
into p_addparam separated by space.
refresh t_btcxpm. clear t_btcxpm.
call function 'SXPG_CALL_SYSTEM'
exporting
commandname = 'ZSHELL'
additional_parameters = p_addparam
tables
exec_protocol = t_btcxpm
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
others = 12.
if sy-subrc = 0.
write : /
'File',p_sfile,'moved to',p_dfile.
else.
write : / 'Error Occured'.
endif.
Reward points if found helpful
Cheers,
Chandra Sekhar. -
ABAP to FTP connect to non SAP UNIX system
Greetings~
I'm looking for a way (via function modules and/or BAPI) to transfer data in flat files from an SAP UNIX system to a non-SAP UNIX system using an ABAP program. I see FM's FTP_CONNECT and FTP_COMMAND however these seem to only work with UNIX systems running SAP as they require RFC_DESTINATION information. Anybody know which (if any) FM's can be used without the necessity of the target system running SAP/RFC?
Thanks!Hi Joseph,
Please refer the below program.
REPORT ZHR_T777A_FEED.
tables: t777a. "Building Addresses
Internal Table for Building table.
data: begin of it_t777a occurs 0,
build like t777a-build, "Building
stext like t777a-stext, "Object Name
cname like t777a-cname, "Address Supplement (c/o)
ort01 like t777a-ort01, "City
pstlz like t777a-pstlz, "Postal Code
regio like t777a-regio, "Region (State, Province, County)
end of it_t777a.
Internal Table for taking all fields of the above table in one line
separated by |(pipe).
data: begin of it_text occurs 0,
text(131),
end of it_text.
Constants: c_key type i value 26101957,
c_dest type rfcdes-rfcdest value 'SAPFTPA'.
data: g_dhdl type i, "Handle
g_dlen type i, "pass word length
g_dpwd(30). "For storing password
Selection Screen Starts
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
parameters: p_user(30) default 'XXXXXXX' obligatory,
p_pwd(30) default 'XXXXXXX' obligatory,
p_host(64) default 'XXX.XXX.XX.XXX' obligatory.
SELECTION-SCREEN END OF BLOCK blk1.
SELECTION-SCREEN BEGIN OF BLOCK blk2 WITH FRAME TITLE TEXT-002.
parameters: p_file like rlgrap-filename default 't777a_feed.txt'.
SELECTION-SCREEN END OF BLOCK blk2.
Password not visible.
at Selection-screen output.
loop at screen.
if screen-name = 'P_PWD'.
screen-invisible = '1'.
modify screen.
endif.
endloop.
g_dpwd = p_pwd.
Start of selection
start-of-selection.
To fetch the data records from the table T777A.
select build stext cname ort01 pstlz regio
from t777a
into table it_t777a.
Sort the internal table by build.
if not it_t777a[] is initial.
sort it_t777a by build.
endif.
Concatenate all the fields of above internal table records in one line
separated by |(pipe).
loop at it_t777a.
concatenate it_t777a-build it_t777a-stext it_t777a-cname
it_t777a-ort01 it_t777a-pstlz it_t777a-regio
into it_text-text separated by '|'.
append it_text.
clear it_text.
endloop.
To get the length of the password.
g_dlen = strlen( g_dpwd ).
Below Function module is used to Encrypt the Password.
CALL FUNCTION 'HTTP_SCRAMBLE'
EXPORTING
SOURCE = g_dpwd "Actual password
SOURCELEN = g_dlen
KEY = c_key
IMPORTING
DESTINATION = g_dpwd. "Encyrpted Password
*Connects to the FTP Server as specified by user.
Call function 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'Connecting to FTP Server'.
Below function module is used to connect the FTP Server.
It Accepts only Encrypted Passwords.
This Function module will provide a handle to perform different
operations on the FTP Server via FTP Commands.
call function 'FTP_CONNECT'
EXPORTING
user = p_user
password = g_dpwd
host = p_host
rfc_destination = c_dest
IMPORTING
handle = g_dhdl
EXCEPTIONS
NOT_CONNECTED.
if sy-subrc ne 0.
format color col_negative.
write:/ 'Error in Connection'.
else.
write:/ 'FTP Connection is opened '.
endif.
**Transferring the data from internal table to FTP Server.
CALL FUNCTION 'FTP_R3_TO_SERVER'
EXPORTING
HANDLE = g_dhdl
FNAME = p_file
CHARACTER_MODE = 'X'
TABLES
TEXT = it_text
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ELSE.
write:/ 'File has created on FTP Server'.
ENDIF.
Call function 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = 'File has created on FTP Server'.
To Disconnect the FTP Server.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = g_dhdl.
To Disconnect the Destination.
CALL FUNCTION 'RFC_CONNECTION_CLOSE'
EXPORTING
destination = c_dest
EXCEPTIONS
others = 1.
Regards,
Kumar Bandanadham. -
Call ABAP program from Unix script passing dynamic filename
Hi,
Does anyone know if it is possible to call an ABAP program from a Unix script passing a dynamic filename to the ABAP program?
We are receiving a file from an external company and on receipt of the file want to call an ABAP program passing the filename. The filename is made up of File ID, Date and Time which we need to read in the ABAP program. We usually use Events to trigger a program which is fine when the filename if static however since this filename will be dynamic we cannot do this. In addition we cannot just rename the file to a static name in the Unix script as we need to know the value of the date and time from the file ID in the ABAP program. I can change the ABAP program to check our /in directory for a Filename that starts with the fixed File ID however I thought there must be a better way of doing this. We want the external company to put this information in a file header record but they don't want to change the file contents. Any ideas would be appreciated.
Thanks,
Sinead.You could follow the following method
1.Let the external file reside in the SAP application layer in a defined path e.g. /usr/sap/tmp/interface/working/
2.Write an ABAP program which will include the following steps:-
i) read all files in the file path using function module EPS_GET_DIRECTORY_LISTING
ii) Read the data from files existing in the directory using OPEN_DATASET statement
iii) After the files have been read move the files to another directory e.g. /usr/sap/tmp/interface/backup/ or you can delete the file.
3.Schedule this program to be executed depending on the frequency of the external file being generated. -
To execute from ABAP code an external Unix program
HI,
I would like to know how to execute from ABAP code an external Unix program and check for a return code?HI,
There are different ways to this:
(1) OPEN DATASET <file> FOR OUTPUT 'unix command'
CLOSE DATASET <file>
This command executes the unix command and writes the output into <file>
Look into OSS Note 9391.
(2) or try the following program but unfortunately the command CALL SYSTEM is
not supported by SAP. If you are on R/3 2.1 - 2.2x you can get some idea's from the program SAPMSOS0.
REPORT ZUNIXCOM .
DATA: U_COMMAND(200).
Table for system messages
DATA: BEGIN OF RT OCCURS 100 ,
LINE(100) ,
END OF RT .
START-OF-SELECTION .
MOVE 'unix command' to U_COMMAND .
REFRESH RT.
CALL 'SYSTEM' ID 'COMMAND' FIELD U_COMMAND
ID 'TAB' FIELD RT-SYS .
LOOP AT RT.
WRITE : / RT-LINE .
ENDLOOP.
Reward Points if found helpfull..
Cheers,
Chandra Sekhar.
Maybe you are looking for
-
Why do I get a file security error when downloading itunes.
I try to download itunes, but about halfway through an error messge comes up that says error with file security:get lasterror:5
-
Launch applications in new Window from UWL
Hi I have lot of work Items in my UWL. Each could be an SAP Transaction or a WebDynpro Application. I just want them to be launched in a seperate window. Murali.
-
Tab labels always say "Connecting" or "New Tab" but content is OK/normal
Each tab shows that it is still transferring data/loading but they have been open for quite some time. Regardless of individual page. Tried turning on/off script block. No change. Makes it difficult to navigate between tabs.
-
I went through 20+ pages trying to see if anyone has a similar problem... no luck. This is what happens.... I open iTunes. Click Music... and it takes about 3 seconds for it to recognize the click Then i go to click a song and that takes 6-7 seconds
-
Upgrading problem Nokia Lumia 820
I won an 820 from Nokia, the one they've sent to me lists itself as an "NV EURO TRIAL" on the packaging. The firmware running on it is 1232.2107.1241.1000 which is quite outdated now. I tried to update it many times from phone update option in phone