Skip to Content

A practical implementation of Shortest Path Problem in XI (Part II)

This blog gives a complete technical insite in the practical implementation of the solution to Shortest Path Problem in finding the shortest distance.   h2. Input XSD Structure describing city routes and distances       h2. Diagrammatic representation of the cities and routes    image     I had given some city names in my country for easy understanding. I want to find the shortest distance from the capital, Delhi to my native, Tuticorin.    h2. The Input XML      h2. Designing the scenario in Integration Builder     First we had to create nine message mappings for all the nine cities. All these message mappings differ only by a constant mapped to source tag in the input.    h3. What does a single message mapping does?   A single message mapping for a city populates the complete result tag in input xml and gives as output. When it populates, it makes sure that the final value before the xml goes out of message mapping, is not from the source in message mapping to the destinations, but from the original source to the destinations in the tags. The value for a source to destination is lookup from the data in database tag and populates it in the result tags in XML. Before populating, it makes sure that, the value is least in the possible routes.    h3. How to design the required message mapping?    image     Take a sample message mapping for example. Both the input and structures are same. Only one field namely, target is mapped.    h3. How target node is mapped?    image   h2. The four user-defined functions     In all the below functions, tgt = target (result tag), src = source (result tag), db_tgt = target (database tag), db_src = source (database tag)    h3. Populate    image     The source in results tag is just an attribute. The above function creates ‘target’ number of elements as output.    h3. GetTargetValue           h3. ReverseRoutes    image     The above function enables the algorithm to work for source to target as well as target to source while processing.      h3. ContextChg    image     In the database tag in input XML, you can find that there is only one source tag for ‘n’ number of target tags. The above function duplicates the source tags equal to no of target tags.    h3. The Only Difference  image   The only thing that differs within all the nine message mappings is the source attribute mapping. The corresponding city is mapped to source attribute.      h2. Message Interface(s)    image     Create nine different message interfaces resembling the same content and two for input and output.      Also create nine interface mappings with the corresponding message interfaces.     image     h2. The BPM configuration(s)    image     Add all the abstract message interfaces in container and select it in the corresponding transaction step.    h2. Configuration of the scenario in Integration Builder     The configuration is nothing but a simple file to file scenario using BPM.     image     The above diagram shows the snap of the objects in Integration Directory.    h2. The output    image
You must be Logged on to comment or reply to a post.
  • Hi felix,

            Really its a very good Blog. If possible , if you have detailed screenshorts on this scenario, it will be a helpful for me.. If possible can you send me the screenshorts , to this email id..

    TESCRA Software,
    SAP Netweaver Team.