cancel
Showing results for 
Search instead for 
Did you mean: 

RFC to JDBC for select

Former Member
0 Kudos

Hi,

I have an RFC to JDBC scenario. I need to make RFC call to DB and using select need to get the DataBase Table Data.

I am little bit confused here, Can you please tell me how many data types, Message Types, Msg Mappings, Msg Inetrfaces for that??.

I know like this: 2 DTs for DB table. One when I make the RFC call, another when I return my data from DB to RFC. So, how to do the Msg Map??. I am liitle bit confusing.

Thanks-a-lot in advance for your help.

Regards,

Sunita.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Sunita,

In the RFC to JDBC scenario(sync),

<b>Sender side:</b>

  • Imported RFC(Imported Objects->RFCs).This can be used for the response as well.

  • No Data Types and Message Types required.

  • Two message mappings(For Request and Response.)

  • One Interface Mapping.

When you do the response Message Mapping,

select the response DB structure for Source Message type and the RFC for the Target Message type.

<b>Receiver side:</b>

  • Two Data Types.

  • Two Message Types.

  • One Message Interface.

Hope this helps.

Regards,

Mahesh

Former Member
0 Kudos

Thanks-a-lot Bhavesh, Smita, Abhy, Mahesh.

Best Regards,

Sunita.

Former Member
0 Kudos

Hi

I am almost clear from your explanation. Mine is synchronous scenario,

1.RFC invokes Jdbc.

2. Jdbc invokes a select statement, and return all the results to RFC.

My doubt now is, how do I create Data types for Select structure, how it looks when I invoke it, and how it looks when I return data from DB to RFC.

Do I need to map all the fields in acess in Request Mapping also??.

Thanks-a-lot in advance.

Sunita

Message was edited by: sunita

bhavesh_kantilal
Active Contributor
0 Kudos

Hi,

As you will be using the JDBC adapter as your Reciver that will select data from the database, the Adapter will be SYNCHRONOUS and the format of the Datatype has to be,

<DT>

<StatementName4>

<dbTableName action=”SELECT”>

<table>realDbTableName</table>

<access>

<col1/>

<col2/>

<col3/>

</access>

<key1>

<col2>val2old</col2>

<col4>val4</col4>

</key1>

<key2>

<col2>val2old2</col2>

</key2>

</dbTableName>

</StatementName4>

</Dt>

The COL between ACESSS will contain the column names that have to be selected from the database.

The values between KEY will contain the conditional values.

The response will be of this format,

<DT_response>

<row>

<column1>value11</column1>

<column2>value12</column2>

...

</row>

...

<row>

<column1>valueN1</column1>

<column2>valueN2</column2>

...

</row>

<DT_Response>

Just create the Datatypes of this formats for the request and response JDBC and it will work fine.

Do let us know if u need any further help.

All info will be available on this link,

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

Regards,

Bhavesh

Answers (5)

Answers (5)

Former Member
0 Kudos

Hi Sunita,

>> Do I need to map all the fields in acess in Request Mapping also??.

It is not required to map all the fields in Access in Request Mapping. Depending on your requirements, you can select any number of fields from a table.

In mapping, if you know the table name and fields to be selected at design time, you can assign all constant values for <table> and <col> elements. Also, a constant 'SELECT' can be assigned to the attribute action.

Regards,

Uma

Former Member
0 Kudos

Thanks Bhavesh and Uma. I will get back, if I have any queries.

Sunita

Former Member
0 Kudos

Hi Sunita,

In this scenario data type creation is not required for rfc(since importing rfc itself would create request and response data types) ,create request and response datatypes for jdbc receiver.

create two message mappings (rfc-request to jdbc-request and jdbc-response to rfc-response).specify these message mappings in an interface mapping(Synchronous(RFC)-Synchronous(JDBC)).

If u dont know the response of JDBC give a dummy message and execute the scenario.it will result in message mapping exception. Even then u can go to SXMB_MONI and see ur response from JDBC.U can use that and modify ur response correspondingly.

Regards,

Kausik M.

Former Member
0 Kudos

Hi Sunita,

Since your doubt is not very clear...I thought i will just add on to what Bhavesh told and i will tell you how you can implement the same by which i think you can meet your requirement of making a Select Query.

1. You will have to create a Sender JDBC adapter. Check the link below for configuring a JDBC sender adapter.

An important point to note are 2 fields, QUERY this will contain the select query. Next will be the UPDATE.this will contain the UPDATE statement after the rows are selected from your database.

The reason an update statement has to be given is, as the JDBC adapter will continually poll over your database, the rows read in one polling interval should not be read again.

http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm

2. Next, you will have to configure a receiver RFC adapter. This can be done following this link,

http://help.sap.com/saphelp_nw04/helpdata/en/c8/e80440a832e369e10000000a155106/content.htm

The rest of the configuration are like anyother XI scenario.

For more info, look at these links,

/people/saravanakumar.kuppusamy2/blog/2005/01/19/rdbms-system-integration-using-xi-30-jdbc-senderreceiver-adapter

http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm

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

Regards,

abhy

Message was edited by: Abhy Thomas

Former Member
0 Kudos

Hi,

You are first making a rfc call. For this you would need a data type to represent the rfc, and another to represent the jdbc side.

Hence, you would need

for request:

two message types,

one message mapping.

Next, to transfer the message from your jdbc to rfc,

for response:

two data types: one for the jdbc side, another data type representing the rfc.

two message types,

one message mapping.

The message interfaces you need depends on whether your interface is synchronous or asynchrous.

Further, how would you see the result that is being sent by the DB? are you also doing a rfc to file scenario?

Regards,

Smitha.

bhavesh_kantilal
Active Contributor
0 Kudos

Hi Sunita,

Can you explain in more detail your requirement.

Do you want to select data from your database and then pass it to your RFC or, do you want an RFC to invoke the database call and then send the response back to the rfc?? The format of your Datatypes will depend on this requirement.

You do not have to create datatype/message type for your RFC. You can use the RFC itself as the same.

Meanwhile, when you are using your JDBC as a sender, then your JDBC will poll over your database and select the rows that satisfy your Select Query. Also, there is another field in your JDBC adapter that is very important and that is the Update satatement. Once your JDBC adapter executes your select query and selects rows from the database, you might not need those rows to be selected again. In this csse, you can use the Update statement to update the database.

In the case of the receiver JDBC adapter, you can insert/ update/ delete data and execute stored prooedure into your databse.

For more info, look at these links,

http://help.sap.com/saphelp_nw04/helpdata/en/7e/5df96381ec72468a00815dd80f8b63/content.htm

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

Regards,

Bhavesh