cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Variable Substitution

Former Member
0 Likes
536

Hi All,

My scenario is file to file without using IR .In that I am using Variable Substitution so as to pick the files from the sender where the file name is not unique ie,EX:A)20111004-002345-100 B)20111004-00123-200

I am not sure on what to give in the Reference tab value in variable substitution option,Could anyone guide me on that.

Thanks in Advance.

Regards,

Lavanya.B

View Entire Topic
naveen_chichili
Active Contributor
0 Likes

Hi Lavanya,

Check the [ link|http://www.saptechnical.com/Tutorials/XI/Variable/substitution.htm] you will get an idea to fill the reference tab.

Regards,

Naveen

Former Member
0 Likes

Hi Naveen ,

If I give File Name Scheme as %var1%.xml and in reference as payload:Message type name,will it work?

Regards,

Lavanya

Former Member
0 Likes

Hi,

If I give File Name Scheme as %var1%.xml and in reference as payload:Message type name,will it work?

Give payload:Message type name,1,any source field wherein u want to save the file with that name,1

Regards,

Sunitha

PriyankaAnagani
Active Contributor
0 Likes

Hi,

You need to specify like payload:Messagetype,its occurrence,Rootelement,occurrence.....etc like this you need to specify till the element that you want to refer for substituting in place of variable.

Eg: payload:MT_src,1,Root,2,MaterialNo,1(i.e refer to first occurrence of materialno in second occurrence of root in the message)

Regards

Priyanka

Former Member
0 Likes

Hi Sunitha ,

I want to get the file name as it is from the sender where the file name will not be unique .

EX:A)20111004-002345-100 B)20111004-00123-200

Regards,

Lavanya

naveen_chichili
Active Contributor
0 Likes

Lavanya,

Variables can refer to attributes of message header, by adding the prefix message:message heade

The message header attribute supported are:sender_party,sender_service,receiver_party,receiver_service,interface_name,interface_namespace,message_id,

message_id_hex

so you can give as message:any of the above

refer:

and also Variable Substitution in http://help.sap.com/saphelp_nw04/helpdata/en/bc/bb79d6061007419a081e58cbeaaf28/content.htm

Regards,

Naveen

Former Member
0 Likes

Hi Lavanya,

You want the same filename at receiver side??

then go for ASMA properties...

Regards,

Sunitha

Former Member
0 Likes

Hi Sunitha ,

My scenario has no IR only Integration directory .

The sender file name is not unique (a,b,c,d) ,it is a text file and the receiver has to pick those all files and place it to same directory.

Regards,

Lavanya

Former Member
0 Likes

You can put . if all the files are relevant for your scenario.

--Divyesh

Former Member
0 Likes

Hi Lavanya,

Is your source filename will be a field from your payload?

If yes then in variable substitution,

payload:Message type name,1,source field,occurance

If the structure is like

Message type

-->root

-


>field then,

payload:Message type name,1,root,occurance,field,occurance.

Former Member
0 Likes

Hi Divyesh,

From sender it will be a txt file but receiver should be an xml file ,so can I give .xml in file sceheme?

Regards,

Lavanya

Edited by: Lavanya Balanandham on Oct 4, 2011 3:31 PM

Former Member
0 Likes

Yes, you have to mention .xml in file shcema of receiver comm channel..

Former Member
0 Likes

Hi

Is it possible to convert the TXT file into XML file ?? as I have created the Scenario without Repository Objects .

Regards,

Lavanya

anupam_ghosh2
Active Contributor
0 Likes

Hi Lavanya,

There is an alternative approach to meet your requirement. You need this UDF in any of your message mapping within your scenario.


public String getFileName(Container container){
 DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);

DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");

String ourSourceFileName = conf.get(key);

ourSourceFileName=ourSourceFileName.replaceAll(".txt",".xml");

conf.put(key, ourSourceFileName);
return ourSourceFileName;
}

Map this UDF to any root of the target XML which has no other elements mapped onto it.

Ensure the following events

1. Sender Communication Channel has ASMA properties and file name ticked

2. Receiver Communication Channel has ASMA properties and file name ticked

3. "fail if ASMA missing" tick this in receiver CC.

3. UDF has no input as variable

4. In receiver communication channel -> File access parameters-> File name scheme -


> put a default filename with XML extension such as default.xml. This is not a mandatory step.

Finally following link will be useful http://www.saptechnical.com/Tips/XI/ASMA/Index.htm

Hope this helps.

regards

Anupam

Former Member
0 Likes

Lavanya,

Your scenario is like this ?

Source file name : abcd1234.txt

Target file name" abcd1234.xml

Then you can do that by clicking ASMA in both file adapters and writing file name value from Dynamic configuration to one of the message header of XI(like interface_name) and read that variable name during receiver file adapter by using DynamicConfiguration Bean module.

--Divyesh

Former Member
0 Likes

Hi Divyesh,

I gave .txt and able to see all the files from sender but in receiver all the files are not of the sender file name but with name as .txt

EX:

Sender file name:201199.100.300.txt

Receiver file name : .txt

and cant use dynamic configuration as my scenario doesnt have Repository Objects .

Could you suggest me on this

Regards,

Lavanya

Edited by: Lavanya Balanandham on Oct 4, 2011 7:50 PM

Edited by: Lavanya Balanandham on Oct 4, 2011 8:08 PM