cancel
Showing results for 
Search instead for 
Did you mean: 

Variable Substitution Error

Former Member
0 Kudos

Hi I am Using Variable Substitution for Receiver Filename

I am Getting the Following Error

Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error during variable substitution: com.sap.aii.adapter.file.varsubst.VariableDataSourceException: The following variable was not found in the message payload: FileName:

I have Given these values in the Adapter

Variable:FileName

Refernce:payload:ZLOGOS_SOACITY_MESSAGE,1,FileName,1,Source,1

Note: But In the data type I have defined Filename and Source Occurence as 0 to unbounded

I am doing Multi Mapping also

This is my source structure, for Muti-Mpping I will remove the additional Tags.<ns0:Messages>....

<?xml version="1.0" encoding="UTF-8"?>

<ns0:Messages xmlns:ns0="http://sap.com/xi/XI/SplitAndMerge">
   <ns0:Message1>
      <ns1:ZLOGOS_SOACITY_MESSAGE xmlns:ns1="http://soacity.net/CopyFile">
         <ID/>
         <CORRELATIONID/>
         <TRANSACTIONID/>
         <SERVICE/>
         <AGENT/>
         <ROUTES/>
         <TASKNAME/>
         <DEPRECATIONDATE/>
         <COMMENTS/>
         <HEADER/>
         <TITLE/>
         <XMSDESTINATION/>
         <XMSDELIVERYMODE/>
         <XMSPRIORITY/>
         <XMSEXPIRATION/>
         <XMSREPLYTO/>
         <XMSTYPE/>
         <XMSREDELIVERED/>
         <XMSPROPERTIES/>
         <XMSUSERID/>
         <XMSAPPID/>
         <XMSDELIVERYCOUNT/>
         <XMSGROUPID/>
         <XMSGROUPSEQ/>
         <XMSPRODUCERTXID/>
         <XMSCONSUMERTXID/>
         <XMSRECEIVETIMESTAMP/>
         <XMSSTATE/>
         <BODY/>
         <FileName>
            <Source>TestFile</Source>
            <Struct>
               <Message>
                  <Id/>
                  <Head>
                     <Id/>
                     <Filename/>
                  </Head>
                  <Body/>
               </Message>
            </Struct>
            <Target>TestFile</Target>
            <Structure>
               <Message>
                  <Id/>
                  <Head>
                     <Id/>
                     <Filename/>
                  </Head>
                  <Body/>
               </Message>
            </Structure>
         </FileName>
      </ns1:ZLOGOS_SOACITY_MESSAGE>
   </ns0:Message1>
</ns0:Messages>

How should I define Variable Substitution for the Source field

Regards,

Varun

Edited by: Varun on Oct 16, 2008 11:01 AM

Accepted Solutions (1)

Accepted Solutions (1)

santhosh_kumarv
Active Contributor
0 Kudos

Hi Varun,

>>This is my source structure, for Muti-Mpping I will remove the additional Tags.<ns0:Messages>....

Are you you doing the variable substution by referring to the source message. If so you are referring to the wrong xpath. The variable substution should use the xpath of the target payload and not the source payload. This is the reason for the error.

Thanks

SaNv...

varun_k
Contributor
0 Kudos

Hi Snathosh,

Thanks for your reply.

My Target message is for wich i want to define variable substitution for the field filename

<?xml version="1.0" encoding="utf-8" ?> 
- <ns1:MT_Source xmlns:ns1="http://soacity.net/CopyFile">
- <Message>
      <Id /> 
    - <Head>
        <Id /> 
        <Filename /> 
      </Head>
  <Body /> 
  </Message>
  </ns1:MT_Source>

Is this xpath correct

payload:Message,1,Head,1,Filename,1

Please correct me If i am wrong.

Regards,

Varun

santhosh_kumarv
Active Contributor
0 Kudos

>>Is this xpath correct

No, You need to use it as

MT_Source,1,Message,1,Head,1,Filename,1

Thanks

SaNv...

prateek
Active Contributor
0 Kudos

Use this

payload:MT_Source,1,Message,1,Head,1,Filename,1

Regards,

Prateek

Jitendra_Jeswan
Contributor
0 Kudos

varun,

Remmber few things:

1) Variable Substitution can be applied in the Target Message

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

3) If you are using Multimapping in target side, you need not to mention Message1 in the payload reference.

Try with this, hope this helps.

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi Varun,

I am facing the same problem.If you have solved the issue,please share the solution with me.

Thanks.

Rushikesh

varun_k
Contributor
0 Kudos

Hi Rushikesh Deshmukh,

I have defined the parameter as MT_Source,1,Message,1,Head,1,Filename,1 for my structure.

The variable substution should use the xpath of the target payload.

Regards,

Varun

Issue Solved

Former Member
0 Kudos

Hi Varun,

You have to check couple of things for the error you are getting in variable substitution:

1)Source Filename should be mapped correctly with the target Filename.

2)Consider the payload of the Target Field Structure and not the Source Field structure.

3)Right click on the field filename in the target structure and copy the path and follow the order accordingly for target structure as the same way you have done for the source structure.

4)The variables must be enclosed by % characters.

Ex-c:/temp/local/%var1%.

Let me know if you are satisfied with the answer

Former Member
0 Kudos

HI

First uncheck variable substituion and try again. you will come to know if there is any other issue.

use complete path using Multi mapping

Messages,1,Message1,1,Z...............

Then check back and see . If still issues remove the Underscore ( _ ) from your message type name.

Give it a try.

Thanks

Gaurav

varun_k
Contributor
0 Kudos

Hi Gaurav,

Thanks for you reply.

I have tried all the possible ways.

1) I Unchecked Variable Substitution and run the scenario, It executed successfully.

2) I used Variable Substitution in different ways

a) payload:Messages,1,message1,1,ZLOGOS_SOACITY_MESSAGE,1,FileName,1,Source,1

b) payload:Messages,1,message1,1,ZLOGOSSOACITYMESSAGE,1,FileName,1,Source,1

c) payload:ZLOGOSSOACITYMESSAGE,1,FileName,1,Source,1

d) payload:ZLOGOS_SOACITY_MESSAGE,1,FileName,1,Source,1

I still the the same error The following variable was not found in the message payload: filename:

Regards,

Varun

Former Member
0 Kudos

Hi Varun,

How should I define Variable Substitution for the Source field

No u cant define Variable Substitution for source field.................. Xpath should be from Target structure,

Thanks,

mahi

Jitendra_Jeswan
Contributor
0 Kudos

Remember a thumb rule

Whenever using variable substitution, define variables in lowercase

like change your variable FileName to filename in both the places

I guess that is why it is throwing error in Adapter, try changing the variable substitution variables in lowercase. It will solve the problem.

Reward points

varun_k
Contributor
0 Kudos

Hi Jeet,

Thanks for your reply.

I have chaned the variable in lowercase and then tried, but still I get the Same error.

Regards,

Varun