cancel
Showing results for 
Search instead for 
Did you mean: 

Insert/Update based on data in database

Former Member
0 Kudos

Hi,

We have been asked to develop and interface between R3 (Sender) and JDBC (Receiver). We have been asked to check the data currently in the database before we insert our data. So if the record in the IDOC currently exists in the database we should update that record. If the data doesn't exist then we should insert this data.

We are currently on XI 3 SP9.

Can anyone tell me if this is possible?

Thanks

Accepted Solutions (0)

Answers (6)

Answers (6)

Former Member
0 Kudos

Thanks for all your help.

prateek
Active Contributor
0 Kudos

Wasn't it very clear from my first reply

Regards,

Prateek

Former Member
0 Kudos

is UPDATE_INSERT supported on XI 3.0?

--> Yes..

Former Member
0 Kudos

Gareth,

That's O.k...even using stored procedure you can perform the same activity..with in the stored procedure just have a look whether record exists with the same key if not then use insert query there..

Regards,

Former Member
0 Kudos

hi Gareth,

Use "UPDATE_INSERT" functionality . It will update the record with the same key, if exits, else will make a new entry.

Regards,

Former Member
0 Kudos

is UPDATE_INSERT supported on XI 3.0?

Former Member
0 Kudos

Hi Gareth,

To clarify and to help you to take the good decision.

1st solution :

With XI 3.0, you can directlyuse the option UPDATE_INSERT for your SLQ request with JDBC adpater.

Pro : This solution is easy to apply for PI and there is nothing to do on the database.

Cons : (to be confirmed). According to me, the INSERT, UPDATE, UPDATE_INSERT option can be done only if all your KEY fields (the fields on which you want to do your control) are inside the same table in your database. So if it's the case (certainly), apply this solution.

2nd solution:

The use of stored procedure allow you to make control on different tables (e.g check a status from one table and then check if a material exist in another table) and then to take the decision to update / insert / add a flag. All this code is done directly inside the stored procedure and for PI is totally transparent.... PI call just a stored procedure name (like a function module in ECC) by passing the data.

For both solutions, have a look on the SAP help and SND blogs to know how to define it in PI (Data Type and mapping).

So if your need is just to be sure to do an update or an insert inside one table, the UPDATE_INSERT is THE solution because it's standard.

regards.

Mickael

Former Member
0 Kudos

Hi,

yes it's possible. but your choice update / insert should be done directly in Data base... For that a STORED PROCEDURE has be created in the Data Base and in PI, you, you provide all info to this stored procedure.

Remind: a stored procedure is developped in the data base and it's like a functin module of ECC (like !!). The goal is the same and inside it you can do each SQL request that you want: update / select / insert etc...

regards

Mickael

Former Member
0 Kudos

Hi,

Our suggested solution was to use a Stored Proc to do the checks. But does SAP XI support the "UPDATE_INSERT" function?

prateek
Active Contributor
0 Kudos

Use UPDATE_INSERT as action. It performs the same activity. Use the Key value as the primary value based on which condition has to be checked.

Regards,

Prateek