on 07-16-2011 5:24 AM
hi experts,,
i have a scenario, like follows,..i have to pick the files from ECC directory and need to send multiple files to multiple customers through PI.suppose file 1,2,3 ,4..these are my files in Some directory of ECC or suppose in PI .i need to send file 1 to customer 1,2, and cc as customer 3.file 2 only to customer 2 and 3. and file 3 and 4 need to send only customer 1,file 4 to all customers.
what i have a requirement is i need to chek the first four characters of a file so that i can send it to different customers whom ever it may concerns.
Advance thanks,
Hi Loordh,
Please check in sxmb_moni under dynamic configuration what filename you are getting. Also I hope you have checked the file name in ASMA in sender communication channel so that it picks the sender file name.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi sathish,
i checked in sxmb_moni ,,under Dynamic Configuration there i am getiing file name correctly as loordh.txt but if i see under Error it is showing condition is failing to determine reciever ..as i have given condtion in previous post.i tested '=' and '~' operators but of no use ..same error i am getting .
hi,
thnks for your inputs...i am using UDF for this to get file name based on file name i need to send it diffrent customers which i am assigning it in Reciever rule, same i am using it in Reciever Determination...can you please look into this udf i am getting some expceptional errors.
try
{
DynamicConfiguration conf = (DynamicConfiguration)container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create( "http://sap.com/xi/XI/System/File","FileName");
String FileName = conf.get(key);
conf.put(key, FileName);
key = null;
return FileName;
}
catch(Exception e)
{
String exception = e.toString();
return exception;
}
i am geting "java.lang.NullPointerException
when i tested in operational mapping
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
You cant test dynamic configuration in Message mapping or operation mapping test tab.
it will work only in runtime in a end to end scenrio.
you need to place the file in source folder and test the mapping in runtime.
Also dont forget to check the Adapter specific message attribute and filename in sender adapter
Your UDF is correct.
hi,
everything is working fine except only in receiver determination..there i used Reciever rule in that i have chcked my file name by using conext objects like as follows .
(File_Name u2248 loordh.txt) for this CC is loordh_bc
(File_Name u2248 allamudi.txt) for this CC is allamudi_bc
Here i am getting error.
can you help me out in this situation
This is pretty simple requirement. Do file to mail scenario. File as sender and mail as receiver.
If you get mail address information in the payload of the file , then use equals function of text (just use some standard functions) to achieve this. Map the address to 'to' mail data structure. Basically you need mail receiver structure and configuration.
if you are not able to handle using standard funtion due to requirements then use UDF.
Refer this [link|http://www.riyaz.net/blog/xipi-sending-emails-using-xi-mail-adapter/technology/sap/83/]
Hope that helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
thanks for inputs,,,but in my scenario they will give file name and common folder path then by using that file name i need to route to different receivers in receiver determination. so i am using one sender communication channle and suppose 6 receiver communication channel ,6 Rec.Agreements. one sender agreement.6 interface determination.i need to go with udf.i am new to udf ..there i am getting problem.
can you please help me in this case.
Hi,
This scenarion can be done with only one receiver.
You are creating 6 receiver because of 6 different mailing system? Or only Email address(To address) differs ?
If only difference is to address then you can use only receiver and create Mail TO address dynamically in UDF based on input file ame.
You can use the below UDF to read the sourcefile name in mapping and determine the Mail TO address and map it to target mail package structure TO field.
public String G_GetFileName(Container container) throws StreamTransformationException{
Sring mailTO="";
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);
if(ourSourceFileName.equals("File1.txt")
{
mailTO="cust1emailaddress";
}
else if(ourSourceFileName.equals("File2.txt")
{
mailTO="cust2emailaddress";
}
else If(ourSourceFileName.equals("File4.txt")
{
mailTO="cust1emailaddress;cust2emailaddress";
}
return mailTO;
}
Also refer this blogs.
http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/11287
http://www.riyaz.net/blog/xipi-sending-emails-using-xi-mail-adapter/technology/sap/83/
Hi,
If i am not mistaken u want to send messages to different receiver mail adapter based upon the file name....and u are going to use different mappings...
If yes...then u dont need to go for UDF's ..just CHK ASMA in file sender adapter...and in the Receiver Determination (under receiver sections) choose "context object" as File name and based upon the file name define ur receivers...
Thanks
Amit
Use Dynamic configuration in udf to achieve this. Basically you need to read the file name
DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
String SourceFileName = conf.get(key);
return SourceFileName;
Hope this helps.
Also search sdn for the above coding.. You will see plenty..
hi Roy,
If i am using the mail package ..i am not able to get the content. i am reading the filename but same name should come to mail attachment also,,,when i am doing like this i am getting mail attachment as some "untitled.bin"..when i open with notepad in that nothing is there.i am using only target mapping with udf,bcoz source nothing giving..everything i am reading by udf.kindly help on this.
Thanks,
Loordh
Hi
For populating all the fields of mail adapter dynamically please refer to my wiki
http://www.sdn.sap.com/irj/scn/index?rid=/library/uuid/603a7bd8-a6a0-2e10-388b-fc9cb9dae6c4
I think you can refer to this.
Regards
Sandeep
Hi,
You need to create a File to mail scenario.
Here in Mapping you need to dynamically genarate the Mail TO address .
You can Use Dynamic configuration to read the filename .
Or TO address if maintained in File content itself ten You can use Substring function or UDF to read it.
Create a file to Mail scenarion using mail package structure in receiver side.
Use this blog to create mail attachment in UDF in target mail package structure.
XI Mail Adapter : Dynamically building attachment and message body content using a simple UDF
http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/11287
http://www.riyaz.net/blog/xipi-sending-emails-using-xi-mail-adapter/technology/sap/83/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.