cancel
Showing results for 
Search instead for 
Did you mean: 

how to map to ignore duplicates

Former Member
0 Kudos

Hi all,

My interface is ( EDI 810 formate) file  to Idoc Scenario.

In this my input is having some duplicate records in one file.we have to find the duplicate and we will ignore that duplicate record.

How to change  the mapping ??

  1. 1. Invoice number
  2. 2. Invoice date
  3. 3. Amount
  4. 4.vendor number 

plz any one give the idea to find duplicates


Thanks in advance.


regards,

Raj

Accepted Solutions (0)

Answers (6)

Answers (6)

RaghuVamseedhar
Active Contributor
0 Kudos

RajiReddy,

Please check . It has example with one key field. You can write UDF with 4 key fields (field1+field2+field3+field4 will be key string).

Former Member
0 Kudos

HI all,

One  more i forgot to tell you

here  i have to create one alert based on duplicate.

whenever duplicate is occurs on that time alert send one mail.

regards,

Raj

Former Member
0 Kudos

Hello Raj,

the easiest way to solve this, is to leave this message mapping as it is and create another message mapping that you put into your operation mapping before the existing one.

This new mapping should map from EDI 810 to EDI 810 and only remove your duplicates.

To remove the duplicates, you can use "sort" --> "split by value (value change)" -> collapse context

This will do the following:

Inputsortsplit by value (value change)collapse context
3111
311 (context change)2
2223
122 (context change)
233
133 (context change)

You need to use "sort by key" to sort all other elements on the same level and lower levels.

I didn't get, if you need to remove duplicates only, if all four fields are the same.

If so, you can "concatenate" all four key-fields before.

To keep it simple and easy to debug, you should just create another message mapping with a new field containing the concatenated fields.

After that, do the sorting on the concatenated field - as explained above.

Your second requirement to send a mail whenever there are duplicates can then be solved quite easly - at least, if you don't need details in your mail. Two solutions approaches:

1. Make your operation mapping a multi-mapping: One incoming service interface - One outgoing + an optional service interface sending mails

2. User a UDF (not much coding to copy) and send the mail via Mailadapter directly from the mapping

For both approaches you need to find out, if duplicates were found. You can do this for example by counting elements and using a "If without else".

Former Member
0 Kudos

Hi Heiko Konert,

I am done the mapping ,' Thank you for your response.

And when i am testing in Mapping level Both mappings are working fine. but the problem is when i am testing in Operational mapping i got below error .

Please some help out .

Runtime Exception when executing application mapping program com/sap/xi/tf/_EXTOL_EDI810_to_SAPECC_FIDCCP02_; Details: com.sap.aii.utilxi.misc.api.BaseRuntimeException; com.sap.aii.mapping.api.UndefinedParameterException: The input-parameter Channel does not exist. See error logs for details

Input payload is corret becz i am using the payload that is working in individual mapping is correct.

Please help.

Thank you in advance

regards,

Raj.

Former Member
0 Kudos

Hi Raj,

this happens if you specified a Parameter in the message mapping, but didn't assign it to any value.

Former Member
0 Kudos

Hi Heiko Konert,

I have done the change in mapping and client has tested that and given feedback.

my mapping is

And they given feedback as

Node1,2, & 4 have the same invoice number: 17181. 3rd node has a different invoice number: 17182.

In the output mapping, Only 2 nodes are coming. However, the values from node-4 are populated (instead they should have been from node3).

Problem: You should not use the sort function in the mapping.

Solution1: If you use sort at the node level you should use it at every field that you map below it.

Solution2: the duplicate UDF should be able to find the duplicate without the use of sort function.


How to do without sort using Duplicate.

Please advise.(

Tell me the procees using  solution 2.

Thank u

regards,

Raj

Former Member
0 Kudos

Hi all

thank you for your response...

But my doubt is i have to map based on Four fields in receiver side..for duplication.

but here they are already mapping is done individually.

Receiver fields:

invoice number : XBLNR

Invoice date:   BLDAT

Amount      WRBTR

Vender no   LIFNR

now we have to change total mapping or what?

Plase suggest..

Regards,

Raj

Former Member
0 Kudos

Hi,

You can use sort and after function splitByValue(Each Value). Will remove the duplicates.

Regards,

Jannus Botha

iaki_vila
Active Contributor
0 Kudos

Hi RajiReddy,

You can follow Azhar suggestion but previously you will need to use the Sort function if the duplicates registers are not consecutive.

Regards.

azharshaikh
Active Contributor
0 Kudos

Hello Raj,

How is your input payload? Can you share display queue / Input and required Output data...

Did you try to use collapseContext Node function...it will collapse the repeating values into single.

Test and check if it helps

Regards,

Azhar