cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping condition in multi mapping

Former Member
0 Kudos

Hi Experts,

I have a 1:n multimapping where I have a mapping condition such that

If the field is empty ith should throw an error.

At the same time the n-1 records should be processed...

The UDF i have used is

if (a == "")

throw new RuntimeException();

else

return a;

As of now the entire interface fails ...

Any idea on what I should do???

Accepted Solutions (1)

Accepted Solutions (1)

former_member187339
Active Contributor
0 Kudos

Hi Ravindra,

We had a requirement like this earlier we followed this approach:

1. Used multimapping to differentiate valid and invalid records.

2. And place all the invalid record as a separate file in separate folder

3. Created a mail scenario to pick the file and send to the appropriate person

Regards

Suraj

Former Member
0 Kudos

Hi Suraj,

I have a csv file to rfc scenario..and to make multiple calls to bapi ....

as i use extended interface determination..im unable to use conditional determination...

In receiver determination..If i put the condition ..as soon as a condition is valid for one record..all records get processed...

any ideas on how to proceed for this???

former_member187339
Active Contributor
0 Kudos

Hi Ravindra,

>>as i use extended interface determination..im unable to use conditional determination...

and in thsi you are converting only valid records to bapi right??In addition to this add one more interface determination and collect all invalid records.. and use a receiver agreement and communication channel to write all these invalid records as a file...

Also in receiver communication channel choose the option to ignore if empty files.. so if any invalid records are there it will be written as a file.. else no file will be generated

Regards

Suraj

Former Member
0 Kudos

Thanks for the idea Suraj...

It works

Answers (2)

Answers (2)

Former Member
0 Kudos

Since you are using 1:n mapping, I think you can build this logic in mapping for the rootnode of BAPI. Check the condition for field for each record and create BAPI message only when the condition satisfies.( To do this map the first node after Messages,Message1in target structure with the condition using 'if without else' fn and the remove contexts)

So if u have n records and one of them fails the condition then n-1 BAPI's calls will executed. To get notification about the failed record create one more MT for target. In mapping go to 'Messages' tab and select this along with original target MT. The occurance of both target MT's should be 0..unbounded. Now build the logic such a way that the failed record satisfies condition for second MT. So this message will be triggered only for failed records.

Now you can get notified by this message to your email using mail adapter.

So out of n records, n-1 will converted into BAPI calls and 1 be sent as mail to inform the failed record.

Edited by: nagarjuna _s on Nov 11, 2009 9:35 AM

rajasekhar_reddy14
Active Contributor
0 Kudos

He ravi,

Ig you thow an exception,then you interface will fail when the condition true and you will see red flag in moni,its not a adviceble to use throw exception in UDF.

Check the condition mapping its self without using UDF.Why you are using runtime exception??

Regards,

Raj

Former Member
0 Kudos

Hi Rajashekhar,

Can u advice how I can go about it??

I just want that one record not carrying the data to fail..all other records should go thru..

How can i do this?

Pls suggest?

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Ravi,

When you want stop the process there is no value for one filed,

1)its not possible to exit the flow ,you need to complete it,otherwise if you throw an exception using UDF as i mentioned it will show as red flag and interface fail.

2)Send a mail to corresponding person if there is no data for one feld,and complete the interface like this.

what you want to do if there is no data fro one filed,just exit without any alert??

Regards,

Raj

Former Member
0 Kudos

Yes I will throw an alert which will trigger a mail..

but my main requirement is if there 99 records with the data and one record without the data

I want the 99 records to be processed and that one record to fail...

any idea what I should do???

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Ravi,

This 99 records coming in one file or yor are reading one record at a time ??processing 99 records as individual messages??

clarify above points.

Regards,

Raj

Former Member
0 Kudos

Its actualy a csv file with say 100 records...

Im using 1:n mapping

Im calling a BAPI with RFC adapter..

Edited by: Ravindra Teja on Nov 11, 2009 8:44 AM

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi Ravi,

What i understood your requirement is suppose if you have 100 records in one file you are sending as a individual BAPIs messages ,if there is no value for certain filed you need to stop the process and with alert email.

my solution for this read one record at a time from CSV,set record set per message value in sender file adapter is 1,it reads one record at a time,then check the condition in mapping,use enhanced receiver determination to check the condition.

Create one service for sending an email,use mail adapter,one bussines system for RFC.

if your condition fails(no value)then cal service to send an email,if condition succes then sal bussiness system in and develope interface mapping for the same.

You need to check the every record ,i think you can use my approach,any clarifications needed let me know.

Regards,

raj