SAP Development

Help and Information for SAP/ABAP development professionals around the world

sapdev

Updating single and multiple HTML/text files using an SAP program

Hi All,

Here is just a little application i put together to help me update multiple pages of my web site with the same data. Although its original purpose is to update .htm files but could be used to modify any type of text based file. The ABAP application basiaclly takes a file name or directory as an input along with the new code, where it should be inserted, when it shouldn't update, when to stop making changes etc etc..

Once the excecute button is pressed all the .htm files within the selected directory and any sub directories will be updated accordingly! Please see below for screen shot and detailed description of execution parameters and how they should be populated.

Not sure if this will be of any use to anyone but thought I would put it on here incase it was and for people to suggest possible enhancements to the code or functionality.

Regards
Mart



File / directory selection
Single File
Select this radio button and enter file path if you just want to update a single file
Directory
Select this radio button and enter directory path if you want to update all files within a directory (including sub directories)

Find and replace details
Find source
Populate with the file path of text you want to find within the file(s) being updated
New source
Populate with file path of text to be added, inserted or deleted
Exclude if line contains
Instruct program not to update specific line if it contaisn the following text
Dont update if file contains
Don't update file if it contains the following text
No Changes until found
Do not update any lines of the file until the following text has been found, once it has any further matches can be updated
Stop when find
Stop updating current file once the following text has been found
The string < FILENAME> will be replaced by the file path of the data file but excluding the following component of it
If You want to add a link to the files which points to a file with the same name but with a different path insert the string < FILENAME> into the new date file and it will be replaced with the current file path minus the following section of it.

Therefor if you want to update a number of files within the directory c:/webdirectory/ with links to themselves on the domain www.sapdev.co.uk you would enter the following information:
Directory = c:/webdirectory/
< FILENAME> = c:/webdirectory/

...and the code in the new source file would look somthing like this:
< a href="www.sapdev.co.uk/< FILENAME>"> Click here to vist this page< /a>

therfor the result when updating file c:/webdirectory/index.htm would be
< a href="www.sapdev.co.uk/index.htm"> Click here to vist this page< /a>

File / directory selection
Insert line above
Inserts the new line above line containing the text in 'find source' file
Insert line below
Inserts the new line below line containing the text in 'find source' file
Replace line
Replaces containing text found in 'find source' file with 'new source' text
Insert before string
Insert 'new source' text into same line but before the text string found in the 'find source' file
Insert after string
Insert 'new source' text into same line but afterthe text string found in the 'find source' file

Share 

Add a Comment

You need to be a member of SAP Development to add comments!

Join this social network

sapdev Comment by sapdev on July 7, 2008 at 3:58pm
Hi Ash,

mainly to update the pages of my website! I kept finding the need to add or change code on every page of my website and this made things alot easier!

Regards
Martin
Ash Thomas Comment by Ash Thomas on July 7, 2008 at 2:12pm
Hello,

How come you developed this app?



Kind regards


Ash Thomas
Sap Consultant
Ash People, Sap Consultants & Sap Consultancy
www.ashpeople.com

About

sapdev sapdev created this social network on Ning.

© 2009   Created by sapdev on Ning.   Create Your Own Social Network

Badges  |  Report an Issue  |  Privacy  |  Terms of Service