cancel
Showing results for 
Search instead for 
Did you mean: 

Create XML file in network folder

former_member8532
Participant
0 Kudos

Hello All,

I am reading data from SQL tables and getting  in the form of XML. I need to create a xml file with the same data and store the file in network folder.The name of the file should be with timestamp.xml.

Please suggest.

Regards.

Anshul

Accepted Solutions (1)

Accepted Solutions (1)

saumya_govil
Active Contributor
0 Kudos

Hi Anshul,

You can use action 'XML Saver' to save the file at the desired location. To provide timestamp you can use function 'datenow' while creating the file name.

Hope this helps!

Regards,

Saumya Govil

former_member8532
Participant
0 Kudos

Hi Saumya,

I tried datenow as below.

"\\\\drive\\folder\\"datenow".XML"

"\\\\drive\\folder\\"++datenow++".XML".


Nothing is working. Please suggest the correct way to add 'datenow' function.


Regards.

Anshul

saumya_govil
Active Contributor
0 Kudos

Hi Anshul ,

Try this:

"\\\\drive\\folder\\" & datenow & ".XML"


Concatenation operator in MII is '&'.


Regards,

Saumya Govil

former_member8532
Participant
0 Kudos

Hi Saumya,

This is generating with date 2014-04-10T09 but the file is not containing the XML extension and file size is of 0 KB.

Please suggest.

Regards.

Anshul

agentry_src
Active Contributor
0 Kudos

Try it with removing the spaces between pieces of expression.  For example, instead of & datenow &, it should be &datenow&.  It also does not know how to interpret the special character ":".  Use the dateformat function to set the string format properly instead of the raw xml result from datenow.

Message was edited by: Michael Appleby

saumya_govil
Active Contributor
0 Kudos

Hi Anshul,

Try this:

"\\\\drive\\folder\\" & dateformat(datenow, "yyyy-MM-dd'T'HH:mm:ss","yyyyMMddHHmmss") & ".xml"

Regards,

Saumya Govil

agentry_src
Active Contributor
0 Kudos

Hi Saumya,

Good catch.  hh needs to be HH.  I think there is a problem in the Help documentation where I copied it from.  I don't recommend including spaces around the "&" symbols as a general rule.  It can be a problem in some versions and SPs.

Thanks, Mike

former_member8532
Participant
0 Kudos

Hi Saumya / Mike,

Thanks for your help. The problem has been solved now.

Regards.

Anshul

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi Anshul,

Try with below Condition, hope it will solve your problem.

While configuring 'Path' parameter in Link config of XML Saver action block, pass below condition

Local.FilePath & datefromxmlformat( datenow, "yyMMddhhmmss" ) & ".XML"

And here I have used transaction Local parameter to pass the file path. If not you can directly pass as below

"\\\\drive\\folder\\" & datefromxmlformat( datenow, "yyMMddhhmmss" ) & ".XML"

Regards,

Praveen Reddy

former_member202228
Active Participant
0 Kudos

If you're able to save a file outside the Netweaver webspace, you're security settings are NOT configured right .. I'd enable the local machine FTP server in windows and use the FTP action block to save files wherever that FTP root (or directories under) is being set to.

What about someone trying to overwrite system files with MII?

Regards,

Paul Radulescu

former_member204240
Active Participant
0 Kudos

Hi Anshul,

I hope you can make use of Write File action with the Mode CREATE

Regards,

Padma Rao

agentry_src
Active Contributor
0 Kudos

Hi Anshul,

Use the Expression Editor to generate a string value using Date Time functions concatenated together as the name of the file.

Regards, Mike

SAP Customer Experience Group - CEG

former_member8532
Participant
0 Kudos

Hi Michael,

Thanks.

I am using XML SAVER action to create and save the file . It's working fine if in configure object file path is as  "\\drive\folder\TEST.XML". In this case it's generating the file with name TEST.XML.

I  configure link of same XML SAVER action and specified same "\\drive\folder\TEST.XML" for Path property. In this case it's giving me the error.

"Invalid link expression in action[XML_Saver_0]:\\drive\folder\TEST.XML"


I tried first with test file (Fixed name ) but it's not working. Once it will work i can use expression editor for date and time function.


I also need the expression to add date and time in place of TEST.

Regards.

Anshul

former_member8532
Participant
0 Kudos

Hi Michale,

I am able to solve the problem. The issue was \ sign. Below is the correct way to add path.

"\\\\drive\\folder\\TEST.XML"

Now i have replace the TEST with date and time function. Please suggest about the same.

Regards.

Anshul

agentry_src
Active Contributor
0 Kudos

Hi Anshul,

dateformat(datenow, “MM-dd-yyyyThh:mm:ss”,“yyyyMMddhhmmss”)&".xml" will return a datetimestamp value for a file name which you can then substitute for TEST.xml.  So your result right now (10:41:44 AM) would be 20140410104144.xml.

Regards, Mike

SAP Customer Experience Group - CEG

Message was edited by: Michael Appleby updated fromFormat of datenow for "T" between date and time.

former_member8532
Participant
0 Kudos

Hi Mik,

It's returning .XML file with data but no name of file.

Regards.

Anshul