Validate whether a file path or directory exists on application server
hi,
I need to validate if a directory or file path exist on application server. How do we do that?
thanks.
DATA:
ltp_bom TYPE sychar01,
ltp_encoding TYPE sychar01,
ltp_codepage TYPE cpcodepage.
Processing --------------------------------------------------------- *
TRY.
CALL METHOD cl_abap_file_utilities=>check_utf8
EXPORTING
file_name = itp_filename
max_kb = -1
all_if_7bit_ascii = abap_true
IMPORTING
bom = ltp_bom
encoding = ltp_encoding.
CATCH cx_sy_file_open .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING file_open_error.
CATCH cx_sy_file_authority .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING file_authority_error.
CATCH cx_sy_file_io .
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4
RAISING file_io_error.
ENDTRY.
Similar Messages
-
How Create Virtual Directory On Oracle Application Server 10g on RHEL 5
Dear Sir
i have deployed my application on OAS 10g on RHEL 5 ,,now since my application is calling some pro*c programs and then they generate some text based reports on fixed folder named
/treas/temp
now i simply have to open these text based reports on web browser
WEB.SHOW_DOCUMENT('/forms/pcreport/'||v_filename);
but for that i need to create virtual directory name : " /pcreport " without code
kindlly help as its working on my developer suit 10g i created a virtual directory in my application server by making following entry in "orion-web.xml" file
<virtual-directory virtual-path="/pcreport" real-path="/u/treas/temp" />
kindlly help(My paths shown, yours will be different)
In a text editor :
/u01/app/oracle/product/midtier/Apache/Apache/conf/httpd.conf
Add
Alias /pcreport/ "/u01/app/oracle/product/midtier/forms/pcreport/"
<Directory "/u01/app/oracle/product/midtier/forms/pcreport/">
Options Indexes
AllowOverride None
Order allow,deny
Allow from all
</Directory>
Create the pcreport directory.
Add a simple test page
vi /u01/app/oracle/product/midtier/forms/pcreport/test.html
<html>
<head>
<title>Simple test page </title>
<style type="text/css">
body {
margin-left: 20%;;
margin-right: 20%;
border: 1px dotted gray;
padding: 10px 10px 10px 10px;
</style>
</head>
<body>
<p>test!</p>
</body>
</html>
Test
http://yourserver.com:7777/pcreport/test.html
Best Regards
mseberg -
API for creating a directory in the application server
Hello,
Does anyone knows a way to create a directory in the application server? Something similar to
CL_GUI_FRONTEND_SERVICES but for managing files in the application server?
Thanks in advance
Diz IsMiActually, CL_GUI_FRONTEND_SERVICES=>Directory_Create works really good for me.
REPORT ZRICH_0001 .
data: path type string.
data: rc type sy-subrc.
path = '\172.52.72.651qfilesvr400S109XXXXusrsapTSTSYStest'.
CALL METHOD CL_GUI_FRONTEND_SERVICES=>DIRECTORY_CREATE
EXPORTING
DIRECTORY = path
CHANGING
RC = rc
EXCEPTIONS
DIRECTORY_CREATE_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
PATH_NOT_FOUND = 4
DIRECTORY_ACCESS_DENIED = 5
DIRECTORY_ALREADY_EXISTS = 6
UNKNOWN_ERROR = 7
others = 8
IF SY-SUBRC <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
Regards,
Rich Heilman -
How to load data from a flat file which is there in the application server
HI All,
how to load data from a flat file which is there in the application server..Hi,
Firstly you will need to place the file(s) in the AL11 path. Then in your infopackage in "Extraction" tab you need to select "Application Server" option. Then you need to specify the path as well as the exact file you want to load by using the browsing button.
If your file name keeps changing on a daily basis i.e. name_ddmmyyyy.csv, then in the Extraction tab you have the option to write an ABAP routine that generates the file name. Here you will need to append sy-datum to "name" and then append ".csv" to generate complete filename.
Please let me know if this is helpful or if you need any more inputs.
Thanks & Regards,
Nishant Tatkar. -
Picking a IDOC Flat File stored in SAP R/3 Application Server by SAP PI
Hi,
Can SAP PI pickup a IDOC Flat File stored in SAP R/3 Application Server Directory and send it back as an Inbound IDOC.
Scenario:
We have a data in the EXCEL Sheet, which will be used to a fill an IDOC and the IDOC will be just save in the SAP R/3 Application Server Directory, but can not be triggered due to its peculiar behavior. Afterwards, SAP PI should pole the SAP R/3 and pick up that IDOC Flat File from the R/3 Application Server and send it back to the SAP R/3 as an Inbound IDOC.
For Ref: IDOC does not have a Outbound Process Code, thus can not be triggered and send to SAP PI. It is always used as a Inbound IDOC in SAP R/3 system.
Regards,
SaurabhSAP PI should pole the SAP R/3 and pick up that IDOC Flat File from the R/3 Application Server
If SAP PI = 7.11 --> /people/william.li/blog/2009/04/01/how-to-use-user-module-for-conversion-of-idoc-messages-between-flat-and-xml-formats
send it back to the SAP R/3 as an Inbound IDOC
why to send some information again into R3 which it already has? cant some internal code in R3 read the info from excel and then update the IDOC directly? -
Directory browsing in Application Server
Hi Gurus,
I need Directory browsing facility for my application server . i.e facility to select any directory on my application server. Can any body help me.
Regards,
SrinivasHi Srinivas,
Try using function module F4_DXFILENAME_TOPRECURSION or /SAPDMC/LSM_F4_SERVER_FILE (this gives the help in tree structure)
A sample on how to use F4_DXFILENAME_TOPRECURSION
DATA
: O_PATH TYPE DXFIELDS-LONGPATH.
PARAMETERS
: P_FILE TYPE RLGRAP-FILENAME
START-OF-SELECTION.
WRITE : 'Selected file',
P_FILE.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FILE.
CALL FUNCTION 'F4_DXFILENAME_TOPRECURSION'
EXPORTING
I_LOCATION_FLAG = 'A'
I_SERVER = ' '
I_PATH = ' '
FILEOPERATION = 'R'
IMPORTING
O_PATH = O_PATH
EXCEPTIONS
RFC_ERROR = 1
ERROR_WITH_GUI = 2
OTHERS = 3.
P_FILE = O_PATH.
Regards'
Rajvansh
Edited by: Rajvansh Ravi on Jul 24, 2011 2:36 PM -
How can i display a image file which is placed in the applications server
Hi all,
Can any one help me how can I display a image file which is present in the application server.
With regards,
M.Ramana Murthyhi,
*& Form TOP_OF_PAGE
* text
FORM F_TOP_OF_PAGE.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_LISTHEADER
i_logo = Logo name
* I_END_OF_LIST_GRID =
ENDFORM. "TOP_OF_PAGE
rgds
Anver -
File exist in application server directory
Hi there,
On my SAP server, i have a directory created specifically to store input files generated from other external systems.
From my ABAP program, i need to check if any file exist on that application server directory. If yes, then i will proceed to read the input file and process it.
If it's empty, then output message that file is not available.
Are there any FM to do this?you can use this code to do this...
Upload data from file
DATA: lv_filename TYPE string, "File name
lv_line TYPE string. "One line entry in a file
lv_filename = iv_file_name.
IF iv_location = gc_application.
IF iv_record_count IS SUPPLIED.
Open file
IF gv_file IS INITIAL.
OPEN DATASET lv_filename FOR INPUT IN TEXT MODE
ENCODING DEFAULT
IGNORING CONVERSION ERRORS.
IF sy-subrc <> 0.
RAISE file_open_error.
ENDIF.
gv_file = gc_check.
ENDIF.
Read data
DO iv_record_count TIMES.
READ DATASET lv_filename INTO lv_line.
IF sy-subrc <> 0.
Close file
CLOSE DATASET lv_filename.
IF sy-subrc NE 0.
RAISE file_close_error.
ENDIF.
CLEAR gv_file.
Exit from the loop
EXIT.
ENDIF.
IF iv_separator IS NOT INITIAL.
CALL FUNCTION 'Z_WM_SPLIT_DATA'
EXPORTING
iv_data = lv_line
iv_separator = iv_separator
CHANGING
ct_tab_data = ct_tab_data.
ELSE.
CHECK NOT lv_line IS INITIAL.
APPEND lv_line TO ct_tab_data .
ENDIF.
ENDDO.
ELSE.
Open file
OPEN DATASET lv_filename FOR INPUT IN TEXT MODE
ENCODING DEFAULT
IGNORING CONVERSION ERRORS.
IF sy-subrc <> 0.
RAISE file_open_error.
ENDIF.
Read data
DO.
READ DATASET lv_filename INTO lv_line.
IF sy-subrc <> 0.
EXIT.
ENDIF.
IF iv_separator IS NOT INITIAL.
CALL FUNCTION 'Z_WM_SPLIT_DATA'
EXPORTING
iv_data = lv_line
iv_separator = iv_separator
CHANGING
ct_tab_data = ct_tab_data.
ELSE.
CHECK NOT lv_line IS INITIAL.
APPEND lv_line TO ct_tab_data .
ENDIF.
ENDDO.
Close file
CLOSE DATASET lv_filename.
IF sy-subrc NE 0.
RAISE file_close_error.
ENDIF.
ENDIF. -
Get File Names & Creation Time of the files of a directory in App. Server
Dear all,
My requirement is to fetch all the file names of a paritucular direcory in the application server. After going through SDN i got some FM's like
1. EPS_GET_DIRECTORY_LISTING
2. EPS_GET_FILE_ATTRIBUTES
3. SUBST_GET_FILE_LIST
Here EPS_GET_DIRECTORY_LISTING looks perfect for my requirement. But while I tried to test the FM from SE37 its giving exception READ_DIRECTORY_FAILED for the required Directory. But the same FM is returning file names for the root directory.
Please look a above 2 scenario...
ie. if I give Export parameter as
DIR_NAME = '/'
FILE_MASK = '*'
The FM works fine.
But . if I give Export parameter as
DIR_NAME = '/XYZ'
FILE_MASK = '*'
The FM returns exception READ_DIRECTORY_FAILED .
But the directory /XYZ exists and there are files in it..Am I missing something with respect to the path am specifying.
Regards,
AntonyHi, see if this peace of code helps you.
CONSTANTS DAYS1980 TYPE I VALUE 3652.
DATA: DLIST LIKE EPSFILI OCCURS 0 WITH HEADER LINE, DPATH LIKE EPSF-EPSDIRNAM, MDATE LIKE SY-DATUM, MTIME LIKE SY-UZEIT, POINT_IN_TIME TYPE I.
DATA: BEGIN OF FATTR OCCURS 0, FILE_NAME LIKE EPSF-EPSFILNAM, FILE_SIZE LIKE EPSF-EPSFILSIZ, FILE_OWNER LIKE EPSF-EPSFILOWN, FILE_MODE LIKE EPSF-EPSFILMOD, FILE_TYPE LIKE EPSF-EPSFILTYP, FILE_MTIME(12), END OF FATTR.
PARAMETER P_PATH(50) TYPE C DEFAULT '/TMP' LOWER CASE.
DPATH = P_PATH.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
DIR_NAME = DPATH
TABLES
DIR_LIST = DLIST
EXCEPTIONS
INVALID_EPS_SUBDIR = 1
SAPGPARAM_FAILED = 2
BUILD_DIRECTORY_FAILED = 3
NO_AUTHORIZATION = 4
READ_DIRECTORY_FAILED = 5
TOO_MANY_READ_ERRORS = 6
EMPTY_DIRECTORY_LIST = 7
OTHERS = 8.
IF SY-SUBRC EQ 0.
LOOP AT DLIST.
CALL FUNCTION 'EPS_GET_FILE_ATTRIBUTES'
EXPORTING
FILE_NAME = DLIST-NAME
DIR_NAME = DPATH IMPORTING
FILE_SIZE = FATTR-FILE_SIZE
FILE_OWNER = FATTR-FILE_OWNER
FILE_MODE = FATTR-FILE_MODE
FILE_TYPE = FATTR-FILE_TYPE
FILE_MTIME = FATTR-FILE_MTIME.
FATTR-FILE_NAME = DLIST-NAME.
APPEND FATTR.
ENDLOOP.
ENDIF.
SORT FATTR BY FILE_NAME.
LOOP AT FATTR.
POINT_IN_TIME = FATTR-FILE_MTIME.
CALL FUNCTION 'POINT_IN_TIME_CONVERT'
EXPORTING
POINT_IN_TIME = POINT_IN_TIME
IMPORTING
DATE = MDATE
TIME = MTIME
EXCEPTIONS OTHERS = 1.
SUBTRACT DAYS1980 FROM MDATE.
WRITE: / FATTR-FILE_NAME, FATTR-FILE_SIZE, MDATE, MTIME.
ENDLOOP. -
File not exist in application server
Dear experts,
Can anybody told me that if file not exist into the application server then what will happen to open dataset statement?
it will show error or what?
regards,
sameek.Dear Sameek,
Please check in code if file is exist then proceed next statement otherwise should not proceed with next statement.
Best Regards
Arun Jaiswal -
How to check if file already exist in application server?
Hi there,
Does anyone know a quick way to check if a file has already exists in an application server?
Thanks in advance.
Cheers.Call the function PFL_CHECK_OS_FILE_EXISTENCE.
Best regards Jack
FUNCTION PFL_CHECK_OS_FILE_EXISTENCE.
""Lokale Schnittstelle:
*" IMPORTING
*" FULLY_QUALIFIED_FILENAME LIKE TPFHT-PFFILE
*" EXPORTING
*" FILE_EXISTS LIKE BTCH0000-CHAR1
OPEN DATASET FULLY_QUALIFIED_FILENAME FOR INPUT.
IF SY-SUBRC EQ 0.
FILE_EXISTS = 'X'.
CLOSE DATASET FULLY_QUALIFIED_FILENAME.
ELSE.
CLEAR FILE_EXISTS.
ENDIF.
ENDFUNCTION. -
At what path .tns exists in Application Server in UNIX machine for 10G ds
Hi
I am working on 10g developer suit.
Could you please tell me where the .tns file exists in the AS (application server)
I am having AS installed in UNIX machine .
thanksTried here?
$<YOUR_AS_HOME>/network/admin
There you can find tnsnames.ora
-Arun -
How can I change the log file path instead of storing log in server.log
Hi,
I have created one domain and modified the attribute "log-file" in element "virtual-server" element to point to the new log file path.
But when I start up my domain, it still saying: "Log redirected to DOMAIN_LOCATION/logs/server.log.
Why?
Why it doesn't log to the file I specify? How can I change it?
Thanks.
KenI have changed the logging option to my specific path in admin console as what you said. I have also changed the logging in domains attribute too.
But still there is some logging info in domains/<dom_name>/logs/server.log instead of the path and file I specified.
Is it possbily related to linux user role setting? the Sunone AS is installed and configured by root user. But the domain is created for another user, hence I want to forward all logging info to that user's home path. -
How to retrieve various file names from a filepath of application server
Hi All,
I am using a FILEPATH of application server which can have multiple file names i want to retrieve data from all the existing files.
i am using FM "GET_NAME_FILE" but it is applicable only for file name.
so my question is how to fetch various file names of particular filepath.
Thanks in advance.Hello Mayank,
You can use the below FM and code
PARAMETERS: p_file TYPE rlgrap-filename.
***AT Selection-Screen*******
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
***Function module for F4 help from Application server
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
* EXPORTING
* DIRECTORY = ' '
* FILEMASK = ' '
IMPORTING
serverfile = p_file
EXCEPTIONS
canceled_by_user = 1
OTHERS = 2
IF sy-subrc = 0.
MESSAGE 'Successful' type 'I'.
ENDIF.
Regards,
Mithun Shetty -
Creating a directory & subdirectory on Application Server
I want to create a directory on Application Server which may contain many subdirectories where in i will upload my files from my ABAP Program.
I need to know if dynamic creation of a directory on Application Server is possible though ABAP.
I donot want to create it manually but dynamically depending on the type of file to be put in the directory.If you use the complete path, this actually works. I have tested it in my system. It may not work in background though. I'm on an AS400, so the path is a little different
call function 'GUI_CREATE_DIRECTORY'
exporting
dirname = '//<ip_address>/qfilesvr400/<host>/usr/sap/TST/SYS/Folder1'
exceptions
failed = 1
others = 2.
Regards,
Rich Heilman
Maybe you are looking for
-
Help me choose a new Mac! PLEASE....
I switched to the Macintosh back on Jan. 2nd, 2005 with the original iMac G5. Then I moved to Mac OS X Tiger when it came out and have been obsessed with the Mac operating system ever since. I am one of those people who run Quicksilver and have 15 ic
-
How do I get from an HD sequence in Final Cut Pro to a regular DVD?
Hi, I'm finishing my first HD project, and I'm trying to get it onto a normal DVD, and I can't figure out how I should export it out of Final Cut and what settings I should use in DVD studio pro. I need the dvd to play on normal, couple year old dvd
-
SolMan 7.1 Java for ABAP Stack ?
Hello Witch JVM for SAP Solution manager 7.1 OS: Linux x86_64 DB: MAxDB SAP JVM for Diagnostic agent PAM provide SAP JVM or IBM JAVA for Java stack, but for ABAP ? Regards Eric
-
Error message B1 071 when creating IDOC ?
HI experts, I have got a problem when i try to send the vendor master data using BD14 as below : To add new segment I have created the new extension : ZCREMAS .(WE30) =_ copied from the CREMAS04 .the i add new segment ZNEWSEG to this extension . Th
-
Difference between a programe&function module in R/3 & BW
Hi Gurus i would like to know differenece between programe and function module in R/3 and BW, so can some one give me a brief idea about it cheers thanks .....