Sorting in mapping

Hi all
I  have scenario where a file comes in and we need to sort by 4 fields branch/date/tran-code/tran_no?
After we sort the file we need a context change to see what line items belong together and return the correct value for that fields in the line item.
Regards

Hi,
  I thing your source structure like below.
<Recordset>
      <Structure>
      <Structure>
  <Recordset>
      <Structure>
  <Recordset>
      <Structure>
That time only you get the context change as per your structure.
Map like below..It will solve your problem.
(recordset)---->Change the context to Recordset
branch(Recordset)---
  date(Recordset)---concat--
  tran-code(Recordset)------concat--
  tran_no(Recordset)----------------concat--sort(Lexicographical(case insensitive),ascending)-------
---Collapsecontext--E1BPACCR08
branch(Recordset)---
  date(Recordset)---concat--
  tran-code(Recordset)------concat--
  tran_no(Recordset)----------------concat--sort(Lexicographical(case insensitive),ascending)--Item
branch(Recordset)---
  date(Recordset)---concat--
  tran-code(Recordset)------concat--
  tran_no(Recordset)----------------concat--sortByKey(Lexicographical(case insensitive),ascending)---
-----------------------------------------------------------------------------------SplitByValue(EachValue)--AMT_DOCCUR
  Amt(Recordset)----------------------------
Regards,
Prakasu.M

Similar Messages

  • ForEach sort on Map values

    Hi,
    Is there any way to sort a map values using ForEach droplet.
    Thanks,

    Could you pls explain a little bit more.In order to sort Map elements by key, set the value as follows:
    {+|-}_key
    For example:
    <dsp:param name="sortProperties" value=" _key"/>See sortProperties section:
    http://docs.oracle.com/cd/E23095_01/Platform.93/PageDevGuide/html/s1316foreach01.html
    -RMishra

  • Sorting while mapping

    Hi,
    I have an source IDOC that contains different subnodes (infotypes) at the same level.  Is it possible to sort by a certain field (for e.g. PerNum) while mapping
    My target datastructure looks like the following:
    E1P0000 (InfoType 0000)
    +PerNum
    +Subtype
    +OtherElements
    E1P0001 (InfoType 0001)
    +PerNum
    +Subtype
    ++OtherElements
    Thanks,
    Basant Gupta

    Hi,
    You can try using standard 'SORT' function.
    Regards
    Vijaya

  • Sorting map by value

    I need to sort a map by value, or just display its contents by value (in descending order). The value is an int. I'm using a treemap, but I'm guessing it's impossible to sort it by anything but the value...then again i'm not really sure.
    I've tried so many things, but I'm not experienced with maps so I'm having trouble.
    Thanks.

    Here is a class I wrote which will return a list of map.entrys in the order your comparator requires. Unfortunately, there is no way to get a Map sorted by values, only keys.
    import java.util.ArrayList;
    import java.util.Collections;
    import java.util.Comparator;
    import java.util.List;
    import java.util.Map;
    public class MapValueSorter {
         public static <K, V> List<Map.Entry<K, V>> sortValues(Map<K, V> unsorted, Comparator<V> c) {
              List<Map.Entry<K, V>> orderedList = new ArrayList<Map.Entry<K, V>>();
              Comparator<Map.Entry<K, V>> entryComparator = new MapEntryValueComparator<K, V>(c);
              for(Map.Entry<K, V> entry : unsorted.entrySet()) {
                   int insert = Collections.binarySearch(orderedList, entry, entryComparator);
                   if(insert<0)
                        insert = 1-insert;
                   orderedList.add(insert, entry);
              return orderedList;
         public static class MapEntryValueComparator<K, V> implements Comparator<Map.Entry<K, V>> {
              private Comparator<V> valueComparator = null;
              public MapEntryValueComparator(Comparator<V> c) {
                   valueComparator = c;
              public int compare(Map.Entry<K, V> entry1, Map.Entry<K, V> entry2) {
                   return valueComparator.compare(entry1.getValue(), entry2.getValue());
    }

  • Sorting Map on values rather than keys

    Is it possible that I can have a Map which is sorted based on values rather than keys ?
    If not is there an alternative.
    Basically I have keys as strings and values as integers.
    The values keep incrementing and at the end I want to get the top 50 keys based on the values.

    Sorting a Map by values is not a good idea, I did something similar before, it doesn't support the design, but it is better in performance, which is implementing a custom class (name it Record) that contains two members: key and value, create a record and insert it into a SortedSet e.g. TreeSet.
    make sure to do the following:
    1. This custom class must implement Comparable and compares two values
    2. Override euqlas method and accept strings (check using instanceof) then compare it to the key so you can retrieve the records using the key (to let it work as a map)
    Now you have a sorted set with key,value pairs, use the add method to insert a new pair, use the remove to retrieve the desired object and the set is already sorted :)
    Regards
    Mohammed

  • Order05 Idoc mapping in SRM XML Structure

    Hello All,
    I need to map Idoc order05 from ERP system into SAP provided SRM XML Structure.
    Anyone has done this sort of mapping before.
    Let me know the details as XML has got some 4800 fields and Idoc has some 800 fields and SRM XML seems to be superset of Idoc from ERP.
    Regards,Pankaj

    Hello,
    this is the java map code.just compile it and made a .zip file import it and use it Interface Mapping.
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.AbstractTrace;
    import com.sap.aii.mapping.api.StreamTransformationConstants;
    import java.util.Map;
    import java.io.*;
    public class PayloadToXMLField1 implements StreamTransformation {
        String strXML = new String();
       //Declare the XML tag for your XML message
       String StartXMLTag = "<DocumentBody>";
       String EndXMLTag = "</DocumentBody>";
       //String StartXMLTag1 = "<Code>";
       //String EndXMLTag1 = "</Code>";
        AbstractTrace trace;
        private Map param = null;
        public void setParameter(Map param) {
            this.param = param;
        public void execute(InputStream in, OutputStream out) {
            trace =
                (AbstractTrace) param.get(
                    StreamTransformationConstants.MAPPING_TRACE);
            trace.addInfo("Process Started");
            try {
                StringBuffer strbuffer = new StringBuffer();
                byte[] b = new byte[4096];
                for (int n;(n = in.read(b)) != -1;) {
                    strbuffer.append(new String(b, 0, n));
                strXML = strbuffer.toString();
            } catch (Exception e) {
                System.out.println("Exception Occurred");
            String outputPayload =
                StartXMLTag
             + "<![CDATA["
             + strXML
             + "]]>"
             + EndXMLTag;
            try {
                out.write(outputPayload.getBytes());
             trace.addInfo("Process Completed");;
            } catch (Exception e) {
                trace.addInfo("Process Terminated: Error in writing out payload");;

  • How to implement Comparator in Map

    hi,
    Can any one explain how to implement camparator interface in map. i want to sort the map by the values stored.
    Thanks in advance.

    H&#111;ly Chr&#105;st!
    We are being overrun by double posting numbnuts today.

  • GMAP/maps in webi report

    Hi All,
    I want to use GMAP or any sort of map in webi report.
    Is this possible to make webi report interactive?? I dont want to use Xcelsius 2008.
    Please suggest possible solution.
    Environment is  BO XI 3.1 SP3

    Bram,
    This formula you used above is corrcet but is returning you a character '0' and when a descending sort is applied character values will be at the top.
    So , apply the formula 'ToNumber' on the value returned form the above formula :-
    ToNumber(above formula)
    And then it will change 0 to number and give you the exact sort order.
    Thanks,
    Rohini Haksar

  • Idoc Order05 Mapping into SRM PO XML Structure

    Hello All,
    I need to map Idoc order05 from ERP system into SAP provided SRM XML Structure.
    Anyone has done this sort of mapping before.
    Let me know the details as XML has got some 4800 fields and Idoc has some 800 fields and SRM XML seems to be superset of Idoc from ERP.
    Regards,Pankaj

    Hi Lynton,
    the source structure is an XML purchase order. There is a business package available in XI for SAP SRM 5.5 SERVER (that's SRM 5), you will have to load this in XI and use the XML purchase order structure in that business package, this is your source message. Mapping is generally done in XI, so you don't have to implement any BADI.
    In SRM customising you have to activate the use of Exchange Infrastructure and make some settings for the use of XI.
    In the vendor master you will have to change the sending method to XI/XML, this will then automatically create the correct output for that vendor. You can look at this using the SXI_MONITOR transaction (or SXMB_MONI) after ordering a PO.
    Regards,
    Robin

  • How to sor hash map

    Hi,
    [b] how to sort hash map contains integer objects,
    HashMap map=new HashMap();
    map.put("1",new Integer("1"));
    map.put("2",new Ineger("2")):
    map.put("3",new Ineger("3")):
    map.put(4,new Integer("4"));
    map.put("10",new Integer("10"));
    map.put("11",new Integer("11"));
    map.put("12",new Integer("12"));
    map.put("20",new Integer("20"));
    map.put(30,new Integer("30"));
    if i am using treemap
    TreeMap map1=new TreeMap(map);
    System.out.println(map1);
    answer is
    1 ,10,11,12,2,20,3,30,4
    but i am accepting the results
    1,2,3,4,10,11,12,20,30.
    what to do
    with regardsshannu sarma[/b]

    This is usual behaviour of a Map. You cannot sort a Set or Map. You can sort a List only using Collections.sort().
    If you want to use a Map which adds all elements according to the order you've added it, then use LinkedHashMap.
    And if you want to capture the keys, use Map.values() which returns an ordered Collection (and after converting it to List, you can sort it).
    Another approach is to create a wrapper object and put it in a List. Then you can use the java.util.Comparator to sort objects in a List.

  • A map to keep track of classes and interfaces of all api's

    Sorry because of my english, i hope someone can help me by telling me if there is a sort of map or schema in which graphically be deployed all api's clases in a uml style; i wish that resource exists and be able to be downloaded for free; if someone replies my answer thankyou very much.

    smithdale87 wrote:
    i dont think you will find a UML of all classes and API's.
    The closest I can get you is http://java.sun.com/javase/6/docs/api/
    Experiment with these links at the top of the page - Overview, Package, and Tree
    Selecting Overview and Tree shows all of the class hierarchy.
    Selecting Package and Tree shows it for that package.
    This is close to what you want.

  • Custom Sorting in TreeMap.

    Can I sort the contents of TreeMap according to values.
    As default TreeMap is sorted according to Keys. But I want to sort it according to values. Can I met this using comparator?
    Thanks in advance for your help.

    no, you cannot. besides sorting, the comparator is used by the treemap to locate keys/values given an arbitrary key. if you sorted the map based on the values, you would never be able to find anything in it by key.

  • Refresh/Update data in a materialized view

    Hi,
    I have question about the data in a materialized view and how it is refreshed. My mat view has all my dimension-ids and my (for my specialize needs) aggregated measures from my fact table. I used the mat view wizard to create my view - which works perfectly. But now I wonder if I have to create some sort of mapping(?) or some sort of trigger to refresh the data in the mat view. Or is the data automatically refreshed when I start my fact table mappings. I use OWB 11gR2
    thx

    MVs have properties for refresh - you an refresh based on schedules or when dependent data is committed or manually.
    Cheers
    David

  • Empty string in an array :(

    Hi, im new here and stupid :D
    I have an assignment to do and im really stuck on this bit. I have 2 arrays, 1 of heights and 1 of towns -
    private int[] spotHeights = { 100,  // At 0 km
    120,120,150,120,200,200,210,220,230,240, // Heights at 1-10 km
    300,300,300,250,250,200,150,150,150,130, // Heights at 11-20 km
    120,120,150,120,200,200,210,220,230,240, // Heights at 21-30 km
    300,300,300,250,250,200,150,150,150,130, // Heights at 31-40 km
    120,120,150,120,200,200,210,220,230,240 }; // Heights at 41-50 km
    private String[] towns = { "Berwick",  // At 0 km
    "","Edinburgh","","","","Falkirk","","","","", // Towns at 1-10 km
    "","","","","","Stirling","","","","", // Towns at 11-20 km
    "","Doune","","","","","","Dunblane","","", // Towns at 21-30 km
    "","","","Ashfield","","","","Kinbuck","","", // Towns at 31-40 km
    "","","Perth","","","","","","","Aviemore" }; // Towns at 41-50 km
    What i have to do is draw a dot where there is a town on a sort of map thing. Only thing is i dont know how to check whether there is something in the array or not... I hope you understand what im asking and u can help me :D That would be great.
    Thanks
    Awe

    ok, in the second array, theres lots of "" and that means theres nothing in that part of the array. Well i need to know how to find out whether there is something in the arrays or not :/ hard to explain... i think its something like variable.equals[""] but that never works, maybe im doing it wrong.

  • Can Java be used for this?

    Hi. As a hobby, I have built a game with a development tool called Macromedia Director.The game is a 'virtual tabletop' that allows people to play a variety of role playing games over the internet that are traditionally played in a face to face setting at a real table.
    Due to some shortcomings with Director I am looking for another language to program the game.I currently use an old version of Director and upgrading is expensive. Director also has limited cross platform support (no Linux). Finally, the future of Director is in question as Macromedia was acquired by Adobe and they have already end-of-lifed some of the acquired products.
    My game consists of some basic features. One user runs a server application that accepts connections from the client application. Once connected the cleints can do basis text chat. There is die rolling function. Finally there is a feature for the referee to send pregenerated images to the players, typically some sort of map. The image can be hidden from the players and revealed in pieces by the referee. I also plan on adding a shared whiteboard feature for creating on the fly images.
    I have done some preliminary investigation and it seems that Java is one of the obvious choices. The socket programming seems to be straight forward and allow you to create a similar client/server application. Swing covers building the GUI. What I am not clear on is the graphics capability of Java. Director has a fairly powerful graphics engine allowing you to work with 32 bit graphics (alpha channels) and pixel manipulation.
    It seems like Java can do all this, but I want to make sure before I invest to much time. You can see screen shots of my game at http://www.v-fort.org. It's definetly not a polished product. There are many of these types of programs already.I just do it because I enjoy programming (and gaming too). I appreciate any suggestions. Thanks
    -- Dave

    Java is it!

Maybe you are looking for