cancel
Showing results for 
Search instead for 
Did you mean: 

Variable substitution not working for dynamic file name in Receiver File CC

jagesh_lakdawala
Active Participant
0 Kudos

Hi Experts,

I am doing the scenario of Proxy sender to File receiver and my purpose is to Create the text file

as per the filename available in Source Message payload.

I am using the Variable Substitution method for this as shown below.

Source Message Structure:-

<Row> -


having Cocurence 1.1

<Filename> -


having Cocurence 1.1

<Item> -


having Cocurence 1.Unbounded

<Field1>

<field2>

<Item>

<Item>

<Field1>

<field2>

<Item>

<Row>

Target structure is same as the source structure and i have mapped the Filename field of the Source

with the Target structure Filename.

In ID the following is the File receiver CC Configuration.

File Name Scheme:- %Dyn_filename%

In Advance tab, I have selected the Enable option and added one row as Variable name %Dyn_filename%

and Reference as payload:Row,1,Filename,1

In testing I am getting the Error as 'variable Dyn_filename is not found in Message payload'.

Please suggest me.

Regards,

Jagesh

Accepted Solutions (1)

Accepted Solutions (1)

prateek
Active Contributor
0 Kudos

Try replacing the name Dyn_filename with some name with all characters in lower case.

Regards,

Prateek

jagesh_lakdawala
Active Participant
0 Kudos

Hi Prateek,

Correct, I have changed the Variable name to all lowercase and I have also changed the reference Content as 'payload:MT_Targetstruct,1,Row,1,Filename,1'

Now Output file is now created with the Filename available in Message payload.

One more problem I found is:- I am using the File Content conversion as Message protocol and Recordset structure as Row,Item with following details.

ITEM.fieldSeparator ,

ITEM.endSeparator 'nl'

Row.fieldSeparator 'nl'

But filename which is available in target message structure is also being written in the Output File. I don't want Filename in the Output file.The content of the Output file is as shown below.

Filename.txt,Field1,Field2

Field1,Field2

Field1,Field2

So please suggest me how to avoid this unwanted Elements on Output file.

Thanks for your valuable reply.

Regards

Jagesh

Shabarish_Nair
Active Contributor
0 Kudos

use the option - fixedLengthTooShortHandling value cut

I still suggest you try the dynamic configuration

jagesh_lakdawala
Active Participant
0 Kudos

Hi Shabarish,

In my scenario, sender is proxy adapter and not File and it is asynchronus also. So how can i use the Dynamic configuration instead of Variable substitution method??

Please suggest

Regards,

Jagesh

Former Member
0 Kudos

Hi Jagesh,

Its possible to handle your scenario using dynamic configuration in your file receiver, but I think variable substitution is much convenient option.

As Shabz mentioned, you should use "fixedLengthTooShortHandling" for avoiding the filename as a part of the message content. Check the following blog : /people/sravya.talanki2/blog/2005/08/11/solution-to-the-problem-encountered-using-variable-substitution-with-xi-sp12

thanks,

Pooja Pandey

jagesh_lakdawala
Active Participant
0 Kudos

Hi Pooja,

Hi Pooja,

Thanks for your valuable reply..

I tried with the same. but still Filename is appearing in Output file.Giving you some details regarding my Receiver File Configuration settings.

Target Message Type:-

<MT_Target_Struct>

<Row>----


1.1 occurence

<Filename_test>----


1.1 occurence

<ITEM>----


1.unbounded occurence

<Field1>

<Field2>

<ITEM>

<ITEM>

<Field1>

<Field2>

<ITEM>

<Row>

<MT_Target_Struct>

Recordset structure:- Row,Filename_test,ITEM

Row.fieldSeparator----


>'nl'

Filename_test.fieldFixedLengths----


>0 (Zero)

Filename_test.fixedLengthTooShortHandling----


>Cut

ITEM.fieldSeparator----


>,

ITEM.endSeparator----


>'nl'

I want only ITEM node to be written in the output file.

Please suggest.

Regards,

Jagesh

Shabarish_Nair
Active Contributor
0 Kudos

try

Recordset structure:- Filename_test,ITEM

Filename_test.fieldFixedLengths----


>0 (Zero)

Filename_test.fixedLengthTooShortHandling----


>Cut

ITEM.fieldSeparator----


>,

ITEM.endSeparator----


>'nl'

If this doesnt work, then modify the structure.

Put Filename_test towards the end of XML i.e after ITEM and try the FCC,

Recordset structure:- ITEM,Filename_test

ITEM.fieldSeparator----


>,

ITEM.endSeparator----


>'nl'

Filename_test.fieldFixedLengths----


>0 (Zero)

Filename_test.fixedLengthTooShortHandling----


>Cut

You still havnt considered the option of using dynamic configuration and adapter specific message attributes as i had mentioned in the earlier post. The issue with using CUT is that it will not completely remove the line but rather it will post and empty line. Try dynamic configuration with ASMA it is much more powerful, easy and recommended.

jagesh_lakdawala
Active Participant
0 Kudos

Hi Shabarish,

I have tried as you have suggested in your last reply but still Filename is coming in Output File.

I think I must go for Dynamic Confg. method.

Can you suggest me how to use Dynamic confg. method for proxy sender to File receiver??? (Filename is available in Source structure)

Please suggest.

Regards,

jagesh

jagesh_lakdawala
Active Participant
0 Kudos

Hi Shabarish,

Thanks to you, Pooja and Prateek for your support.

Finally its solved by Dynamic configuration method.

In the UDF I have set the 'Filename' from the Source payload and then in File Receiver CC config, I haveused the ASMP.

it is working.

Regards,

Jagesh

Answers (5)

Answers (5)

varun_k
Contributor
0 Kudos

Hi Jagesh,

Remember few things:

1) The variable substution should use the xpath of the target payload

2) Use lowercase variable names in both File name scheme & variable substitution table

Try if this works

payload:Row,1,Filename,1,item,1

Regards,

Varun

jagesh_lakdawala
Active Participant
0 Kudos

Hi Varun,

Thanks for ur reply..

But i dont have any problem in variable subtitution now.

In my previus message i have described my problem regarding output file content.

Regards,

Jagesh

Former Member
0 Kudos

Jagesh,

Use these values as Shabarish mentioned and let us know.

Filename.fixedLengthTooShortHandling, Value column = Cut

Regards,

Pavan

Former Member
0 Kudos

Variable name should be in lower case

Sameer!

Former Member
0 Kudos

as prateek says try all lower case,

does your mapping test successful,

test configuration in ID ,

check the payload ....

my thought is , mapping is the pain area.

Shabarish_Nair
Active Contributor
0 Kudos

1. Make sure there is a value in your field in your target XML for the file name

2. Why use variable substitution when you have the option of Dynamic configuration?

have a look -

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

http://help.sap.com/saphelp_nw04/helpdata/en/43/03612cdecc6e76e10000000a422035/frameset.htm