on 10-10-2007 9:53 AM
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
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
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
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
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
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
User | Count |
---|---|
78 | |
10 | |
9 | |
7 | |
6 | |
6 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.