The ultimate site for SAP XI certification and tutorial resources. Submit tutorials/scenarios and get assured gifts!!! For more info click here...

gift

tutorial - HOW TO DO A DB LOOKUP

Submitted by : Thomas Varghese Koipuram

      by this TUTORIAL I intend to explain how a Database lookup can be performed from inside of XI Mapping by using SAP J2EE JDBC Connector service.

1

Fig. 1 – A graphical representation on what we intend to do here

 

I believe the figure is self explanatory. No? Ok then, if you see the inbound document we can see that the language code is included in it. We are going to query the database using this language code to get the language description. Clear? OK good!

2.    The Step by Step Solution

  • Declare the Database tables to be used.
  • Create the data source and configure drivers using J2EE JDBC connecter service.
  • Develop the Java code that does the DB lookup.
  • Develop user defined function in Integration repository.

 

 

Creating the database tables

 

2

Fig. 2 – The table created

 

The table name is LanguageTranslation and it contains two simple VARCHAR columns called language_cd and language_desc. Create the entry EN and English into the table using insert function.

Create data source assign drivers using J2EE JDBC connector service

 

3    

Fig. 3 – Select the connection from the existing ones            

  4

     Fig. 4 – Creating new data source

 

 

 

Log on to J2EE administrator tool.  Then select the service mode Fig 4[1] and go to JDBC connected service. To select new data source select the Data sources and click on Create icon. Fig 4 [2]

 

 

Enter name of the data source and description Fig5 [2]

 

5

Fig. 5 – Enter the data source name and description

 

Give the driver information

6

Fig. 6 – Enter the driver information

 

Design Java code

Write the java code required for the DB lookup, compile it and zip it. (Compile.bat and source code(.java)  imported only for documentation purposes, not necessary). Import archive into Integration repository.

 

7

Fig. 7 – Zip the java files (only .class file is required, rest included for documentation purposes)

 

Develop a user defined function in Integration repository using graphical mapping function.

 

8

Fig. 8 – Create a User define function

 

Do the graphical mapping

Include the getLanguageDesc user define function in the mapping. Fig 9[1]. Test the mapping. Fig10 [2]

9      

Fig. 9 – Do the graphical mapping   

10

Fig. 10 – Test the mapping


Cool !!!View other tutorials!________________________Submit a tutorial