cancel
Showing results for 
Search instead for 
Did you mean: 

Design for database insert

former_member474221
Participant
0 Kudos

I am working on Idoc to database table scenario..what should be the right design

1. just use UPDATE_INSERT.....but here in this case how would they what was the previous value...

Do i need a status field in the table with 'N' / 'U' / 'D' for new / changed / deleted...

2. can i use the approach of using INSERT everytime with datetimestamp so that we can know the previous values..

3. is the status field of 'N' / 'U' / 'D' compulsory ???? if I do not use it how would the database table know if something is deleted at SAP side...

Pls help experts

Accepted Solutions (1)

Accepted Solutions (1)

rajasekhar_reddy14
Active Contributor
0 Kudos

Hi,

it completely depends on how data base team wants data,if you dont want over write the data , then use INSERT Action.

if you want CHANGE specific records the use UPDATE_INSERT.

Regards,

Raj

former_member474221
Participant
0 Kudos

what abt the status field....will i need to ask them to add a status field ( N/U/D ) else how will they know if the document is deleted on SAP

Answers (3)

Answers (3)

baskar_gopalakrishnan2
Active Contributor
0 Kudos

Your requirement is specific to the business. First see the database structure using desc command. If you see key for a table then that is called primary key which keeps or distinguish every record unique in a table.

If you dont see any record in a table for the given key then it is insert function. If the key exists for a record then you might use delete command for deleting that record or update command for updating some specific fields of the record using the key.

This way you distinguish various commands. JDBC supports all the above commands.

Former Member
0 Kudos
Former Member
0 Kudos

> 1. just use UPDATE_INSERT.....but here in this case how would they what was the previous value...

> Do i need a status field in the table with 'N' / 'U' / 'D' for new / changed / deleted...

>

You do not need a status field. You can use the key field of the JDBC receiver structure. If the row is found in the table, an update happens. If the row is not found, element are inserted in accordance with the description of the action INSERT. <key> elements are ignored in this case.

> 2. can i use the approach of using INSERT everytime with datetimestamp so that we can know the previous values..

>

This depends entirely on the requirements of the target DB table.

> 3. is the status field of 'N' / 'U' / 'D' compulsory ???? if I do not use it how would the database table know if something is deleted at SAP side...

>

The status field is not required. The delete would only happen if you use the delete option. In UPDATE_INSERT, if the row is found, its updated with the new value. Else, a new row is inserted into the table.