cancel
Showing results for 
Search instead for 
Did you mean: 

Sending multiple mails using Mail Package

shweta_walaskar2
Contributor
0 Kudos

Hi,

I have a requirement where XI would pick CSV files from R/3 directory.

Every record in this file contains an email ID.

All records having same email ID have to be collected and sent to that email ID.

In this way,a number of emails will be generated for every file based on the number of email IDs present in the file.

I have changed the occurence of target Standard Mail Structure for using Mail Package to 0..unbounded.

and used the logic:

emailid field->sort->splitbyvalue(value changed) -> collapsecontexts->Mail

in test tab I can see the correct result and message is successful in SXI_MONITOR

but in RWB,I am getting this error:

java.lang.IllegalArgumentException: can't parse argument number http://sap.com/xi/XI/Mail/30

Can anyone please help?

Thanks.

Regards,

Shweta

Accepted Solutions (1)

Accepted Solutions (1)

former_member200962
Active Contributor
0 Kudos

if your mail-body is not going to change for every email-id then no need to change the occurence of the Mail structure.....just stuff all the emailids in the To node with ";" as a separator.....may be because you have changed the occurence you are getting the error.

Regards,

Abhishek.

shweta_walaskar2
Contributor
0 Kudos

Hi Abhishek,

Mail body is not same.For ex: my file is:

123;emailadd1;565;66;sdsfg;hyrt

244;emailadd2;565;78;hvcvc;hgh

then,I need to send 123;emailadd1;565;66;sdsfg;hyrt to emailadd1

and

244;emailadd2;565;78;hvcvc;hgh to emailadd2

I hope I could explain it in better way now.

Thanks.

Regards,

Shweta

Former Member
0 Kudos

Hi Shweta,

Mail adapter will not support the message Split concept.

Try using simple BPM steps for your requirement.

Like,

Receiveu2014Transformation u2013Block(For each)u2014Send--Block

Transformation Step(Use your mapping which you had created)

Regards,

Prakasu.M

shweta_walaskar2
Contributor
0 Kudos

Hi Prakasu,

Thanks for the reply.

I too realised this.

Is there any way ,except BPM,RFC lookup?

Regards,

Shweta

Former Member
0 Kudos

Hi Swetha,

There is simple solution for this.

Here you have to split the interface as two.

Pick the file and split it into the file based on the mail id and store it into the Dummy folder.(Any folder of your PI system).create one file for each mail id.

Then pick the file from this folder and send it to mail through mail adapter.

Finally your interface will be as follow.

1) File-PI---File(each file for one mail id)

2) File--PI-Mail

This will work with out BPM

Regards

Ramesh Varanganti

shweta_walaskar2
Contributor
0 Kudos

Hi Ramesh,

Thanks for the suggestion.

I would confirm if they allow us to create intermediate files.

Thanks again.

Regards,

Shweta

shweta_walaskar2
Contributor
0 Kudos

Hi,

Finally,I could do this using BPM:

Receiveu2014Transformation u2013Block(For each)[Transformationu2014Send]

Thanks a lot to all who have helped in resolving this issue.

Regards,

Shweta

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi Shwetha,

I Expect You can create an UDF in the Mapping and Use this to filter the Duplicate values:

Just Put SORT-- >The The Unique value UDF

The code for Unique values(UDF) is as follows:

public void Unique_Value(String[] a,ResultList result,Container container){

//write your code here

String value = "";

for (int i = 0; i < a.length; i++) {

if (value.length() < 1) {

value = a<i>;

result.addValue(a<i>);

}

if (!a<i>.equals(value)) {

//result.addValue("NONE");

value = a<i>;

result.addValue(a<i>);

}

}

}

Hope this helps you out....

Regards,

Sainath Chutke

shweta_walaskar2
Contributor
0 Kudos

Hi Sainath,

Thanks for the detailed code.I was able to do the same using above mentioned logic.It works fine in Test tab but fails at RWB.

Do you have any idea?

Thanks.

Regards,

Shweta

former_member192295
Active Contributor
0 Kudos

Hi,

This problem is due to email id string, remove ; after end of last email id, this will work without fail.

shweta_walaskar2
Contributor
0 Kudos

Hi ,

From where should I remove this string?

Thanks.

Regards,

Shweta

former_member192295
Active Contributor
0 Kudos

Hi,

No need to change any occurrence because we are passing mail id as string. We are using ; between two mail ids. In string last mail id remove ; it will work.

str = a;b;c

I hope now clear