cancel
Showing results for 
Search instead for 
Did you mean: 

JDBC receiver multiple records UPDATE

Former Member
0 Kudos

Hi All,

In my file to JDBC scenario :

update_insert works! BUT ONLY for the first record of the payload.

The second record is not updated!

E.g. If I post the message via JDBC:

<Statement_TABLES>

<dbTableName_action="update_insert">

_<table>MyTable</table>

-_<access>

__<CRM_GP_NR>1234567893</CRM_GP_NR>_

__<BUSINESS_UNIT>1308</BUSINESS_UNIT>_

__</access>

-_<key1>

__<CRM_GP_NR>1234567893</CRM_GP_NR>_

__</key1>

__</dbTableName>

-_<dbTableName_action="update_insert">

_<table>MyTable</table>

-_<access>

__<CRM_GP_NR>1234567894</CRM_GP_NR>_

__<BUSINESS_UNIT>1308</BUSINESS_UNIT>_

__</access>

-_<key1>

__<CRM_GP_NR>1234567894</CRM_GP_NR>_

__</key1>

__</dbTableName>

__</Statement_TABLES>

Only 1234567893 is updated, 1234567894 is not

Any ideas?

Regards,

Praveen Kumar

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Praveen,

The answer is you need a statement level tag for each record. The same problem has been discussed in SDN before and the solution pointed out. Please search before posting new questions.

Eg:

<Statement_TABLES>

<dbTableName_action="update_insert">

_<table>MyTable</table>

-_<access>

__<CRM_GP_NR>1234567893</CRM_GP_NR>_

__<BUSINESS_UNIT>1308</BUSINESS_UNIT>_

__</access>

-_<key1>

__<CRM_GP_NR>1234567893</CRM_GP_NR>_

__</key1>

__</dbTableName>

__</Statement_TABLES>

<Statement_TABLES>

-_<dbTableName_action="update_insert">

_<table>MyTable</table>

-_<access>

__<CRM_GP_NR>1234567894</CRM_GP_NR>_

__<BUSINESS_UNIT>1308</BUSINESS_UNIT>_

__</access>

-_<key1>

__<CRM_GP_NR>1234567894</CRM_GP_NR>_

__</key1>

__</dbTableName>

__</Statement_TABLES>

Regards,

Jaishankar

former_member537867
Active Contributor
0 Kudos

Hi Praveen,

It can be done in two ways as mentioned below:

First

<StatementName1>

<dbTableName action=”UPDATE”>

<table>realDbTableName</table>

<access>

<col1>val1</col1>

<col2>val2new</col2>

</access>

<key1>

<col2>val2old</col2>

<col4>val4</col4>

</key1>

</dbTableName>

</StatementName1>

Here keep the occurance of <StatementName1> 0...unbound

Second

<StatementName6>

<anyName action=” SQL_QUERY” | “SQL_DML”>

<access>SQL-String with optional placeholder(s)</access>

<key>

<placeholder1>value1</placeholder1>

<placeholder2>value2<placeholder2>

</key>

</anyName >

</StatementName6>

Here use SQL Query in the action tab to update teh table based on the place holder values

action= SQL_QUERY | SQL_DML This structure enables you to transfer more complex SQL statements to the database directly using the adapter. You have the option of using placeholders in these SQL statements, which can be listed in the subsequent keyblock. This makes it easy to generate complex, parameterisable SQL statements.

Details on the structure:

○ The name of the structure is arbitrary. Unlike in the usual statement types, no table name or stored procedure name is expected in the default setting.

○ If the SQL statement represents a query to the database (SELECT), choose Action=SQL_QUERY.

○ If it represents a call from the SQL Data Manipulation Language (UPDATE, INSERT, DELETE), choose Action=SQL_DML.

○ The first element in the structure must have the name <access> and contain a valid SQL call for the respective mode, optionally with placeholders (see below).

○ If you use placeholders, these must be listed in the element with the name <key>. The names of the placeholder elements must be identical to those used in the SQL string (where they still have the $ character). In the above example <StatementName6>, the strings $placeholder1$ and $placeholder2$ contained in the SQL string are replaced with value1 or value2 before the SQL statement is executed.

Irrespective of the action, you need to have multiple ACCESS level tags in the output one for each Record. This will Update multiple records in the Database.

The ACCESS tag should hence have an occurence of 0 to unbounded. and each recorsd in the source should create a ACCESS level tag with the correspodning lower level tags.

More,

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

"Reward points if found useful"

Regards,

Vinod.

Former Member
0 Kudos

hi,

i am facing same problem pls it would be good if u provide me with some screen shorts

regards

metha

Former Member
0 Kudos

I have tried with above solutions but with no luck... could any one suggest solution.

Former Member
0 Kudos

Hi praveen,

pls chk with the data base settings and make sure that u change the flag value dependin on the req

Thanx

Sampath

former_member240483
Contributor
0 Kudos

Hi there,

oops sorry i think wrong answer

Regards

rao

Edited by: PT Rao on May 29, 2008 11:59 AM