Skip to Content

Introduction:

In an XI mapping, it is a common requirement to be able to perform data lookups. Earlier the lookup functionality was achieved using JDBC/JCO API’s in an advanced function to connect to DB/ SAP System respectively. If the lookup were to be performed with any other application system (synchronous) SOAP/ webservice, the API’s used will change accordingly. In such a case, the developer should have the knowledge of how to integration using the API’s specific to the system. Hence the Lookup code becomes System specific.

But with SP13, using Lookup API in XI, the Lookup functionality has changed and now its even simpler. The developer need not worry about to which application system is the lookup call being made.The Lookup API’s are generic in nature which allow u to perform a lookup independent of the system to which the call is being made. Another feature to be noted is, whenever a mapping program is executed on the Integration Server, the lookup API calls the required application system by using the central Adapter Engine.

Scenario:

For the given UserName and Password details, the Role of the user has to picked up from the DB. Below is the screenshot of the DB-Table that has been used in the scenario.

image

Fig.1 DataBase Table Structure

Sequence of Steps:

In Configuration Time, create an appropriate communication channel to the System with which the lookup is being performed. For example, if the lookup is to be performed with a Database System, then a communication channel for the DB should be created. The Advanced function (in Message Mapping) will use this channel to perform the lookup’s.

image

Fig.2 Communication Channel used for Lookup

In Design Time, Create all the required design time Objects to perform a Message Mapping. (Datatypes, MessageTypes, MessageMapping).

image

Fig.3 Message Mapping

Create a new advanced Function to perform a DB lookup.

image

Fig.4 Creation of a new advanced Function

image

Fig.4Advanced Function editor

The following is the logical flow of code used in Advanced function that performs DB lookup.

  1. Construct your Query String
  2. Determine the channel by specifying the Party, Service, Communication channel. Or only System, Communication channel
  3. Get a SystemAccessor for the channel.
  4. Execute your Query and get the resultset.
  5. Loop through the resultset and get the required value. If you want to store more than 1 value, then use container and global container variables for storing them.
  6. Close the System Accessor

Code snippet used to perform Loopkup

Result

DB Lookup is performed when the mapping is executed.

image

Fig.4Output of Message Mapping

Recommended Reading

Mapping Lookups in help.sap.com gives a brief idea of how Lookup’s are performed.

To report this post you need to login first.

45 Comments

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

      1. Ram R
        Hi Siva,

        If I am using this lookup to get multiple records from SAP and store temporarly in XI for later processing, Do I need to do any parsing before storing them in XI, when the records are returned from SAP?

        Thanks
        Ram

        (0) 
      1. Ram R
        Hi Siva,

        If I am using this lookup to get multiple records from SAP and store temporarly in XI for later processing, Do I need to do any parsing before storing them in XI, when the records are returned from SAP?

        Thanks
        Ram

        (0) 
      1. Ram R
        Hi Siva,

        If I am using this lookup to get multiple records from SAP and store temporarly in XI for later processing, Do I need to do any parsing before storing them in XI, when the records are returned from SAP?

        Thanks
        Ram

        (0) 
    1. Siva Vara Prasad Maranani Post author
      hi Michal,

      Me too completed the same a couple of weeks back but b’cos of project deadlines i could not post…

      Good that you have told about your RFC lookups :-)) else i would have finalized mine… now i had to press “delete” :-((

      But happy to hear that somebody on the other side of the world is working on the same scenario :-))

      Cheers,
      Siva Maranani.

      (0) 
      1. Michal Krawczyk
        Hi,

        >>>else i would have finalized mine… now i had to press “delete” :-((

        sorry for that but our changes where almost even…
        I was on vacations ๐Ÿ™‚ without a computer:(

        >>But happy to hear that somebody on the other side of the world is working on the same scenario :-))

        I guess it happens all the time with Satyam and BCC in the XI area ๐Ÿ™‚

        Kind Regards ๐Ÿ™‚
        michal 

        (0) 
    1. Siva Vara Prasad Maranani Post author
      hi Michal,

      Me too completed the same a couple of weeks back but b’cos of project deadlines i could not post…

      Good that you have told about your RFC lookups :-)) else i would have finalized mine… now i had to press “delete” :-((

      But happy to hear that somebody on the other side of the world is working on the same scenario :-))

      Cheers,
      Siva Maranani.

      (0) 
      1. Michal Krawczyk
        Hi,

        >>>else i would have finalized mine… now i had to press “delete” :-((

        sorry for that but our changes where almost even…
        I was on vacations ๐Ÿ™‚ without a computer:(

        >>But happy to hear that somebody on the other side of the world is working on the same scenario :-))

        I guess it happens all the time with Satyam and BCC in the XI area ๐Ÿ™‚

        Kind Regards ๐Ÿ™‚
        michal 

        (0) 
    1. Siva Vara Prasad Maranani Post author
      hi Michal,

      Me too completed the same a couple of weeks back but b’cos of project deadlines i could not post…

      Good that you have told about your RFC lookups :-)) else i would have finalized mine… now i had to press “delete” :-((

      But happy to hear that somebody on the other side of the world is working on the same scenario :-))

      Cheers,
      Siva Maranani.

      (0) 
      1. Michal Krawczyk
        Hi,

        >>>else i would have finalized mine… now i had to press “delete” :-((

        sorry for that but our changes where almost even…
        I was on vacations ๐Ÿ™‚ without a computer:(

        >>But happy to hear that somebody on the other side of the world is working on the same scenario :-))

        I guess it happens all the time with Satyam and BCC in the XI area ๐Ÿ™‚

        Kind Regards ๐Ÿ™‚
        michal 

        (0) 
  1. Arnold Baking
    Hi Siva,

    Thanks for this great info.

    Just some questions on the code for getting the channel: channel = LookupService.getChannel(“DB-SYSTEM-NAME”,”DB-CHANNEL-NAME”);

    Is there a javadoc for LookupService?  I’m assuming that DB-CHANNEL-NAME is the name of the communication channel to be used, am I right?  But what is DB-SYSTEM-NAME?  I’m assuming that this has to be tied to the communication channel that is being used, but I can’t seem to tie it to any of the data that you have provided as an example…

    (0) 
  2. Arnold Baking
    Hi Siva,

    Thanks for this great info.

    Just some questions on the code for getting the channel: channel = LookupService.getChannel(“DB-SYSTEM-NAME”,”DB-CHANNEL-NAME”);

    Is there a javadoc for LookupService?  I’m assuming that DB-CHANNEL-NAME is the name of the communication channel to be used, am I right?  But what is DB-SYSTEM-NAME?  I’m assuming that this has to be tied to the communication channel that is being used, but I can’t seem to tie it to any of the data that you have provided as an example…

    (0) 
  3. Arnold Baking
    Hi Siva,

    Thanks for this great info.

    Just some questions on the code for getting the channel: channel = LookupService.getChannel(“DB-SYSTEM-NAME”,”DB-CHANNEL-NAME”);

    Is there a javadoc for LookupService?  I’m assuming that DB-CHANNEL-NAME is the name of the communication channel to be used, am I right?  But what is DB-SYSTEM-NAME?  I’m assuming that this has to be tied to the communication channel that is being used, but I can’t seem to tie it to any of the data that you have provided as an example…

    (0) 
  4. Josรฉ Matos
    Hi Siva,
    I’ve applied your example in a scenario and the acess to the DB works fine thru JBDC.
    But, I’ll be very thankfull to you if we could help me regarding the following … my source structure could occurs 1..onbounded and my target too and if i get 2 entries in source i only get result from one of those entries. So what do i have to change in your UDF to get the result from those 2 entries ???
    Can u help me ?!?!?
    Regards,
    JMMatos
    (0) 
  5. Josรฉ Matos
    Hi Siva,
    I’ve applied your example in a scenario and the acess to the DB works fine thru JBDC.
    But, I’ll be very thankfull to you if we could help me regarding the following … my source structure could occurs 1..onbounded and my target too and if i get 2 entries in source i only get result from one of those entries. So what do i have to change in your UDF to get the result from those 2 entries ???
    Can u help me ?!?!?
    Regards,
    JMMatos
    (0) 
  6. Josรฉ Matos
    Hi Siva,
    I’ve applied your example in a scenario and the acess to the DB works fine thru JBDC.
    But, I’ll be very thankfull to you if we could help me regarding the following … my source structure could occurs 1..onbounded and my target too and if i get 2 entries in source i only get result from one of those entries. So what do i have to change in your UDF to get the result from those 2 entries ???
    Can u help me ?!?!?
    Regards,
    JMMatos
    (0) 
  7. Yann L'Hรฉnoret
    Hi,

    when trying to do the same, I get the below error, and I don’t know where it may come from (db configuration,….)
    Any idea?

    regards
    Yann

    LookupException : Exception during processing the payload.Problem when calling an adapter by using communication channel DB_Access_Receiver (Party: , Service: BS_Achat_Stock, Object ID: 4718bcd4bd663c95bce7260857e37794) XI AF API call failed. Module exception: ‘Error ACK handling failed: java.lang.NullPointerException’. Cause Exception: (No information available). com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel DB_Access_Receiver (Party: , Service: BS_Achat_Stock, Object ID: 4718bcd4bd663c95bce7260857e37794) XI AF API call failed. Module exception: ‘Error ACK handling failed: java.lang.NullPointerException’. Cause Exception: (No information available). at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.execute(AdapterProxyLocal.java:131)

    (0) 
  8. Yann L'Hรฉnoret
    Hi,

    when trying to do the same, I get the below error, and I don’t know where it may come from (db configuration,….)
    Any idea?

    regards
    Yann

    LookupException : Exception during processing the payload.Problem when calling an adapter by using communication channel DB_Access_Receiver (Party: , Service: BS_Achat_Stock, Object ID: 4718bcd4bd663c95bce7260857e37794) XI AF API call failed. Module exception: ‘Error ACK handling failed: java.lang.NullPointerException’. Cause Exception: (No information available). com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel DB_Access_Receiver (Party: , Service: BS_Achat_Stock, Object ID: 4718bcd4bd663c95bce7260857e37794) XI AF API call failed. Module exception: ‘Error ACK handling failed: java.lang.NullPointerException’. Cause Exception: (No information available). at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.execute(AdapterProxyLocal.java:131)

    (0) 
  9. Yann L'Hรฉnoret
    Hi,

    when trying to do the same, I get the below error, and I don’t know where it may come from (db configuration,….)
    Any idea?

    regards
    Yann

    LookupException : Exception during processing the payload.Problem when calling an adapter by using communication channel DB_Access_Receiver (Party: , Service: BS_Achat_Stock, Object ID: 4718bcd4bd663c95bce7260857e37794) XI AF API call failed. Module exception: ‘Error ACK handling failed: java.lang.NullPointerException’. Cause Exception: (No information available). com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel DB_Access_Receiver (Party: , Service: BS_Achat_Stock, Object ID: 4718bcd4bd663c95bce7260857e37794) XI AF API call failed. Module exception: ‘Error ACK handling failed: java.lang.NullPointerException’. Cause Exception: (No information available). at com.sap.aii.ibrun.server.lookup.AdapterProxyLocal.execute(AdapterProxyLocal.java:131)

    (0) 
  10. VenkataPrabhakar Teegavarapu
    HI Siva,

    That was nice blog.Thanks for that.
    I need your expertise in rectifying the error.I am sure i configured this as REC adapter.

    ERROR:
    Exception during processing the payload.Problem when calling an adapter by using communication channel CC_XXX_REC (Party: , Service: BS_XXX, Object ID: 23856e004d5636abbb548f602f0fbedb) XI AF API call failed. Module exception: (No information available). Cause Exception: 'Error: invalid receiver channel '23856e004d5636abbb548f602f0fbedb''.

    com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel CC_XXX_REC (Party: , Service: BS_XXX, Object ID: 23856e004d5636abbb548f602f0fbedb) XI AF API call failed. Module exception: (No information available). Cause Exception: 'Error: invalid receiver channel

    Thanks
    Prabhakar

    (0) 
  11. VenkataPrabhakar Teegavarapu
    HI Siva,

    That was nice blog.Thanks for that.
    I need your expertise in rectifying the error.I am sure i configured this as REC adapter.

    ERROR:
    Exception during processing the payload.Problem when calling an adapter by using communication channel CC_XXX_REC (Party: , Service: BS_XXX, Object ID: 23856e004d5636abbb548f602f0fbedb) XI AF API call failed. Module exception: (No information available). Cause Exception: 'Error: invalid receiver channel '23856e004d5636abbb548f602f0fbedb''.

    com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel CC_XXX_REC (Party: , Service: BS_XXX, Object ID: 23856e004d5636abbb548f602f0fbedb) XI AF API call failed. Module exception: (No information available). Cause Exception: 'Error: invalid receiver channel

    Thanks
    Prabhakar

    (0) 
  12. VenkataPrabhakar Teegavarapu
    HI Siva,

    That was nice blog.Thanks for that.
    I need your expertise in rectifying the error.I am sure i configured this as REC adapter.

    ERROR:
    Exception during processing the payload.Problem when calling an adapter by using communication channel CC_XXX_REC (Party: , Service: BS_XXX, Object ID: 23856e004d5636abbb548f602f0fbedb) XI AF API call failed. Module exception: (No information available). Cause Exception: 'Error: invalid receiver channel '23856e004d5636abbb548f602f0fbedb''.

    com.sap.aii.mapping.lookup.LookupException: Problem when calling an adapter by using communication channel CC_XXX_REC (Party: , Service: BS_XXX, Object ID: 23856e004d5636abbb548f602f0fbedb) XI AF API call failed. Module exception: (No information available). Cause Exception: 'Error: invalid receiver channel

    Thanks
    Prabhakar

    (0) 

Leave a Reply