Skip to Content
avatar image
Former Member

Design for database insert

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

4 Answers

  • Best Answer
    Jul 05, 2011 at 08:53 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • Jul 05, 2011 at 09:22 AM

    > 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.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Jul 05, 2011 at 11:28 AM
    Add comment
    10|10000 characters needed characters exceeded

  • Jul 05, 2011 at 02:41 PM

    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.

    Add comment
    10|10000 characters needed characters exceeded