cancel
Showing results for 
Search instead for 
Did you mean: 

Error in Variable Substitution

Former Member
0 Kudos

Dear All,

Result Payload:

<ns1:MT_Level1 xmlns:ns1="http://test.com">

<Header>

<Separator>,</Separator>

</Header>

<Detail>

<FileNumber>30</FileNumber>

<LinkToNextLevel />

<Expansion1>0</Expansion1>

<Expansion2>0</Expansion2>

<Expansion3>0</Expansion3>

<Expansion4>0</Expansion4>

</Detail>

<Detail>

<FileNumber>30</FileNumber>

<LinkToNextLevel />

<Expansion1>0</Expansion1>

<Expansion2>0</Expansion2>

<Expansion3>0</Expansion3>

<Expansion4>0</Expansion4>

</Detail>

<FileNode>

<FileName>test.txt</FileName>

</FileNode>

</ns1:MT_Level1>

I want to use "File Name" in the "File Node" node for my variable substitution.

In the configuration:

File Name Scheme = %filename%

Variable = filename

reference = payload: Messages, 1, Message, 1, MT_Level1, 1, FileNode, 1, FileName, 1

Note: I'm using multimapping (1 to N).

File Name path is /ns0:Messages/ns0:Message2/ns1:MT_Level1/FileNode/FileName ( from right click in the file name --> copy path).

I got following error:

"Attempt to process file failed with com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: filename"

Please advise!

Best Regards,

Victor.

Accepted Solutions (1)

Accepted Solutions (1)

former_member203627
Participant
0 Kudos

Hi Victor,

Make sure you use the exactly same name as in payload as it is case sensitive. You are using filename and in paylaod u r having FileName.

regards

Ria

Former Member
0 Kudos

Dear Ria,

In the variable substitution reference I'm using:

payload: Messages, 1, Message, 1, MT_Level1, 1, FileNode, 1, FileName, 1

"FileName" is the same case with the payload.

Only the variable name (file scheme) I'm using: %filename% --> all lower case.

Variable name is not must to be the same with the payload right? I even can put anything in the file scheme?

Best Regards,

Victor.

santhosh_kumarv
Active Contributor
0 Kudos

>>Variable name is not must to be the same with the payload right? I even can put anything in the file scheme?

Yes. Varaible name can be anything..

Did u tried this..?

payload: MT_Level1,1,FileNode,1,FileName,1

Thanks

SaNv...

Former Member
0 Kudos

Dear Santosh,

Yes i tried it and the same error occurs.

Please suggest.

Best Regards,

Victor.

santhosh_kumarv
Active Contributor
0 Kudos

Hi Victor,

Try to access the same element from the Condition Editor of the Receiver Determination that corresponds to this message interface. This will give you the correct XPATH.

Thanks

SaNv...

Former Member
0 Kudos

Hi Santhos,

The element was in the target not in the source, hence i can't see the element in the condition receiver determination.

But in the mapping i can right click my target element (FileName) and copy the path.

The result is: /ns0:Messages/ns0:Message2/ns1:MT_Level1/FileNode/FileName

Please Suggest!

Best Regards,

Victor.

SudhirT
Active Contributor
0 Kudos

Hi Victor,

Check in RWB -> Communication channel monitoring, and see the details what error it is exactly giving?

Also if your file name field is not populating any way you can try mapping it with the Constant function and check in RWB.

Thanks!

Former Member
0 Kudos

Hi Sudhir,

This is the error in RWB:

Attempt to process file failed with com.sap.aii.adapter.file.configuration.DynamicConfigurationException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: filename

The file name field is populated, i can see it in the payload.

And i have tried to put constant for the file name and file can be generated without error.

Best Regards,

Victor.

prateek
Active Contributor
0 Kudos

Messages and Message2 won't be part of the expression

Use this only

payload:MT_Level1,1,FileNode,1,FileName,1

Make sure that no additional space exsist between the element names.

Regards,

Prateek

Former Member
0 Kudos

Dear All,

My problem is solved!

The issue is because I don't put the interface mappings sequence as the same sequence as the message mappings sequence. Hence the structure name that i put in the variable substitution all are not match with the structure name in the payload even though all have the file name element.

So what i did is i have to reorder the sequence of my message mappings to be the same sequence as the interface mappings sequence.

Thanks for all that trying to help!

Appreciated it guys.

BTW, for the variable reference it's correct that i no need to put message and message2 as the reference.

payload:MT_Level1,1,FileNode,1,FileName,1 will do.

Best Regards,

Victor.

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

There are some predefined variables, only that variables we can directly use, otherwise we have to declare that variables and use the same names.

Follow this link