Working with File Properties on the Application Server
Hi,
I am looking for a way to get the size of a file existing in a directory in the application server without reading it.
Is there a function module or a static method that returns a file properties exists in the application server?
Thanks,
Eyal.
hi Eyal,
fm <b>EPS_GET_FILE_ATTRIBUTES </b>
regards Andreas
Similar Messages
-
How to send the file contents in the application server to ftp server
Hi,
how to send the file contents in the application server to ftp server.
regards,
sreeTest SAP FTP functions
DATA: BEGIN OF MTAB_DATA OCCURS 0,
LINE(132) TYPE C,
END OF MTAB_DATA.
DATA: MC_PASSWORD(20) TYPE C,
MI_KEY TYPE I VALUE 26101957,
MI_PWD_LEN TYPE I,
MI_HANDLE TYPE I.
START-OF-SELECTION.
MC_PASSWORD = 'password'.
DESCRIBE FIELD MC_PASSWORD LENGTH MI_PWD_LEN.
*-- FTP_CONNECT requires an encrypted password to work
CALL 'AB_RFC_X_SCRAMBLE_STRING'
ID 'SOURCE' FIELD MC_PASSWORD ID 'KEY' FIELD MI_KEY
ID 'SCR' FIELD 'X' ID 'DESTINATION' FIELD MC_PASSWORD
ID 'DSTLEN' FIELD MI_PWD_LEN.
CALL FUNCTION 'FTP_CONNECT'
EXPORTING
USER = 'userid'
PASSWORD = MC_PASSWORD
HOST = 'servername'
RFC_DESTINATION = 'SAPFTP'
IMPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
NOT_CONNECTED = 1
OTHERS = 2.
CHECK SY-SUBRC = 0.
CALL FUNCTION 'FTP_COMMAND'
EXPORTING
HANDLE = MI_HANDLE
COMMAND = 'dir'
TABLES
DATA = MTAB_DATA
EXCEPTIONS
TCPIP_ERROR = 1
COMMAND_ERROR = 2
DATA_ERROR = 3
OTHERS = 4.
IF SY-SUBRC = 0.
LOOP AT MTAB_DATA.
WRITE: / MTAB_DATA.
ENDLOOP.
ELSE.
do some error checking.
ENDIF.
CALL FUNCTION 'FTP_DISCONNECT'
EXPORTING
HANDLE = MI_HANDLE
EXCEPTIONS
OTHERS = 1.
Execute external commands (FTP Scripts)
The following code shows the syntax of the FM 'SXPG_COMMAND_EXECUTE'. You pass it the external command created within transaction SM69 and it will execute it.
DATA: ld_comline
LIKE sxpgcolist-name,
ld_param LIKE sxpgcolist-parameters,
ld_status LIKE extcmdexex-status,
ld_output LIKE btcxpm OCCURS 0 WITH HEADER LINE,
ld_subrc LIKE sy-subrc.
REFRESH ld_output.
MOVE 'FTP_DATA_IN' to ld_comline. "Maintained using trans SM69
Execute external command, contained in 'ld_comline'
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = ld_comline
additional_parameters = ld_param "Params passed to script
operatingsystem
= 'UNIX'
IMPORTING
status = ld_status
TABLES
exec_protocol = ld_output
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
wrong_asynchronous_parameters = 12
cant_enq_tbtco_entry
= 13
jobcount_generation_error
= 14
OTHERS
= 15.
IF sy-subrc NE 0.
ENDIF. -
To upload excel file directly to the application server using OLE concept
hi experts
i have done a coding in OLE to download excel with graph to presentation server, is it possible to upload excel with graph directly to the application server , the excel should have graph while downloading to presentation server fom app server.
Moderator message - duplicate post locked
Edited by: Rob Burbank on Jun 25, 2009 9:49 AMHI,
have a look at tcode cg3z and then FM 'C13Z_FILE_UPLOAD_ASCII'.
What you can do is, first create the file on presentation server using OLE automation, and then using this FM, write the file to Application server -
Regarding the File Format on the application server
Hi,
I would like to know the file format (ANSI, UTF-8, UTF-16, UTF-32) of the file placed on the application server in my program. Can anyone help me with the Function Module or Class or any other way which will retrieve this information.
Thanks
Sarves S V KHi
You can try the standard class CL_ABAP_FILE_UTILITIES and the method
CALL METHOD cl_abap_file_utilities=>check_utf8
EXPORTING
file_name = filename
IMPORTING
bom = file_bom
encoding = file_encoding.
Check the possible values returned by encoding and BOM:
NO_BOM
BOM_UTF8
BOM_UTF16_BE
BOM_UTF16_LE
ENCODING_UTF8
ENCODING_7BIT_ASCII
ENCODING_OTHER -
F4 help for file path in the Application server
Hi All,
i want to provide the F4 help so as to enable us to give the file path in the application server (AL11). I'm in version 4.0
Regards
ShekharHi
Copy paste the following code and see the result
Here you can see 2 types of open dialogs
1. Directory View
2. File View
Use any one as per your requirement.
DATA : l_filetable TYPE filetable,
l_rc TYPE i.
DATA: l_folder TYPE string,
l_file TYPE string.
PARAMETERS: p_folder(100) TYPE c,
p_file(100) TYPE c.
*Provide a Dialogue box for getting a folder path
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_folder.
CALL METHOD cl_gui_frontend_services=>directory_browse
EXPORTING
window_title = 'Select Folder Path'
initial_folder = 'D:\'
CHANGING
selected_folder = l_folder.
p_folder = l_folder.
*Provide a Dialogue box for getting a file path
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
EXPORTING
window_title = 'Select a Text File'
initial_directory = l_folder
CHANGING
file_table = l_filetable
rc = l_rc.
Reward points generously
Regards
Akshay Chonkar
READ TABLE l_filetable INTO p_file INDEX 1.
CHECK sy-subrc <> 0. -
FIle Creation in the Application Server With Unicode-8 and Byte-Order Mark
Hi Guys,
I've requirement of creating a file in the Application server with the Data.
The Data Format Should be in UTF-8 and Byte-Order Mark.
I need to supply this data from SAP to PRMS.
I'm able to create a file with Unicode, but any of the guys have worked on Umicode with Byte-Order Mark, please let me know.
Thanks,
Adi.Hi Mathieu,
If you haven't found an aswer yet, you can check in transaction SE24 CL_ABAP_FILE_UTILITIES method CREATE_UTF8_FILE_WITH_BOM. You can check the code of the method (it's very short) so you can understand how it works. It's also a static method so you can call it directly in your program.
Ex:
CALL METHOD cl_abap_file_utilities=>create_utf8_file_with_bom(your_file_name).
I hope this helps.
Pax Vobiscum.
~ Eric -
How to work with files in folders on Application/Presentation Server
Hi,
I am working on interface program in which files are populated in folders in application/presentation server in the format 'ABCsy-datumsy-uzeit.txt'(e.g.ABC20051022161450.txt,ABC20051022161455.txt ) in directory c:\temp.
I want to sort all these files and read in sorted manner.
can anybody help me out in this.
waiting for reply.
thanks & regards,
NitinHi,
This logic will work for files on presentation server,
DATA: l_count TYPE i,
l_filename TYPE string,
t_files TYPE string OCCURS 0 WITH HEADER LINE,
BEGIN OF t_files_sorted OCCURS 0,
file_prefix(3),
file_date LIKE sy-datum,
file_time LIKE sy-uzeit,
file_extension(4),
END OF t_files_sorted,
t_text TYPE TABLE OF w3html.
CALL METHOD cl_gui_frontend_services=>directory_list_files
EXPORTING
directory = 'C:\Temp'
FILTER = '*.txt'
files_only = 'X'
DIRECTORIES_ONLY =
CHANGING
file_table = t_files[]
count = l_count
EXCEPTIONS
cntl_error = 1
directory_list_files_failed = 2
wrong_parameter = 3
error_no_gui = 4
OTHERS = 5.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT t_files.
t_files_sorted = t_files.
APPEND t_files_sorted.
ENDLOOP.
SORT t_files_sorted BY file_date file_time.
LOOP AT t_files_sorted.
CONCATENATE 'C:\Temp\' t_files_sorted INTO l_filename.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_filename
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = SPACE
HEADER_LENGTH = 0
IMPORTING
FILELENGTH =
HEADER =
changing
data_tab = t_text[]
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.
*****Your processing here..
ENDLOOP.
Also, use the FM that MAX has if you have to work with files on application server by replacing code in the above logic at appropriate places, like replace
cl_gui_frontend_services=>directory_list_files
with the corresponding fm
and replace cl_gui_frontend_services=>gui_upload
with OPEN DATASET...
CLOSE DATASET...
logic.
Hope this helps..
Sri
Message was edited by: Srikanth Pinnamaneni -
How to delete the record in the file present in the application server?
Hi,
I have two questions.
i) How can I delete a record based on some condition in the recordx in the file that is present in the application server?
ii) How can I lock the users whiel one user is accessing the file on the application server?
Thanks in advance.
SuvanHi,
If u want a frequent deletion this approach to delete a record from a file will havee unnecesary copy of records from one file to another and deletion of one file and renaming activities.
Instead what u can do is Add and field del_flag to ur record structure.
If u want to delete the record from a file just mark this del_flag as 'X'.
While processing u can have a loop like
loop at it_XXX where del_flag <> 'X'.
endloop.
This will logically delete the record.
When u r to finish the application at that time only perform this copying / deleting / and renaing activity
Hope this helps.
Cheers,
Nitin -
Copying dependent files, Where is the application server icon?!?
I have looked at the Dreamweaver help sites and I cannot figure out where the application server icon is! I am currently running CS3 on a mac thats running OSX 10.4, and I'm trying to upload my site from a different computer than I originally had the files. First I expand my files window in the window>files menu. But then I have no idea where the 'application server icon' is which is supposed to re-link all my dependent files I think? Please, anyone can you give me the co-ordinates of this icon?? I will love you forever!
-Thanks,
Dylan
feel free to contact me at [email protected]!Sounds to me like they are talking about the Connect to Server Icon,
-
Urgent--custom servlet not working with https/gateway of the portal server
We have created the custom servlet to add some more authentication to the login screen. I have explained detaildely below.
We have set if password reset change password screen should come by using identity server.
First screen comes which asks �user id� and �password�.
after this next screen comes with �old password�, �New Password� and �Confirm Password� (as we have forcefully asked user to change password after reset by using identity server ).
On this page we have added two new filed �Date of Birth� and �Date of Joining�.
And we are forcefully transferring request to our Custom Servlet which will validate the �Date of Birth� and �Date of Joining� from the database and submit the same a form as required by Login Servlet to validate the default parameters �old Password�, �New Password� and �Confirm Password� (which is the default validation without adding custom Servlet).
This whole process is working with �http� protocol and giving �unable to connect� host with �https� protocol.
Without custom Servlet process is like this, which is working
Login (usrid, password) � Login (Old Password, New Password, Confirm Password) � Portal home Page
With custom Servlet , Which is not working with �https� Protocol. we are getting the message "Authentication Failed" screen.
Login (usrid, password) --> Login (Old Password, New Password, Confirm Password , Date of Birth, Date of Joinig) --> Custom Servlet validate Date of Birth, Date of Joining --> Login (Old password, new Password, Confirm Password) --> Protal Home Page
This one works with http, whereas this one gives the "Authentication Failed" screen with the https.
Please let me know if anybody have implemented this and help me to resolve the issue.
Best Regards
RamkumarHi,
I am also getting this error message in the sun ONE webserver error log file....
[20/Nov/2004:13:42:39] failure ( 6162): for host 172.16.5.21 trying to GET /amserver/UI/Login, service-j2ee reports:
StandardWrapperValve[LoginServlet]: WEB2792: Servlet.service() for servlet LoginServlet threw exception
com.iplanet.jato.CompleteRequestException
at com.sun.identity.authentication.UI.AuthenticationServletBase.onUncaughtException(AuthenticationServletBase
.java:141)
at com.iplanet.jato.ApplicationServletBase.fireUncaughtException(ApplicationServletBase.java:1023)
at com.iplanet.jato.ApplicationServletBase.processRequest(ApplicationServletBase.java:469)
at com.iplanet.jato.ApplicationServletBase.doPost(ApplicationServletBase.java:324)
at com.iplanet.jato.ApplicationServletBase.doGet(ApplicationServletBase.java:294)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:787)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:908)
at org.apache.catalina.core.StandardWrapperValve.invokeServletService(StandardWrapperValve.java:771)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:322)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:212)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:209)
at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:509)
at com.iplanet.ias.web.connector.nsapi.NSAPIProcessor.process(NSAPIProcessor.java:161)
at com.iplanet.ias.web.WebContainer.service(WebContainer.java:586)
Regards
Ramkumar R -
Installing Demantra 7.2.0.2 with IBM Websphere as the application server
Can anybody share the documentation / insight into installing Demantra 7.2.0.2 using IBM Websphere 6.1 (OS-Windows) ?
Can we install the Demantra on the same machine on which Websphere is installed or we need another box.
Which steps we need to follow ? Any setting on the Websphere for this ?
Suppose Websphere is installed on http://webmac.xxx.com (machine name) - is this the web address we need to specify even if we are installing on the same machine.
Thx for your help.
PankajHi Pankaj,
If the other users are on the same network as the machine on which Tomcat is running, they can access demantra web applications directly. Only measure to be taken is that the url should contain either IP address or the network m/c name of the server machine alongwith the port no.
e.g.
http://10.32.142.123:8080/....
http://mymachine:8080/....
If the other users are on some different network and wanted to access Demantra web applications through Internet, then you will have to ask your networking team to open the port no (e.g. 8080) of the Tomcat server machine through the firewall of your environment. This will allow the users outside of your environment to access the application running on your specific machine through the specific port only.
And the users who want to access these applications might also have to put host entries as suggested by Shekhar depending on the internet access policies of their organization.
Milind... -
Process Chain to do nothing if file does not exist in the application serve
Hi All,
We have a process chain that flows to different data targets daily if files delivered in the application server.
Process chain does works fine. But my question is do we have anyway to stop the process chain or do not run process chain if it does not find the file available any days during this time range instead of failing.*
Is there any settings to enable the check if file available then run or else do not run at all. Please help!!!
Thanks,Follow the function modules listed in :
http://wiki.sdn.sap.com/wiki/display/ABAP/Workingwithfiles
with these function modules - you can get a list of files available in the application server directory.
Pseudo code :
1. Generate the automated fiel name you want
2. Get the list of files in the directory
3. Search the list of files to see if your file exists
4. If the file exists then load the file , else load an empty file .
The code is unfortunately in a different BW system that I do not have access to at this moment... but then the procedre is the same as detailed above. -
Function Module to find the Path of the file in the Application Server
Hi All,
Any function module available to find the path of the file stored in the application server. Please let me know.
Thanks.Check this code:
DATA: dl_file TYPE ibipparms-path. " File name
CONSTANTS: c_dir TYPE rlgrap-filename.
* F4 filename for Application server
CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
EXPORTING
directory = c_dir
filemask = ' '
IMPORTING
serverfile = dl_file
EXCEPTIONS
canceled_by_user = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE e000 WITH 'Error while getting the file name'(006).
EXIT.
ELSE.
p_file = dl_file.
ENDIF.
Thanks & Regards,
Siri.
Message was edited by:
Srilatha T -
Printing files on the application server
Hi,
I am looking for ways to print files residing on the application server. Do you know of any function modules/transaction code that can do this?
Here is my situation:
I am using GRAPH_PRINT_POSTSCRIPT_FILE to print postscript file to the printer. I have no problem using this FM. The issue is that this function only prints files residing on the PC/local computer. It doesn't print any files on the application server.
Thanks in advance for any help you can provide.Hi,
use
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = 'P_FNAME'
dyname = 'ZFILE_HELP'
dynumb = sy-dynnr
filetype = 'P'
location = 'A'.
Thanks,
NN. -
Moving of flat file from the application server after upload.
Hi All,
I am uploading data from a flat file placed on the application server by a BDC program.
After the BDC has created the session i want to transfer the flat file from that folder to another folder on the application server by changing the name of the flatfile.
Can any one suggest the best way of doing this particular scenario?
Thanks in advance.
Regards
Satish Nair.Here is a sample program.
report zrich_0001.
data: d1 type localfile value '/usr/sap/TST/SYS/Data1.txt',
d2 type localfile value '/usr/sap/TST/SYS/Data2.txt'.
data: begin of itab occurs 0,
rec(20) type c,
end of itab.
data: wa(20) type c.
start-of-selection.
open dataset d1 for input in text mode.
if sy-subrc = 0.
do.
read dataset d1 into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset d1.
open dataset d2 for output in text mode.
loop at itab.
transfer itab to d2.
endloop.
close dataset d2.
delete dataset d1.
Regards,
Rich Heilman
Maybe you are looking for
-
Sleep mode LaserJet Pro 200 color MFP M276nw
Hello, My LaserJet Pro 200 color MFP M276nw seems to have gotten into some sort of "sleep" mode:When I send something to the printer, it no longer prints, until I touch the LCD screen which seems to "wake it up," at which point it prints the document
-
Idoc(receiver) message splitting using BPM
Hi, could you provide some blogs which is useful for Idoc (as a Receiver) message splitting (1:N scenario) using BPM. I have gone thru some of the Blogs, i didn't find good one according to this scenario. Thanks Praba
-
Correct and re-send the error messages in PI
Hi everyone, Today when iam monitoring my PI i found error like some objects missing in the que, I toublshooted it by using inbount xml payload and found the error and cunsulted the user he asked me to correct and re-send the error messages. as iam r
-
C:import, c:param
Hi All, I'm trying the following: <c:import url="header.jsp"> <c:param name="test" value="hello" /> </c:import> and trying to output the param value in header.jsp but it displays nothing. Help is greatly appreciated. Thanks, Greeshma.
-
Tweaking FM_Outputs_Conditional_Text.jsx
I found what sees like a bug in C:\Program Files (x86)\Adobe\AdobeFrameMaker10\Samples\ScriptsAndUtilities\Conditional Text\FM_Outputs_Conditional_Text.jsx. The script produces two PDFs, which I expected to be named <book_name>_Comment_Red.pdf and <b