cancel
Showing results for 
Search instead for 
Did you mean: 

Variable Substitution Problem!!!

former_member184543
Active Participant
0 Kudos

Hi all,

I am doing a variable substitution method in my scenario (idoc to file) so that a value of a field that comes from the idoc is named as the file name of the file in the output. i.e:- i will run down through the sturcture to the level where i ll get the value to be substituted for the name of my file

I am using the structure,

<data>

<recordset>

<docnum>222</docnum>

<mandt>111</mandt>

<lifnr>333</lifnr>

</recordset>

</data>

I need the value of 'docnum' as my filename. i.e:222.txt

So, what i did is, in the variable substitution field, i used a variable %var% followed by the usage of

payload:data,1,recordset,1,docnum,1

and then used var in the file output name field followed by .txt

Irrespective of this, i m getting an error saying that "the %var% cannot be found in the payload".. Is that i m doing something wrong. Please help experts..

Thanks

Anju

Accepted Solutions (1)

Accepted Solutions (1)

henrique_pinto
Active Contributor
0 Kudos

Sounds about right.

Remember that the variable reference must be related to the target structure (mapping output) and not the input.

Recheck for any typos.

Regards,

Henrique.

Answers (4)

Answers (4)

sridharreddy_kondam
Active Contributor
0 Kudos

Hi Anju,

create the variable name with <b>docnum</b> with in the variable substition and then use this as payload:data,1,recordset,1,docnum,1 and then file name as

%docnum%.filename.txt

thanks and Regards,

sridhar

Former Member
0 Kudos

Sridhar,

In his strcture he dont have <b>plant</b>. So we dont need that. Also as per his question he needs the filename as 222.txt. We are assuming 222 as Idoc Num. Rest what ever you told is correct. Also either he can use var or docnum. That dont make any difference.

Cheers,

---Satish

Former Member
0 Kudos

Anju,

You are doing correctly but a simple thing you are doing wrong. You have created filename as var.txt and variable name as %var%. Where as it should be other way round.

So create the filename as <b>%var%.txt</b> and create variable as <b>var</b>. It should solve your issue.

Regards,

---Satish

Former Member
0 Kudos

Go through this blog...This will solve your problem.

/people/jin.shin/blog/2007/04/27/sap-netweaver-xi-variable-substitution-with-adapter-specific-message-attributes-via-dynamicconfigurationbean

regards,

Ravi

sridharreddy_kondam
Active Contributor
0 Kudos

Hai Anju,

create the variable name with docnum with in the variable substition and then use this as payload:data,1,recordset,1,docnum,1 and then file name as

%docnum%.filename.txt

Thanks and regards,

sridhar

henrique_pinto
Active Contributor
0 Kudos

> Did you mention the variable name in File name

> Here you should mention the field name <b>docnum</b>

> and variable name should be <b>docnum</b>

> i.e as %docnum%_filename.txt

Dude, where did you get that from??

SAP Documentation doesn't say anything like that.

Regards,

Henrique.