All files in folder of Application server.
Hi Frnds,
how to get the all files from a folder of application server. I have to get the all files in internal table when i selecting only folder?
thanks in advance.
regards,
Balu
Here is an example program, which acts like an application server file browser.
report zrich_0001 .
data: begin of itab occurs 0,
rec(1000) type c,
end of itab.
data: wa(1000) type c.
data: p_file type localfile.
data: ifile type table of salfldir with header line.
parameters: p_path type salfile-longname
default '/usr/sap/TST/DVEBMGS01/data/'.
call function 'RZL_READ_DIR_LOCAL'
exporting
name = p_path
tables
file_tbl = ifile
exceptions
argument_error = 1
not_found = 2
others = 3.
loop at ifile.
format hotspot on.
write:/ ifile-name.
hide ifile-name.
format hotspot off.
endloop.
at line-selection.
concatenate p_path ifile-name into p_file.
clear itab. refresh itab.
open dataset p_file for input in text mode.
if sy-subrc = 0.
do.
read dataset p_file into wa.
if sy-subrc <> 0.
exit.
endif.
itab-rec = wa.
append itab.
enddo.
endif.
close dataset p_file.
loop at itab.
write:/ itab.
endloop.
Regards,
Rich Heilman
Similar Messages
-
How to read list of all files in folder on application server?
How to read list of all files in folder on application server?
Hi,
First get the files in application server using the following function module.
CALL FUNCTION 'RZL_READ_DIR_LOCAL'
EXPORTING
name = loc_fdir
TABLES
file_tbl = int_filedir.
Here loc_fdir contains the application server path.
int_filedir contains all the file names in that particular path.
Now loop at int_filedir.
OPEN DATASET int_filedir-name FOR INPUT IN TEXT MODE ENCODING DEFAULT MESSAGE wf_mess.
MESSAGE wf_mess.
IF sy-subrc = 0.
DO.
READ DATASET pa_sfile INTO wf_string.
IF sy-subrc <> 0.
EXIT.
endif.
close datset int_filedir-name.
endloop. -
Download all files from a specific application server directory to Local pc
Hi Experts,
I have a requirement of downloading all the files from an application server directory to a local pc.
I know how to download a single file from an application server at a time provided the file name is known.
But my requirement is to download all the files in that particulary directory, because I dont know how many files were created in that directory and what are their names.
Please kindly provide the solution.
Thanks,
Kalikonda.Nelson,
Here is the function module that I have used to get all the application server files.
appl_dir_name is the path of the directory i.e. '/outbound/PD1/Applnserverfiles/'
it_appl_srv_fls is the internal table where all the files gets stored in.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = appl_dir_name
FILE_MASK = ' '
IMPORTING
DIR_NAME =
FILE_COUNTER =
ERROR_COUNTER =
TABLES
dir_list = it_appl_srv_fls
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 <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
hope this solves your problem.
Thanks,
kalikonda. -
Moving files across folder in application server
Hi to all experts,
My requirement is to move file between folders in the application server .i'm using the fm sxpg_command_execute . the problem im facing here the file move sometimes and it doesnt move sometimes . what could be the problem..
*& Form process_file_on_server
form process_file_on_server .
DATA: filename(128) TYPE c.
DATA: param LIKE sxpgcolist-parameters.
CASE sy-sysid.
WHEN 'BO1'.
p_arc = 'k:\\Share\MM_SCUBCode_PDAtxt_Archive'.
WHEN 'BQ1'.
p_arc = 'K:\\Share\MM_SCUBCode_PDAtxt_Archive'.
WHEN OTHERS.
ENDCASE.
CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = p_file
IMPORTING
STRIPPED_NAME = filename
* FILE_PATH =
EXCEPTIONS
X_ERROR = 1
OTHERS = 2
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CONCATENATE p_arc filename INTO p_arc SEPARATED BY '\'.
CONCATENATE p_file p_arc INTO param SEPARATED BY space.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZMOVE'
ADDITIONAL_PARAMETERS = param
* OPERATINGSYSTEM = SY-OPSYS
* TARGETSYSTEM = SY-HOST
* DESTINATION =
* STDOUT = 'X'
* STDERR = 'X'
* TERMINATIONWAIT = 'X'
* TRACE =
* DIALOG =
* IMPORTING
* STATUS =
* EXITCODE =
* TABLES
* EXEC_PROTOCOL =
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 <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
clear filename .
endform. " process_file_on_serverHi,
PLEASE try this code ---
*& Form process_file_on_server
*form process_file_on_server .
DATA: filename(128) TYPE c.
DATA: param LIKE sxpgcolist-parameters.
CASE sy-sysid.
WHEN 'BO1'.
p_arc = 'k:\\Share\MM_SCUBCode_PDAtxt_Archive'.
WHEN 'BQ1'.
p_arc = 'K:\\Share\MM_SCUBCode_PDAtxt_Archive'.
WHEN OTHERS.
ENDCASE. " CASE SY-SYSID
DO. " Changed
CALL FUNCTION 'SO_SPLIT_FILE_AND_PATH'
EXPORTING
full_name = p_file
IMPORTING
STRIPPED_NAME = filename
* FILE_PATH =
EXCEPTIONS
X_ERROR = 1
OTHERS = 2
IF sy-subrc NE 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF. " IF SY-SUBRC NE 0
CONCATENATE p_arc filename INTO p_arc SEPARATED BY '\'.
CONCATENATE p_file p_arc INTO param SEPARATED BY space.
CALL FUNCTION 'SXPG_COMMAND_EXECUTE'
EXPORTING
commandname = 'ZMOVE'
ADDITIONAL_PARAMETERS = param
* OPERATINGSYSTEM = SY-OPSYS
* TARGETSYSTEM = SY-HOST
* DESTINATION =
* STDOUT = 'X'
* STDERR = 'X'
* TERMINATIONWAIT = 'X'
* TRACE =
* DIALOG =
* IMPORTING
* STATUS =
* EXITCODE =
* TABLES
* EXEC_PROTOCOL =
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 = 0. " CHANGE
STOP. " CHANGE
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
clear filename .
endform. " process_file_on_server
ENDDO. " CHANGE
Regards
Pinaki -
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. -
To create folder in Application server
hi,
How to create folder in application server from presentation server??
how is the program it??
reply me soon...
thx,
s.suresh.hi Suresh
Hope u r having nice day
here i am sending a sample report which can upload the file to Application Server which inturn automatically create folder .
REPORT ZSHR_UPLOAD_TO_APPLICATION .
DATA : BEGIN OF IT_MAT OCCURS 0,
MBRSH LIKE MARA-MBRSH,
MTART LIKE MARA-MTART,
MAKTX LIKE MAKT-MAKTX,
MEINS LIKE MARA-MEINS,
END OF IT_MAT.
DATA : W_DIR(40).
MOVE 'D:\usr\sap\DEV\DVEBMGS00\work\SHR' TO W_DIR.
"SHR" IS A FOLDER NAME TO BE CREATED
START-OF-SELECTION.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\MAT.TXT'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = 'X'
TABLES
DATA_TAB = IT_MAT
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.
OPEN DATASET W_DIR FOR OUTPUT IN TEXT MODE ENCODING UTF-8.
IF SY-SUBRC EQ 0.
LOOP AT IT_MAT.
TRANSFER IT_MAT TO W_DIR.
ENDLOOP.
ENDIF.
CLOSE DATASET W_DIR.
IF USEFUL AWARD POINTS.
REGARDS
HEMASEKHARA REDDY S -
How to store a JSP file in the SAP Application server ?
Hello All,
My reqt. is as follows :
1. I need to store a JSP File on the SAP Application server .
How can I do this ?
2. I want to call the uploaded jsp file from the server and call this jsp from abap to view the result of it .
How can I achieve this ?
First of all is this possible ?
Regards,
Deepu.KHello Mike,
Thanks for ur reply.
I've imported the JSP as a mime object into the BSP.
Now I've created the page to show that Mime Object as an image.
But nothing is coming as an output.
But then,there is an option for that mime object. i.e when I right click on the mime object there is an option called " convert to BSP".
I selected that option and it created a view in my BSP .( My BSP is a page with flow logic application )
Now how should i make this view to be an output ?
I guess this shud be posted in the BSP Forum ...but still taking a chance here :)-
Regards,
Deepu.K -
How to trigger a Report when a file is placed in Application server
Hi All,
How to triggger a Report and get executed when a new file is placed in the application server.?
It will be helpful if a Navigation is provided for the EVENT.
Thanks in advance
ChakriHi,
Check what is the frequency of the file coming to the application server.
Schedule your program in SM36 giving data and time make it periodic . select the check box Periodic Job
and then select the period values and give the period values as per the frequency of the file coming to app server.
Thanks,
Harini -
Upload a file to portal--- BW application server.
Dear All,
I have requirement where some part of business does not have SAP installed. But we would like to extract data from these business too.
So just wanted to know if we can have a scenario where user will upload the data to the portal (this is just a web portal). Can this be done?
Secondly, if the can be done, can we extract the file from portal to application server? From application then it becomes very simple to upload to data targets in BW.
Please help in this regard.
Thanks,
SandeepAssign an ID (e.g. 1234) to the uploaded file. You should abstract the store
so that it will work on the file system or in the database.
The JSP will include an image ref to that ID, e.g.
http://www.myco.com/myapp/imageservlet?id=1234
The image servlet will retrieve and stream the image. It has to set content
type etc. You should also verify that the current user has access to the
requested image if security/privacy is an issue.
Peace,
Cameron Purdy
Tangosol, Inc.
http://www.tangosol.com/coherence.jsp
Tangosol Coherence: Clustered Replicated Cache for Weblogic
"newsgroups.bea.com" <[email protected]> wrote in message
news:3daadaa5$[email protected]..
Imp struggling to find a way of uploading an image file from the browserto
the app server (wl 6.1), where the uploaded image will to be included as
part of a JSP file.
** Note
- this part of Managed Cluster, the uploaded directory is NFS mounted
between the managed servers
- we deploy using EAR's from the admin server.
I am able to upload but, cant get the uploaded image to display as partof
a JSP,
Our 5.1 WL server work perfectly using a standard exploaded directory !
I have logged this as a call at BEA, but they have not been able to offerme
a solution yet.
Regards
Roland -
How to zip the folder in application server?
how to zip the folder in application server?
You can use
open dataset with filter
link:[http://help.sap.com/abapdocu_70/en/ABAPOPEN_DATASET_OS_ADDITION.htm#!ABAP_ADDITION_2@2@] -
Hello!
Here's the question with explaniation: How can i format the USB or Drive by clicking a button what's meant for it?
and the second question what's also in vb.net: How can i remove all files from folder ?
Here's the Look of program: *
Using the PC button, it will delete the free space of the PC, do you guys/girls know where it's location?Example Code:
Imports System.Runtime.InteropServices
Imports System.IO
Public Class Form1
Dim CBoxDrives As New ComboBox
WithEvents FButton As New Button
<DllImport("shell32.dll")> _
Private Shared Function SHFormatDrive(ByVal hwnd As IntPtr, ByVal drive As UInteger, _
ByVal fmtID As UInteger, ByVal options As UInteger) As ULong
End Function
Private Enum SHFormatFlags As Integer
SHFMT_ID_DEFAULT = &HFFFF
SHFMT_OPT_FULL = &H1
SHFMT_OPT_SYSONLY = &H2
SHFMT_ERROR = &HFFFFFFFF
SHFMT_CANCEL = &HFFFFFFFE
SHFMT_NOFORMAT = &HFFFFFFD
SHFD_FORMAT_FULL = 0 ' full format
SHFD_FORMAT_QUICK = 1 ' quick format
End Enum
Private Sub FButton_Click_1(sender As System.Object, e As System.EventArgs) Handles FButton.Click
If CBoxDrives.Text = "" Then
MsgBox("No Drive Selected")
Exit Sub
End If
Dim Iresult As ULong = SHFormatDrive(CType(Me.Handle.ToInt32, IntPtr), CUInt(Asc(CBoxDrives.Text.Substring(0, 1)) - Asc("A")), CUInt(SHFormatFlags.SHFMT_ID_DEFAULT), 1)
End Sub
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
Me.Size = New Size(200, 100)
With FButton
.Size = New Size(50, 25)
.Location = New Point(5, 5)
.Text = "Format"
End With
Me.Controls.Add(FButton)
With CBoxDrives
.Size = New Size(50, 25)
.Location = New Point(75, 5)
.DropDownStyle = ComboBoxStyle.DropDown
End With
Me.Controls.Add(CBoxDrives)
Dim DrivesFound As Integer = 0
Dim allDrives() As DriveInfo = DriveInfo.GetDrives()
Dim d As DriveInfo
For Each d In allDrives
If ((d.DriveType = DriveType.Fixed) Or (d.DriveType = DriveType.Removable)) AndAlso Environment.GetEnvironmentVariable("SYSTEMROOT").StartsWith(d.Name) = False Then
CBoxDrives.Items.Add(d.Name)
DrivesFound += 1
End If
Next
CBoxDrives.SelectedIndex = DrivesFound - 1
End Sub
End Class -
Reading the data from excel file which is in application server.
Hi,
Iam trying to read the data from excel file which is in application server.
I tried using the function module ALSM_EXCEL_TO_INTERNAL_TABLE. But it didn't work.
I tried just reading using open data set and read data set it is giving junk characters.
Please suggest me if you have any solution.
Best Regards,
Brahma ReddyHi Narendra,
Please see the below code I have written
OPEN DATASET pa_sfile for INPUT in text mode ENCODING DEFAULT MESSAGE wf_mess.
CHECK sy-subrc = 0.
DO.
READ DATASET pa_sfile INTO wf_string.
IF sy-subrc <> 0.
EXIT.
else.
split wf_string at wl_# into wf_field1 wf_field2 wa_upload-field3
wa_upload-field4 wa_upload-field5 wa_upload-field6 wa_upload-field7 wa_upload-field8
wa_upload-field9 wa_upload-field10 wa_upload-field11 wa_upload-field12 wa_upload-field13
wa_upload-field14 wa_upload-field15 wa_upload-field16 wa_upload-field17 wa_upload-field18
wa_upload-field19 wa_upload-field20 wa_upload-field21 wa_upload-field22 wa_upload-field23
wa_upload-field24 wa_upload-field25 wa_upload-field26 wa_upload-field27 wa_upload-field28
wa_upload-field29 wa_upload-field30 wa_upload-field31 wa_upload-field32 wa_upload-field33
wa_upload-field34 wa_upload-field35 wa_upload-field36 .
wa_upload-field1 = wf_field1.
wa_upload-field2 = wf_field2.
append wa_upload to int_upload.
clear wa_upload.
ENDIF.
ENDDO.
CLOSE DATASET pa_sfile.
Please note Iam using ECC5.0 and it is not allowing me to declare wl_# as x as in your code.
Also if Iam using text mode I should use extension encoding etc.( Where as not in your case).
Please suggest me any other way.
Thanks for your help,
Brahma Reddy -
Creating a folder in application server in background.
Hi experts,
Is it possible to Creating a folder in application server in background.?
My requirement is like this , every time a PO is created it has to be saved locally.
When atlast i manged to do this, i get stuck again by this CR ,
The PO has to be saved in a folder with the same name as PO number,
I do not know if it is possible.
So as always I am looking for inputs/suggestions or knowledge if you had come across scenario like this one.
Thanks and Regards,
KHi,
You could create a system command in SM69 to create a directory and then use the function module SXPG_CALL_SYSTEM to invoke the command and pass in the directory name as a parameter at run time.
Darren -
Files are stored in application server,
Files are stored in application server, I am using Open dataset to write to a file in unix box.would like to convert my itab into tab delimted and download. Please let know
is there any function?You should do a search to get the right ascii value (you can get an
ascii chart, you can google a bit, you can visit the group's page and
search for tab delimited... ) and replace 09 by the right value. And
that's it.. The technique (which is what it matters) is right.
Another tip:: you could download in two steps: first you use
gui_download or ws_download to create a tab delimited file in your pc or
in a network. Then you upload this file (using gui_upload or ws_upload
into an internal table and the final step is to use open dataset -
transfer - close dataset to write down this last itab to your app
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
Maybe you are looking for
-
I am running OS10 on a MAC and every time I go too another web site (most of the time) a new tool bar pops up that says " Firefox prevented this page from automatically redirecting to another page" and on the other end I must hit the button ALLOW bec
-
Can somebody please help me with this Panic Report?
Hi Guys, I am having a little difficulty deciphering these panic reports we keep getting from our Mac Pro here. They've been crashing our Mac ever since we got our Hasselblad Camera back from Hasselblad repair however after submitting logs to Hasselb
-
Problems with N97 after upgrade to v11 software
Hi, after upgrading to v11, I thought I found my N97 slower. For example, the time take from the click of the "New message" icon till the time the SMS message writing app is ready for input can sometimes take like 3 seconds. Does any have a similar e
-
Module Function Name Resolution - Issues with DefaultCommandPrefix
Just getting started on module development, running PS4, and I've run into an... inconsistency... that I'm trying to understand. I've got two test functions, Get-Something and Set-Something in a script module. In my manifest file I specify a DefaultC
-
hi frnds, while doing bpm scenarios splitting(1:2) and merging(2:1) messages, a) in splitting scenario integration process container, we use 3 abstract interfaces and 2 multiline receivers (using fork here) b) in merging scenario integration process