cancel
Showing results for 
Search instead for 
Did you mean: 

sort and filter

former_member188791
Participant
0 Kudos

Hi Group,

I am working on Message mapping where I need to select the record which having lowest price based on material , for example

if I have 5 records with material and price , I need to select one record with lowest price.

Material         Price

--------         ------

900               10.00

901                5.00

902                3.00

903               15.00

904                4.00

output should be

902               3.00

Can any body suggest how I can achieve this in graphical mapping.

Accepted Solutions (1)

Accepted Solutions (1)

azharshaikh
Active Contributor
0 Kudos

Hi Rajiv,

As suggested by Muniyappan abv..the following mapping sud give you the desired values..

Set Context of Price & Material fields to Parent level and Select Sort order as Ascending.

Regards,

Azhar

former_member188791
Participant
0 Kudos

Hi Azhar,


Thank you ,but the above solution will  work on fileld level , for target parent node do i need to concatenate

azharshaikh
Active Contributor
0 Kudos

Hi Rajiv,

Based on your requirement, I assume that the Target Parent Node is with Occurrence 0..1

You can map a Constant [] to Parent Node...

Do you need to concatenate the Price+Material and map it to some target field? If yes, you can add a concat function from the Text group after the CollapseContext and map the Output to the required target field.

Regards,

Azhar

former_member188791
Participant
0 Kudos

Hi Azhar ,

My requirement is , I am getting 5 fields at source side I need to select material with lowest price for example 5 matetrials with each one having 10 records out of 10 I need to choose one record with least price , the selected record 5 fields should map to target

azharshaikh
Active Contributor
0 Kudos

Hi Rajiv,

Can you provide the screenshot of your message mapping with Source n Target Structures..

What I understand from your abv post is that there can be multiple Price (same lowest value) and all those needs to be mapped to target alongwith the Material?

Can you also give sample Input and required Output...

Regards,

Azhar

former_member188791
Participant
0 Kudos

Sorry Azhar ,its my fault , here I am attaching sample of my Input and out structures:

Material     PriceCat
--------     ------   ----
900           10.00 11
900            5.00 12
900            3.00 13
900            7.00 14
901           20.00 15
901           25.00 11
901           23.00 12
901           27.00 13

....

....

....

output should be

900           3.00 13
901          23.00 12


azharshaikh
Active Contributor
0 Kudos

Hi Rajiv,,

Seems you want to select the lowest Price amongst the Materials with same number rite?

For Material 900..of 4 values you want the lowest Price 3.00 to be mapped rite

And for Material 901...u have selected 23.00?? don't you want to select the lowest price here as well? On what bases you have selected this value

Also is there any context change when when there is change in Material Numbers?

Regards,

Azhar

former_member188791
Participant
0 Kudos

Yah ur correct for 901 also lowest price I need to select i.e

901           20.00 15

yes there is a context change for each material number

azharshaikh
Active Contributor
0 Kudos

Hi Rajiv,

Please check with the following logic....

(Add the Mapping for Cat field in the same mapping area with similar mapping logic as shown for field Price)

Regards,

Azhar

azharshaikh
Active Contributor
0 Kudos

Hi Rajiv,

The complete mapping (with Cat field ) would be as follows:

(Assuming Material will come in the Sorted Order as shown in your Sample example)

Hope it helps

Regards,

Azhar

former_member188791
Participant
0 Kudos

\Thank you Azahr for your help , its all working

Answers (1)

Answers (1)

Muniyappan
Active Contributor
0 Kudos

use sort and sort by function:

http://scn.sap.com/people/stefan.grube/blog/2005/12/29/new-functions-in-the-graphical-mapping-tool-x...

in the end result you can use collapse context to get the first value.