File extraction -File name is timestamped
Hi Team,
We are loading the data using flat file. The file will be stored in the application directory. we created a logical fiel name and it is used in the data source.
My problem is every day the file is uploaded to the applicaiton directory and the file name will be appended with time stamp
for example
file_01022011123445
file_02022011042015
I tried to handle this by creating an abap routine ,but i am unable to get the exact file name since the timestamp field is dyanamic.I even tried to read the file names from the applicaiton directory using following function modules
SUBST_GET_FILE_LIST
F4_DXFILENAME
FILE_GET_NAME
But it didnot worked. Any suggestion will be appreciated.
Thanks,
Jim
Edited by: Jim Jose on Feb 2, 2011 1:04 PM
Hi,
Your file naming convention seems to be "file_ddmmyyyyhhmmss". That means you already know the first 13 characters of the filename you need. ("file_" is constant, the next 8 characters come from sy-datum)
The FM SUBST_GET_FILE_LIST accepts wildcards, so you could give the FILENM parameter as *. It would give you the names of all the files in the directory. After that, it is a matter of ignoring all the files which do NOT begin with those 13 characters. If you have one file being created in the directory for every day, this should work
Regards,
Suhas
Similar Messages
-
How to incorporate File name and timestamp automatically into select and save file dialog box?
Hello,
i am trying to incorporate the file name which is inputed by the user along with the timestamp into the selected and save file dialog box. Can you help?
Thanks
Solved!
Go to Solution.You can pass a default file name to the 'File Dialog' Express VI.
Use the 'selected path' output to open the file.
Now is the right time to use %^<%Y-%m-%dT%H:%M:%S%3uZ>T
If you don't hate time zones, you're not a real programmer.
"You are what you don't automate"
Inplaceness is synonymous with insidiousness
Attachments:
FileDialog.vi 21 KB -
How to find ATL file name and timestamp of importing for existing DI code?
A tester is not sure about the version of the ATL code which was imported into his local repository. Is there anyway he can get the imported ATL file name and/or timestamp from the repository or a log file? I searched in both places but couldn't find any information. Did I miss something? This is DI 11.5.3.
Thanks,
LarryI don't think the information about the source of how the object was created in repo is maintained anywhere, like this version of object was created from ATL or from Designer etc
but different versions of objects are stored in AL_LANG and its language in AL_LANGTEXT table, if you have not compacted the repo, you may get the last modified time from AL_ATTR table, try getting the data from these table and see if you get any info that is useful for you -
Comparing incoming file name having timestamp with system time.
Hi,
The scenario is File to FIle.
i have to read the incoming file name which will be having time stamp.
compare the time stamp with the system time .
if the difference in time is within specified time then send the file to target location,else send a mail that file is not placed in target location.
please enlight me on how this scenario can be done.
Thanks,
Akkasali.if you mean the actual time stamp on the file and not the file name then ref: http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417300)ID2044216150DB12410233167314983393End?blog=/pub/wlg/15154
else if you mean the time stamp on the file name itself then use dynamic configuration and then read the file name and do the further processing - /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name -
Temp File Name Schema in Receiver File adapter
Hi,
I have a scenario where i have to write the file in the temperaory location before writing it to the FTP loacation, I have selected the Processing Parameter as "Use Temperory File" but when the file gets created it is padded with the Message Id, is thr any option to get the file name as the temp file name without the Message Id or timestamp.
Please let me know if any one has come across such scenario.
thankx,
shreeHi,
Under Write Mode, specify whether the target file is to be written directly in the specified directory. If an additional step is to be added using a temporary file, choose Use Temporary File.
You can specify a naming scheme for the temporary file under Temporary File Name Scheme.
This schema is used to determine the prefix and extension of the temporary file; to ensure a unique file name, a time stamp is also added to the name during processing.
The schema xitemp.tmp, for example, results in the file name xitemp<timestamp>.tmp
So you have to customise the file name in schema.
see below link
http://help.sap.com/saphelp_nw2004s/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm
Regards
Chilla -
How to add variables in the file name in Reciever CC?
Hi all ,
I am working on a outbound interface .
in the reciever communication channel i have to gve the file name as
S<plant code >.<file name>.<timestamp > >
example of filename: u201CS141. SPPFE860. 20110421114559u201D (The plant code has to be the same used in the field STABEMT presents in the header).
now in the structure it is like
MT
HEADER
STABMENT
i am using tht Avanced tab in CC but am not able to understand what to gve in reference.
Can you please help???heyy i could find the solution to it....so am closing the thread..thanksss
-
How to handle Dynamic File Name
Hello All,
I have a requirement, I have to download a file from application server to my ABAP program which will be executed in the background. The problem is the file name is a dynamic file name with timestamp on it. So how do I read the file from the application server. I know there are certain function modules but I don't think so that they can work in background.
So If anyone has worked on it before your reply would be helpful.
Thanks and Regards,
SushilHi,
Use this funcation module this will return you the list of files in a directory...
It will work even in back group processing also..
SUBST_GET_FILE_LIST
or if it is unix environ ment.
data: begin of t_tabl occurs 0,
line(132),
end of t_tabl,
data: lc_command(100) type c.
Get all the file name falling under specified directory...
lc_command(3) = 'ls '.
lc_command+3(45) = p_dir. " Directory of file path
call 'SYSTEM' id 'COMMAND' field lc_command
id 'TAB' field t_tabl-sys.
Check any files exits in the directory.......................
if t_tabl[] is initial.
message e006 with 'No files exist in the specified directory ' p_dir.
endif.
here you will have all the file names in t_tab1 you can sort by name and will get the latest file in order..
Thanks
Mahesh
Message was edited by:
I Can Solve It -
hi all
how do i set log file name with timestamp . say for example logfile_22_05_2008.log is there any option for this? anyone help me out of this. sorry if am crossposting my doubtyaniv1977 wrote:
Hi
I hava some servers that use log4j to log in shared folder.
i want that every server will create his own log file with his host name.
I'm using log4j.xml to configure the appender and I want to use variable to create dynamic file name.
Could it passible?
And what happens to your distributed enterprise system when that shared folder is not available? -
Dear Experts,
I need to read a file from the application server with the file name "static""timestamp".txt, where static is the static file name and timestamp would be added at the end of the file name. Please suggest me a way to read all such files one by one.
thanksHi
You need to scan the path in order to get all files stored and then to read it;
You can use the fm EPS_GET_DIRECTORY_LISTING in order to scan the directory:
DATA: dir_name LIKE epsf-epsdirnam,
file_mask LIKE epsf-epsfilnam.
DATA: filename TYPE string.
DATA: t_dir_list TYPE STANDARD TABLE OF epsfili WITH HEADER LINE.
dir_name = '<application path name>'.
file_mask = '<static>*.*'.
CALL FUNCTION 'EPS_GET_DIRECTORY_LISTING'
EXPORTING
dir_name = dir_name
file_mask = file_mask
TABLES
dir_list = t_dir_list
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.
ENDIF.
LOOP AT t_dir_list.
CONCATENATE dir_name '/' t_dir_list-name INTO filename.
OPEN DATASET filename FOR INPUT IN TEXT MODE ENCODING DEFAULT.
CLOSE DATASET filename.
ENDLOOP.
Max -
Changing the file name n Flat file Extraction
Hi,
Currently i am using flat file extraction for my forecast data and i am sending the file through application server.
I have created directory successfully and now everyday morning i receive a file thru FTP server with name 20060903.csv and this name is based on one field in my flat file data. ex. /interface/asf/20060903.csv
During mid off month we have cut off date, and this cut off date varies for each month. During this time file name changes in the FTP and a file with different name i.e 20061002.csv will be existing in the application server.
Now in the infopackage i also need to set the deletion settings like if the file name is same delete the previous requests. I could achieve this if i could get the file name changed.
Lets say if i am not chnaging the file name how do i set deletion condition, like it should not delete if the field(scenario) changes. ie from 20061002 to 20061101. I should have only one file for 20061002 and one file for 20061101 etc... If the scenario is same it should delete.
Any one kindly advise. Very urgent and critical.
Tks & regards,
Bhuvana.Hi Bhunva,
Try the following abap code in routine under External data tab in infopackage.
data: begin of i_req occurs 0,
rnr like RSICCONT-rnr,
end of i_req.
select * from RSICCONT UP TO 1 ROWS
where ICUBE = <datatargetname>
order by TIMESTAMP descending.
i_req-rnr = rsiccont-rnr .
append i_req.
clear i_req.
endselect.
loop at i_req.
select single * from RSSELDONE where RNR eq i_req-rnr and
filename = p_filename.
if sy-subrc = 0.
CALL FUNCTION 'RSSM_DELETE_REQUEST'
EXPORTING
REQUEST = i_req-rnr
INFOCUBE = <datatargetname>
EXCEPTIONS
REQUEST_NOT_IN_CUBE = 1
INFOCUBE_NOT_FOUND = 2
REQUEST_ALREADY_AGGREGATED = 3
REQUEST_ALREADY_COMDENSED = 4
NO_ENQUEUE_POSSIBLE = 5
OTHERS = 6.
IF SY-SUBRC <> 0.
MESSAGE ID sy-MSGID TYPE 'I' NUMBER sy-MSGNO
WITH sy-MSGV1 sy-MSGV2 sy-MSGV3 sy-MSGV4.
else.
message i799(rsm1) with i_req-rnr 'deleted'.
ENDIF.
endif.
let me know if you get any problem in this logic.
regards,
Raju -
Hello,
I am unsure if this is possible but its worth asking.
I have a PDF document that contains 56 pages.
Each page has an 'Agreement Number' at the top left.
I have managed to successfully extract the pages into separate documents (56 documents) but they are all named the same but page 1, page 2, page 3 etc..
What i am trying to do is use these 'agreement numbers' in the extraction process so when they save i have 56 different files but they show the agreement number in the file name.
i have looked into changing the actual page numbers on the page thumbnails to see if you can do it that was to no avail.
any help would be much appreciated, or tell me i cant do it, at least i know ill be defeated.
PS i have around 6 or 7 PDF files with 50+ pages so its a long boring task if i need to go and rename all these.
Cheers
JezIt would be possible in theory to do it with a folder-level script, provided the string you need is in exactly the same structural position on each page. You would use the doc.getPageNthWord() function to collect the string you want, then the doc.extractPages() function to save each page to a file.
See the Acrobat SDK documentation for help with scripting. http://bit.ly/AXISDKH -
Import From Folder: How to Extract the File Name in a Custom Column.
Hello All
Here´s what we´re trying to do:
We have a folder with csv files named like this:
Sales_2013-02-05.csv
Sales_2013-02-04.csv
Sales_2013-02-03.csv
Sales_2013-02-02.csv
Sales_2013-02-01.csv
And in the csv files there are the sales columns but not the date column.
So we want to extract the date from the file name.
I´ve tried entering = Source[Name] in a custom column, but it adds a "LIST" link, and on a click on expand, it adds ALL file names from the folder in each row, instead of just the needed one.
If we could get the proper file name in each row (from where they got extracted), we could split the column and get the date from there. But I don´t know how put the filename there properly.
Can you help?This isn't entirely straightforward, but it's definitely possible. What you need to do is to apply all of your transforms to each individual file instead of the combined files. I do that as follows:
1) Use Folder.Files as generated by the GUI to look at the list of my files.
2) Pick one file and do all the transformations to it that I want to apply to all of the files. Sometimes, this just amounts to letting the autodetection figure out the column names and types.
3) Go into the advanced editor and edit my code so that the transformations from step 2 are applied to all files. This involves creating a new function and then applying that function to the content in each row.
4) Expand the tables created in step 3.
As an example, I have some files with names that match the ones you suggested. After steps 1 + 2, my query looks like the following:
let
Source = Folder.Files("d:\testdata\files"),
#"d:\testdata\files\_Sales_2013-02-01 csv" = Source{[#"Folder Path"="d:\testdata\files\",Name="Sales_2013-02-01.csv"]}[Content],
#"Imported CSV" = Csv.Document(#"d:\testdata\files\_Sales_2013-02-01 csv",null,",",null,1252),
#"First Row as Header" = Table.PromoteHeaders(#"Imported CSV"),
#"Changed Type" = Table.TransformColumnTypes(#"First Row as Header",{{"One", Int64.Type}, {"Two", type text}, {"Three", type text}})
in
#"Changed Type"
For step 3, I need to take steps 3-5 of my query and convert them into a function. As a check, I can apply that function to the same file that I chose in step 2. The result looks like this:
let
Source = Folder.Files("d:\testdata\files"),
Loader = (file) =>
let
#"Imported CSV" = Csv.Document(file,null,",",null,1252),
#"First Row as Header" = Table.PromoteHeaders(#"Imported CSV"),
#"Changed Type" = Table.TransformColumnTypes(#"First Row as Header",{{"One", Int64.Type}, {"Two", type text}, {"Three", type text}})
in
#"Changed Type",
#"d:\testdata\files\_Sales_2013-02-01 csv" = Source{[#"Folder Path"="d:\testdata\files\",Name="Sales_2013-02-01.csv"]}[Content],
Loaded = Loader(#"d:\testdata\files\_Sales_2013-02-01 csv")
in
Loaded
Now I apply the same function to all of the rows, transforming the existing "Content" column into a new value:
let
Source = Folder.Files("d:\testdata\files"),
Loader = (file) =>
let
#"Imported CSV" = Csv.Document(file,null,",",null,1252),
#"First Row as Header" = Table.PromoteHeaders(#"Imported CSV"),
#"Changed Type" = Table.TransformColumnTypes(#"First Row as Header",{{"One", Int64.Type}, {"Two", type text}, {"Three", type text}})
in
#"Changed Type",
Transformed = Table.TransformColumns(Source, {"Content", Loader})
in
Transformed
Finally, I need to expand out the columns in the table, which I can do by clicking on the expand icon next to the Content column header. The resulting query looks like this:
let
Source = Folder.Files("d:\testdata\files"),
Loader = (file) =>
let
#"Imported CSV" = Csv.Document(file,null,",",null,1252),
#"First Row as Header" = Table.PromoteHeaders(#"Imported CSV"),
#"Changed Type" = Table.TransformColumnTypes(#"First Row as Header",{{"One", Int64.Type}, {"Two", type text}, {"Three", type text}})
in
#"Changed Type",
Transformed = Table.TransformColumns(Source, {"Content", Loader}),
#"Expand Content" = Table.ExpandTableColumn(Transformed, "Content", {"One", "Two", "Three"}, {"Content.One", "Content.Two", "Content.Three"})
in
#"Expand Content"
From here, you should be able to get to what you want. -
How can I extract a file name / path from a local path variable in TestStand?
I have local TestStand string variable, call it 'locals.path', that contains a path to a file including the file name (c:\inputs\input.txt). I need to be able to split up the path (c:\input) and the file name (input.txt) and save them into 2 local variables. What is the best way to do this?
After reading through some of the other forums, it looks like there are some built-in functions that can accomplish this, but I am unable to find how to use them anywhere on the NI web site. One forum said to use the File I/O>Strip Path.file function. How is this called? Is this function in a DLL?
I know that there are a number of DLLs that are installed with TestStand into the c:\windows\system32 directory. One forum made note of CVI_OpenFile / CVI_ReadFIle functions in the cvirt.dll that I used to solve a problem that I had in the past. The problem is that I had no idea that that these functions even existed and would have never known unless a similar question had been posted previously. Is there some place that these DLL function interfaces are defined or documented? Is there a function that can extract the file name out of a string for me?
Thanks,
MikeHi,
There sound like functions in say LabVIEW or CVI.
I have attached a small example which may help. (I have not allowed for any error trapping, if say you dont find the file and cancel)
Regards
Ray Farmer
Message Edited by Ray Farmer on 10-16-2006 10:04 PM
Regards
Ray Farmer
Attachments:
Sequence File1.seq 33 KB -
I have a question about extracting pages. When I do the function, adobe saves the individual files as "<file name><space><page number>", so the files look like this "filename 1.pdf", "filename 2.pdf", "filename 3.pdf". Without too many gory details, I am using excel to concatenate some data to dynamically build a hyperlink to these extraced files. It casues me problems, however, for the space to be the the file name. Is there any way to change the default behavoir of this function to perhaps use a dash or underscore instead of a space?
No, you can't change the default naming scheme. You can do it yourself if you extract the pages using a script instead of using the built-in command.
-
Extracting string from a file name
Hello,
I have a legacy (read: I didn't build it) SharePoint list that includes some validation when uploading files that's giving me some trouble.
Basically, our users are required to add files to a list in a certain filename format and based on the naming convention are approved/rejected and routed to the appropriate location.
One of the validations looks at a section of the file name and compares it to a folder name in the library.
For example, the file name format is XX_AAA_999_2014_05.xlsx and that matches on the folder name of /submissions/2014_05
Currently the rule says look at the last 7 characters of the folder and the 7 characters starting at position 12 of the filename and make sure they match.
The problem is the 999 in the example above is a sequential identifier to the project a file is associated with... e.g. they range from project 000 to project 999. We've now hit project 1000 so file being added for project 1000 (and beyond) fails because
the starting position has shifted one spot. (Note: we have active 3 digit projects so I cannot simply change that to be position 13... not to mention what that does to my history).
So, my task is to come up with something that can accomodate 3 or 4 digit numbers.
I'm trying to stick as closely to the original setup so I don't mess up the history so I'm looking at other methods of getting to the same data in the string. Another problem is that the file names include the extension and the extension can be 3 (pdf)
or 4 (xlsx) characters long.
I've tried this: =LEFT([Source File Name],SEARCH(".",[Source File Name])-1)
but that brings back everything in front of the period and I need just the 7 preceeding characters. Is there a way to limit the number of chars a LEFT() function returns?
In a nutshell, the 4 variations of file names are as follows of which I need to extract the
bolded section.:
ZZ_AAA_999_2014_05.xls
ZZ_AAA_999_2014_05.xlsx
ZZ_AAA_1000_2014_05.xls
ZZ_AAA_1000_2014_05.xlsx
Thanks!
KevinHi,
According to your description, you might want to retrieve the string “2014_05” from the file name.
I would suggest you create a SharePoint Designer workflow and implement your logic of handling the filename.
In SharePoint Designer 2010, there are already some useful utility workflow actions which can enable users to deal with the various requirements come from the business scenarios.
For the string handling, you can consider to use the
Utility Actions:
http://msdn.microsoft.com/en-us/library/office/jj164026(v=office.15).aspx
Another two links about creating SharePoint Designer workflow for your reference:
http://office.microsoft.com/en-001/sharepoint-designer-help/introduction-to-designing-and-customizing-workflows-HA101859249.aspx
http://www.codeproject.com/Tips/415107/Create-a-Workflow-using-SharePoint-Designer
Thanks
Patrick Liang
Forum Support
Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact
[email protected]
Patrick Liang
TechNet Community Support
Maybe you are looking for
-
Getting question marks in html output when XML sourced from a CLOB...
I have noticed a number of other unanswered questions on the same subject in this forum. Can someone at Oracle shed some light on this problem?... I store XML in CLOBS which contain a lot of é ö characters. When using XSQL to select the XML from the
-
My iPhone 4s is dark, this is the second time. The first time I was able to get it back up and running by plugging it into my PC. However this time it has been plugged in for an hour or more and nothing. There was still at least 70% charge left on
-
ITunes 6.0.5 Upgrade Recognizes ipod as "disk"
S.O.S. After a successful upgrade to itunes 6.0.5, itunes now recognizes my ipod as "disk" with all my files missing. If I unplug my ipod from my computer, all the files are present and playable. I've tried updating ipod firmware, uninstalling/reinst
-
Highlight row in standard report based on value in column...
I am trying to highlight rows of a standard report based on the value of the column TICKET_TYPE. I have been following the post: Highlighting a ROw in a tablular form based on a column in the row but having difficulty. I receive the following error:
-
HT3939 Fake Iphone or Authorized by Apple
I am from Doha Qatar. I am sending this email to get some help from you to be sure about apple Iphone 5 that I bought in Qatar; however I am not online customer of apple yet. I bought apple Iphone 5 Black in March 2013 and apple Iphone 5 white in Mar