Skip to Content

Mapping


Mapping maps a source structure to a target structure. Following are the various methods, that we can do mapping

    • XSLT Mapping
    • Java Mapping
    • ABAP Mapping

This document will explain about Java Mapping.


Java Mapping


The message is transferred to a Java program as an inbound stream and can be imported using any parser (for example, SAX or
DOM). The modified message is then transferred to an outbound stream.

A Java program can also be a help program that in turn is used in another Java program or self-defined functions of a message mapping.


File to Multiple IDOC


Let us consider some complex IDOC for this scenario, so that it makes some sense for doing java Mapping. Let us consider the following IDOC, which has one HEADER, one TRANS, one MTPNT, one ADDRS, multiple ASSET, one METER, one CONVE, multiple REGST and one READG segments.

In this blog I will explain the Java Mapping part. To post multiple IDOCs, refer the following weblog (The weblog I mentioned, deals with files to Multiple IDOCs with XSLT Mapping)

File to Multiple IDocs (XSLT Mapping)



image

The segments which are colored Red are Mandatory and the segments which are green are optional. Each segment has multiple
fields.

The input file will have the following structure.



image

The following is the sample Data


“HEADR”,”ONUPD”,”ABC”,”APP”,”BBB”,”SUP”,20050329,”061939″,”PB021953″,”PRAAA”,252,42

“TRANS”,”176496″,”A532932″,”105010″,”UTE”,””,””,””,””,””,”I”,,””,””,20050323,

“MTPNT”,””,10539200,””,””,”06″,””,”IN OFFICE”,,,

“ADDRS”,”MPT”,””,””,”DELIVERY OFFICE”,”AUSFIELDS”,””,””,””,”KGS LYNN”,””,”PE30 1AA”,,,,””

“ASSET”,””,”RET”,”MER”,””,”CR”,”U1R5″,”UGI”,1993,”3901189S”,””,””,””

“METER”,””,”S”,””,20040415,””,””,20040415,”aBB”,,44

“MTPNT”,””,10539200,””,””,”06″,””,”FROM OFFICE”,,,

“ADDRS”,”MTT”,””,””,”OFFICE”,”AUSFIELDS”,””,””,””,”KILYNN”,””,”PE30 1AA”,,,,””

“ASSET”,””,”RRT”,”TER”,””,”CR”,”U R5″,”UGI”,1993,”3901189S”,””,””,””

“METER”,””,”S”,””,20040416,””,””,20040422,””,,

“CONVE”,””,”S”,””,20040417,””,””,20040422,””,,,

“REGST”,””,”S”,””,20040419,””,””,20040414,””,,

“READG”,””,”S”,””,20040414,””,””,20040419,””,,

Here, HEADR, TRANS, MTPNT, ADDRS, ASSET, METER, CONVE, REGST, READG are the key fields to the corresponding segments.
According to the above sample data, it has to post two IDOCs for the same TRANS with respect to the MTPNT. First MTPNT
contains ADDRS, ASSET and METER and the second MTPNT contains all the segments.

So it has to post one IDOC with the following data


“HEADR”,”ONUPD”,”ABC”,”APP”,”BBB”,”SUP”,20050329,”061939″,”PB021953″,”PRAAA”,252,42

“TRANS”,”176496″,”A532932″,”105010″,”UTE”,””,””,””,””,””,”I”,,””,””,20050323,

“MTPNT”,””,10539200,””,””,”06″,””,”IN OFFICE”,,,

“ADDRS”,”MPT”,””,””,”DELIVERY OFFICE”,”AUSFIELDS”,””,””,””,”KGS LYNN”,””,”PE30 1AA”,,,,””

“ASSET”,””,”RET”,”MER”,””,”CR”,”U1R5″,”UGI”,1993,”3901189S”,””,””,””

“METER”,””,”S”,””,20040415,””,””,20040415,”aBB”,,44

And another IDOC with the following data


“HEADR”,”ONUPD”,”ABC”,”APP”,”BBB”,”SUP”,20050329,”061939″,”PB021953″,”PRAAA”,252,42

“TRANS”,”176496″,”A532932″,”105010″,”UTE”,””,””,””,””,””,”I”,,””,””,20050323,

“MTPNT”,””,10539200,””,””,”06″,””,”FROM OFFICE”,,,

“ADDRS”,”MTT”,””,””,”OFFICE”,”AUSFIELDS”,””,””,””,”KILYNN”,””,”PE30 1AA”,,,,””

“ASSET”,””,”RRT”,”TER”,””,”CR”,”U R5″,”UGI”,1993,”3901189S”,””,””,””

“METER”,””,”S”,””,20040416,””,””,20040422,””,,

“CONVE”,””,”S”,””,20040417,””,””,20040422,””,,

“REGST”,””,”S”,””,20040419,””,””,20040414,””,,

“READG”,””,”S”,””,20040414,””,””,20040419,””,,

For this kind of scenario, let us make the Content Conversion mentioned hereunder:



image

Record Structure should be in the following format:


HEADER, 1, TRANSACTION,, METERPOINT,, ADDRESS,, ASSET,, METER,, CONVERTER,, REGISTER_DETAILS,, READING,



image


To report this post you need to login first.

5 Comments

You must be Logged on to comment or reply to a post.

    1. Prasad Ulagappan Post author
      Thanx Luis. Initally, when I was doing this blog, somebody has told me that this is very basic stuff… Why you are doing all these blogs…bla bla… But I told at that time itslef, that I am doing this blog for beginners in java mapping and it will b helpful for others… I have made it… Thank you once again Luis…

      ~Prasad U

      (0) 
  1. Alladi Rudra
    thx Prasad for taking care of starters like me. Can you also please explain me the advantages and disadvantages of Java Mapping.

    -R

    (0) 

Leave a Reply