Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Ztable updation

Former Member
0 Likes
1,687

Hi all,

        I have created a ztable releted to sale order details.There is some problem in updating the table.

whenever a record is added or modified, the update gets failed untill the next change is done...

Eg..1st change which i made is updated only after the 2nd change is made and 2nd change is updated after the 3rd and so on....

Please help me in this reg.

Regards,

Sam.

9 REPLIES 9
Read only

gouravkumar64
Active Contributor
0 Likes
1,198

Hi,

How did you updating the table?

Thanks

Gourav.

Read only

Former Member
0 Likes
1,198

Hi Sam,

Tell whether the Fields in the Z Table are standard's or custom fields.?

if it is standard then there should n't be any problem in insert/update the records.

can you tell in detail how the table is being updated...

Read only

Former Member
0 Likes
1,198

did you use COMMIT WORK after update? if not try with using it.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,198

Read Asking Good Questions in the SCN Discussion Spaces will help you get Good Answers

Can you precise :

  • How did you update the table, did you uise COMMIT WORK or FM DB_COMMIT or ?
  • In which context (single report, BAdI of a standard transacton...)

Read online help like Implicit Database Commits (or what the system did that you should have done yourself before...^)

Regards,

Raymond

Read only

Former Member
0 Likes
1,198

Dear all,

      Thanks for your replies. The problem is solved.

I had to update custom field. There was a problem in commit work and was rectified.

Rgds,

Sam.

Read only

Former Member
0 Likes
1,198

Just check the documentation in INSERT and MODIFY.

INSERT dbtab


INSERT { {INTO target VALUES source }
       | {     target FROM   source } }.

Effect

The INSERT statement inserts one or more rows specified in source in the database table specified in target. The two variants with INTO and VALUES or without INTO with FROM behave identically, with the exception that you cannot specify any internal tables in source after VALUES.

System Fields

The INSERT statement sets the values of the system fields sy-subrc and sy-dbcnt.

sy-subrcMeaning
0At least one row was inserted.
4At least one row could not be inserted, because the database table already contains a row with the same primary key or a unique secondary index.

 

  • The INSERT statement sets sy-dbcnt to the number of rows inserted.


Note

  • The inserted rows are finally included in the table in the next database commit. Up until this point, they can still be removed by a database rollback.
  • The statement INSERT sets a database lock until the next database commit or rollback. If used incorrectly, this can lead to a deadlock
  • The number of rows that can be inserted in the tables of a database within a database LUW is limited, since a database system can only manage a limited amount of locks and data in the rollback area.

Example, INSERT INTO ztable VALUES wa_ztable

MODIFY dbtab

MODIFY target FROM source.

Effect

The MODIFY statement inserts one or several lines specified in source in the database table specified in target, or overwrites existing lines.

System fields

The MODIFY statement sets the values of the sy-subrc and sy-dbcnt system fields.

sy-subrcMeaning
0All lines were inserted or changed.
4At least one line could not be processed as there is already a line with the same unique name secondary index in the database table.

 

The MODIFY statement sets sy-dbcnt to the number of processed lines.

Note

The changes are finally transferred to the database table with the next database commit. Up to that point, they can be reversed with a database rollback.

  • The MODIFY statement sets a database lock until the next database commit or database rollback; incorrect usage can result in a deadlock .
  • The number of rows that can be inserted into or changed in the tables of a database within a database LUW is restricted database-specifically by the fact that a database system can only manage a limited amount of locks and data in the rollback area.

    EXAMPLE : MODIFY ztable FROM wa_ztable.

UPDATE dbtab

 

Syntax

UPDATE target source.

Effect:

The statement UPDATE changes the content of one or more lines of the database table specified in target. The entries in source determine which columns of which lines are changed, and how they are changed.

System fields

The statement UPDATE sets the values of the system fields sy-subrc and sy-dbcnt.

sy-subrcMeaning
0At least one line has been changed.
4At least one line was not able to be changed, either because no appropriate line was found, or because the change would generate a line that leads to double entries in the primary key or a unique secondary index in the database table.

 

The statement UPDATE sets sy-dbcnt to the number of changed lines.

Note

The changes are definitively copied to the database with the next database commit. Until that point, they can still be undone using a database rollback

  • The statement UPDATE sets a database lock up to the next database commit or rollback, which may lead to a deadlock if used incorrectly.
  • For the specific database, the number of rows that can be changed within a database LUW in the database table is restricted by the fact that a database system can only manage a certain amount of data in the rollback area and from locks.

Read only

Former Member
0 Likes
1,198

Hi Samuel,

  Did you check if other tables also have the same behavior?

One suggestion: After your first change, check for consistency of the table structure and contents in SE14 transaction. In case of any consistencies exist, you can try to adjust the table.

-Ashwin

Read only

Aiolos
Active Participant
0 Likes
1,198

it is a simple problem, before asking, you should try to get any help online first.

Read only

VijayaKrishnaG
Active Contributor
0 Likes
1,198

Hello Sam,

You can use "COMMIT WORK" after your statement used for Updating (either UPDATE/MODIFY/INSERT). So that all the tables related to that particular object will get updated.

Thanks & Regards,

VIJAY