cancel
Showing results for 
Search instead for 
Did you mean: 

JDBC code in the user defined functions

Former Member
0 Kudos

HI ,

I have to access the oracle database to get the maximum value in a field of a table.

I have to get this value at the time of mapping.

I was thinking of writing the user defined function to get this value.

Has someone done this type of work.

Thanks

nikhil

Accepted Solutions (0)

Answers (1)

Answers (1)

udo_martens
Active Contributor
0 Kudos

Hi Nikhil,

you can use JDBC receiver adapter. Create a statement with attribute action="SQL_QUERY", where you can access a SQL statement like "SELECT (max) myField FROM myTable WHERE ...

Please have look to Library:

http://help.sap.com/saphelp_nw04/helpdata/en/2e/96fd3f2d14e869e10000000a155106/content.htm

Regards,

Udo

Former Member
0 Kudos

HI Udo ,

I have to doa similar thing in the user defined function soastopulthe value and map it to the outgoing message tothe target system.

can i write a normalJDBC code to do this ???

Thanks

Nikhil

udo_martens
Active Contributor
0 Kudos

Hi Nikhil,

i'm not shure what do you mean with "user defined function". A stored procedure at oracle? If yes, u can call it via JDBC adapter. The way how to implement is as well described in the link above.

Regards,

Udo

Former Member
0 Kudos

HI Udo,

I am not talking about the stored procedures.

The senario is like ...We have to update the PO data in the oracle tables.For this we have toknow the maximum PO number that has been created in the oracle DB so that the mext message can contain the next number in the number range .

for this we have tofetch the po number from the oracle table while mapping sothat we can increment it and map it to the data being sent out.

to fulfill the above requirement we can write a function in the mapping that can access the oracle table so that the required data can be fetched.

I just wanted toknow if we can just write a simple JDBC code here to access the data or we have to write something specific to SAP.

Thanks

Nikhil

Former Member
0 Kudos

Hi Nikhil -

This can be done via Mapping Lookups:

http://help.sap.com/saphelp_nw04/helpdata/en/cf/406642ea59c753e10000000a1550b0/content.htm

This will leverage a configured JDBC, RFC, or SOAP adapter that you have configured. Please take a look at the documentation.

You can also use a configured DataSource (configured within J2EE Visual Admin tool - <i>Services->JDBC Connector</i>.

Regards,

Jin

Message was edited by: Jin Shin