cancel
Showing results for 
Search instead for 
Did you mean: 

Variable Substitution

Former Member
0 Kudos

Hi All,

My sender message will be like

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

<ns0:ZBAPI_CCN_CREATE xmlns:ns0="urn:sap-com:document:sap:rfc:functions">

<CHANGE_HEADER>

<CHANGE_NO/>

<STATUS/>

<AUTH_GROUP/>

<VALID_FROM/>

<DESCRIPT/>

<REASON_CHG/>

</CHANGE_HEADER>

</ns0:ZBAPI_CCN_CREATE>

of which, I want to bring in the CHANGE_NO as my file name. But when I m trying to do so I am getting the following error in receiver CC

Error: 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: var1: 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: var1

and in my receiver CC i have defined var1 as payload: ZBAPI_CCN_CREATE,1,CHANGE_HEADER,1,CHANGE_NO,1

and my target file name as Changenumber_%var1%_.xml

let me kow how to resolve.

Regards,

Nithiyanandam

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

I had also stuck in the same case, and I was able to resolve through following way (just for reference for somebody who got stuck with the same issue):

  • First of all, if selecting payload then the reference should be of receiver message and not sender message.

  • To see the payload of the receiver message, check the payload in Technical Routing of the message (using transaction SXMB_MONI).

  • From there you can select whatever field you want to reference making sure that value should always be present in that reference field.
former_member187339
Active Contributor
0 Kudos

Hi Nithiya,

I tried checking to get variable substitution path with a namespace but was not successful.

Why dont you try this:

1. Switch on ASMA on sender channel

2. In message mapping change the Filename vaue with Node content

3. USe Dynamic Configuration in Receiver channel

Hope this will help

Regards

Suraj

former_member181962
Active Contributor
0 Kudos

Hi Nithya,

Can you confirm that you are doing the Variable substitution in the Receiver File adapter?

You have said that your scenario is File-RFC-File, so you have to create two file adapters (One sender and another receiver).

In the receiver file adapter you should be doing your Variable substitution.

Regards,

Ravi

former_member181962
Active Contributor
0 Kudos

Hi Nithyanandam,

Aas other have suggested, it doesn't work for sender adapter.

You have to map it to some field in the target structure and then use that variable in your Variable substitution.

Regards,

Ravi Kanth Talagana

Former Member
0 Kudos

Hi,

My source and target structures are same

Regards,

Nithiyanandam

former_member187339
Active Contributor
0 Kudos

Hi Nithiya,

Variable sustitution in Recever File adapter works on receiver payload and not sender

Regards

suraj

Former Member
0 Kudos

Hi Suraj,

I have configured on the receiver file adapter only..

Still I am getting the error on Sender CC

Regards,

Nithiyanandam

former_member187339
Active Contributor
0 Kudos

Hi Nithiya,

It is logical, receiver adapter will take receiver payload and not senderr.

So you need to pass the filename in some part of receiver payload.

I will suggest you to try passing it to the root node Just give a try

Regards

Suraj

Former Member
0 Kudos

HI,

Can u guide me through I am not getting it...

Regards,

Nithiyanandam

former_member187339
Active Contributor
0 Kudos

Hi Nithiya,

Is this your target structure?

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

- <ns0:ZBAPI_CCN_CREATE xmlns:ns0="urn:sap-com:document:sap:rfc:functions">

- <CHANGE_HEADER>

<CHANGE_NO>T090060</CHANGE_NO>

<STATUS>01</STATUS>

<VALID_FROM>17.09.2009</VALID_FROM>

<DESCRIPT>001ss</DESCRIPT>

<REASON_CHG />

</CHANGE_HEADER>

</ns0:ZBAPI_CCN_CREATE>

Can you try this when you declare var in receiver adapter:

payload: ns0:ZBAPI_CCN_CREATE,1,CHANGE_HEADER,1,CHANGE_NO,1

if this doesn't work i will suggest you to remove the namespace from the target structure and try the same combination whcih you used earlier.

BTW why the receiver (file) is also having the same rfc namesapce?

Regards

Suraj

Former Member
0 Kudos

Hi Suraj,

Still it is not working

Since I have created the external definition using the source structure of the BAPI (by copying the XSD) it has the same target structure

Its a file-RFC-FILE scenario. I am trying this at the request side

Regards,

Nithiyanandam

Edited by: Nithiyanandam A.U. on Oct 12, 2009 12:18 PM

Shabarish_Nair
Active Contributor
0 Kudos

>

> Hi All,

>

> My sender message will be like

>

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

>

> <ns0:ZBAPI_CCN_CREATE xmlns:ns0="urn:sap-com:document:sap:rfc:functions">

> <CHANGE_HEADER>

> <CHANGE_NO/>

> <STATUS/>

> <AUTH_GROUP/>

> <VALID_FROM/>

> <DESCRIPT/>

> <REASON_CHG/>

> </CHANGE_HEADER>

> </ns0:ZBAPI_CCN_CREATE>

>

> of which, I want to bring in the CHANGE_NO as my file name. But when I m trying to do so I am getting the following error in receiver CC

>

> Error: 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: var1: 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: var1

>

> and in my receiver CC i have defined var1 as payload: ZBAPI_CCN_CREATE,1,CHANGE_HEADER,1,CHANGE_NO,1

>

> and my target file name as Changenumber_%var1%_.xml

>

> let me kow how to resolve.

>

>

> Regards,

> Nithiyanandam

try

payload:ZBAPI_CCN_CREATE,1,CHANGE_HEADER,1,CHANGE_NO,1

dont keep any spaces between the texts. also make sure there is a value in the target field else it will fail.

Former Member
0 Kudos

Hi

At call adapter level I am getting the payload message as

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

- <ns0:ZBAPI_CCN_CREATE xmlns:ns0="urn:sap-com:document:sap:rfc:functions">

- <CHANGE_HEADER>

<CHANGE_NO>T090060</CHANGE_NO>

<STATUS>01</STATUS>

<VALID_FROM>17.09.2009</VALID_FROM>

<DESCRIPT>001ss</DESCRIPT>

<REASON_CHG />

</CHANGE_HEADER>

</ns0:ZBAPI_CCN_CREATE>

Regards,

Nithiyanandam

Former Member
0 Kudos

Hi ,

As far as i know... Variable substitution works for receiver message type.. But not sender message type.

thanks,

Subbu

Shabarish_Nair
Active Contributor
0 Kudos

why dont you use asma properties and set the file name - /people/shabarish.vijayakumar/blog/2009/03/26/dynamic-configuration-vs-variable-substitution--the-ultimate-battle-for-the-file-name

i suggest to use dynamic configuration.

Former Member
0 Kudos

HI,

I want to try with Variable Substitution... Its working fine for ASMA

Regards,

Nithiyanandam

former_member750652
Contributor
0 Kudos

Hi Nithyanandam,

Your syntax is correct, looks like the value is not coming in the payload which is used for variable substitution.

Thanks,

Ram.