cancel
Showing results for 
Search instead for 
Did you mean: 

How to write the file to target directory with same file name

Former Member
0 Kudos

Hi Guys,

I have a one simple file as shown below. Name of the file is "ABC_XYZ_123.txt"

Dear XXXX,

Line1

Line2

Line3

Regards,

YYYY.

I need to write this file to the directory with same file name with out any mapping. If I do mapping, all the empty lines in the file( Ex: line between Dear XXX and Line1)will be removed by File Adapter while generating the XML.

Could anyone help me how to handle this scenario.

Thanx,

Kumar

Accepted Solutions (1)

Accepted Solutions (1)

justin_santhanam
Active Contributor
0 Kudos

Kumar,

You can do this by creating dummy interfaces in ID. Here XI acts like File mover. I'll give the reference blog ...

/people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository

If you want the same filename then just select checkbox <b>FileName</b> in both Sender /Receiver channel's <b>ASMA</b>. Thats it...

If you have any doubts in achieving the same, kindly let us know.

raj.

Former Member
0 Kudos

Hi Raj,

Thank u very much for ur answer.

one more requirement came that I need to write the file to the target directory with different name.

Assume the Name of the file is "ABC_XYZ_123.txt" and the file content as shown below.

Dear XXXX,

Line1

Line2

Line3

Regards,

YYYY.

Whn writing to the target directory assume file name should be "TPZ_XYZ_123.txt" with out any mapping. If I do mapping, all the empty lines in the file( Ex: line between Dear XXX and Line1)will be removed by File Adapter while generating the XML.

Could u help me again how to handle this scenario.

Thanx,

Kumar

justin_santhanam
Active Contributor
0 Kudos

Kumar,

<i>assume file name should be "TPZ_XYZ_123.txt"</i> , is the file name static or dynamic. If its dynamic where u are getting the file name frm?

raj.

Former Member
0 Kudos

Hi Raj,

file name is dynamic. In Runtime, I need to check the first few chacters of the file name and should be placed with new string.

Definitely I should have a Input file name to do this.

I think this is psb using Dynamic configuration with message mapping, but if i use the mapping empty lines will be removed.

Kumar.

former_member614185
Contributor
0 Kudos

Hi,

Check this link,

justin_santhanam
Active Contributor
0 Kudos

Kumar,

The term <b>"dynamic"</b> comes in file name then u have to go for either variable substitution or Dynamic configuration, but unfortunately both the cases can't be applicable in ur scenario.

Can u give an example, so that we can see if its really possible or not..

raj.

former_member192892
Active Contributor
0 Kudos

Hey Raj,

Just a doubt i have...Can we pick up the file and do a java mapping which will take care of the empty spaces and do the dynamic condiguration thing there in the java mapping??

justin_santhanam
Active Contributor
0 Kudos

Varun,

I think so it's possible. But i'm not sure, coz I haven't worked on Java Mapping

raj.

former_member192892
Active Contributor
0 Kudos

Me 2... I think a way around would be to write an adapter module to read the file and transform it to an XML which takes care of the empty spaces as well...

Then use this xml to do the dynamic configuration mapping code

Thanks

Varun

Former Member
0 Kudos

Hi Raj,

As I told u earlier, We have one flat file in source Directory.

Assume file name is "ABC.XYZ_XXX_123.txt" and XXX value will vary in the file.

Requirement is the same file content should be return to the target directory with different file name like "ABC.XYZ_YYY_123.txt" .

Value "YYY" can be assigned only after checking the first 3 charcters "ABC" and value of "XXX" in the Source file name.

Note: Value "YYY" will vary in the Target file Name if value "XXX"changes.

thanx,

kumar

former_member192892
Active Contributor
0 Kudos

Hi Kumar,

Please use an adapter module to convert your input file to xml format, having tags to represent the emtpy spaces as well..

After this do the dynamic configuration udf to assign file name

refer this blog for file sender adapter module

/people/sap.user72/blog/2005/07/31/xi-read-data-from-pdf-file-in-sender-adapter

And this blog for dynamic file naming

/people/michal.krawczyk2/blog/2005/11/10/xi-the-same-filename-from-a-sender-to-a-receiver-file-adapter--sp14

Former Member
0 Kudos

Hi varun,

I am able to do Dynamic file change with dynamic configuration mapping code but the problem is sender Adpter is skipping the empty lines when generating the XML.

Source file

-


Dear XXXX,

Line1

Line2

Line3

Regards,

YYYY.

My Output file will be coming to the target directory with the required file name like below.

Dear XXXX,

Line1

Line2

Line3

Regards,

YYYY.

If i am able to capture the empty lines in XML, then my prob will be solved.

Thanx,

Kumar.

former_member192892
Active Contributor
0 Kudos

Kumar,

did u try this FieldName.fieldContentFormatting = nothing

http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm

Former Member
0 Kudos

Hi varun,

I already used this parameter.

Former Member
0 Kudos

Hi Guys,

We have used the unix script on receiver channel to handle this.

Thanx,

Kumar.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Kumar ,

<b>There is no need of creating any dummy variable at Repository level.</b>

Just perform Configuration steps ...and at the time of creating Interface ,Receiver Determination etc...you can write anything at interface and namespace place ..but maintain same thing in the whole scenario..

your scenario will work perfectly smoothly..

))))

Former Member
0 Kudos

Hi Raj,

Thank u very much for ur answer.

one more requirement came that I need to write the file to the target directory with different name.

Assume the Name of the file is "ABC_XYZ_123.txt" and the file content as shown below.

Dear XXXX,

Line1

Line2

Line3

Regards,

YYYY.

Whn writing to the target directory assume file name should be "TPZ_XYZ_123.txt" with out any mapping. If I do mapping, all the empty lines in the file( Ex: line between Dear XXX and Line1)will be removed by File Adapter while generating the XML.

Could u help me again how to handle this scenario.

Thanx,

Kumar

Message was edited by:

ms kumar

Shabarish_Nair
Active Contributor
0 Kudos

use the same blog -

/people/william.li/blog/2006/09/08/how-to-send-any-data-even-binary-through-xi-without-using-the-integration-repository

but in this second case dont use Adapter specific properties. Directly configure your receiver/ target file adapter and provide the file name there as TPZ_XYZ_123.txt