cancel
Showing results for 
Search instead for 
Did you mean: 

Property file

Former Member
0 Kudos

Hi,

I have a requirement, i need to identify receivers using property file.so what are the parameters should be passed in property file..

I also verified this blog

/people/sap.user72/blog/2006/06/07/property-file-a-smart-use-in-xi-context

But regarding parameters to be given in property file i am not clear with that blog.

Can any one explain me with detail steps..

Regards

Prakash

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

In which location i need to keep properties file..i kept the file in my computer desktop..i given path in UDF but while checking mapping some error is coming..

How to import "java.util.properties" in UDF..

Regards

Prakash

former_member192892
Active Contributor
0 Kudos

HI prakash,

You need to place the file in some accessible folder from XI server.

i.e. either you can place the file on some location in XI server

or you can place the file in some shared folder over the network.

About importing, just add the declaration "java.util.*;" in the imports..

Tell what error u r getting

Former Member
0 Kudos

Hi Varun,

I placed the file in XI server..Now the error in code is rectified..But while testing mapping error is coming..

I used message type "Receivers" from Sap Basis as target message

My source structure is

MT_MatInfo

>MatDet

MatNo

MatName

MatPrice

I mapped MatNo to Service..in this i added UDF for determining Receiver service

I also used code which is given as comment in the blog which i specified..

Whether my procedure is correct or not.

Regards

Prakash

former_member192892
Active Contributor
0 Kudos

Hi Prakash,

The Idea is to just pick up the property file key value for service name.

My UDF will be...

function(String serviceKey, Container container)

{

private properties _propSet;

_propSet= new Properties();

_propSet.load(new FileInputStream(("/home/xiuser/folder/xiprop.properties"));

String value = _propSet.getProperty(serviceKey);

return value;

}

Here pass the key as a constant to this UDF, and please test the mapping and tell me if you are getting any error

Former Member
0 Kudos

Hi Prakash,

try this piece of code it worked for me....

imports java.util.Properties;

public String UDF(String a,Container container){ //select cache-value

String value = new String() ;

Properties propSet;

try

{

propSet= new Properties();

propSet.load(new FileInputStream(("path/filename.properties")));

value = propSet.getProperty(a);

}

catch (Exception e)

{

}

return value;

}

cheers

Sunil

Former Member
0 Kudos

Hi Prakash

Why do you want to identify receivers using property file.

Property files are files ending with an extension of .properties, so lets say u call your property file as xi_receiver.properties

The content of the property file lets say can be just

xireceiver=RECEIVER_BS

Save the file in your XI system lets say in the folder usr\sap and create a folder there called properties, so the path becomes usr\sap\properties and save your xi_receiver.properties file there.

Next in your udf use the package java.util.Properties; in your imports.

Then code would be

Properties properties;

String rec = new String();

try {

properties = new Properties();

properties.load(new FileInputStream(("/usr/sap/properties/xiprop.properties")));

rec = properties.getProperty("xireceiver");

return rec;

} catch (Exception e) {

e.printStackTrace();

//Disconnect the connection

}

hope it helps.

regards

Sameer

PS: But i still believe properties file is not the best way to identify receivers, you can use Enhanced Receiver determination for this.

former_member192892
Active Contributor
0 Kudos

Hi Prakash,

You need to use Enhanced receiver determination in this case.You need to create a mapping program with your source payload and receivers message type.

The receivers message type can be found in SAP BASIS softwate componenent under the namespace. http://sap.com/xi/XI/System

Nou in your mapping program, you need to write an UDF which will determine the receiver from the source payload value using the properties file.

Please ask if u need further clarifications

Former Member
0 Kudos

Hi Varun

Thanks for replying earlier i did enhanced receiver determination in that i write UDF to determine receiver based on some condition.

Now i need to determine the receiver using property file so if possible send some links or documents regarding property file.

What are the parameters to be given in property file..

Regards

Prakash

Former Member
0 Kudos

Prakash

Was the answer useful, if yes close the thread by awarding points.

regards

sameer

Former Member
0 Kudos

Hi Sameer,

In the properties file is there any other parameters to be passed..U given one UDF can u explain its function in detail steps

In the blog they given some values in properties file.

So in my scenario i need to give only receivers name.?

Regards

Prakash

Former Member
0 Kudos

Hi Prakash

You should tell me what you need in the properties file. The properties file in the weblog is specific to the requirement of the author of that weblog.

The UDF I gave will load the property file and then you retrieve the values from the properties file using properties.getProperty("NAME OF THE PROPERTY TO BE RETRIEVED");

As far as I understood you want the properties file for receiver values right, so you can store the value of receivers there, I just gave an example, you customize it according to ur req.

regards

Sameer

former_member192892
Active Contributor
0 Kudos

Hi Prakash,

Basically the logic used in properties file is like fix value mapping standard function in XI.

There would be a key and a corresponging value in properties file. like

Filename=myfile.txt

If you make this entry in your properties file, then for the key "Filename" the value would be "myfile.txt"

you can add comments in your properties file by adding a # at the begining of a text