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

Updating the Database Table.

Former Member
0 Likes
619

Hi , I have a z table. I need to insert values into that table using the MODIFY Statement. The program is working fine except for the last entry not being Updated and a Run time error being generated.

The following code executes this

ZGRN_DETAILS-UNAME = sy-uname.

ZGRN_DETAILS-MTIME = sy-uzeit.

ZGRN_DETAILS-MDATE = sy-datum.

ZGRN_DETAILS-BELNR = IT_EKBE_CP-BELNR.

MODIFY ZGRN_DETAILS.

COMMIT WORK.

Can anybody tell me why is it Generating a Run time error.

Answer will be rewarded with deserving Points

Thanks

Manu

1 ACCEPTED SOLUTION
Read only

rahulkavuri
Active Contributor
0 Likes
598

hi declare a internal table similar to the ZTABLE which will act as work area

data: itab type table of ztable.

itab-UNAME = sy-uname.

itab-MTIME = sy-uzeit.

itab-MDATE = sy-datum.

itab-BELNR = IT_EKBE_CP-BELNR.

MODIFY ZGRN_DETAILS from table itab.

If still it doesnt get updated then it means that there must be a same matching record in ZTABLE already with matching primary keys

7 REPLIES 7
Read only

Former Member
0 Likes
598

try using MODIFY <dbtab> client specified....also, use commit statement at end of the program.

Read only

0 Likes
598

Im using the commit statement as well. The last entry is not being updated and

the SNAP Runtime error msg is being generated.

Don't know whats wrong. Something is wrong with the MOdify clause it seems like.

Read only

0 Likes
598

Got the problem. Actually there was no space on the Development Server. Thanks for ya suggestion.

Read only

Former Member
0 Likes
598

Hi Manu,

What U have used is correct. try using move :-

MOVE sy-uname to ZGRN_DETAILS-UNAME .

MOVE sy-uzeit to ZGRN_DETAILS-MTIME .

MOVE sy-datum to ZGRN_DETAILS-MTIME .

MOVE IT_EKBE_CP-BELNR to ZGRN_DETAILS-BELNR .

MODIFY ZGRN_DETAILS.

Regards

Avi

Read only

rahulkavuri
Active Contributor
0 Likes
599

hi declare a internal table similar to the ZTABLE which will act as work area

data: itab type table of ztable.

itab-UNAME = sy-uname.

itab-MTIME = sy-uzeit.

itab-MDATE = sy-datum.

itab-BELNR = IT_EKBE_CP-BELNR.

MODIFY ZGRN_DETAILS from table itab.

If still it doesnt get updated then it means that there must be a same matching record in ZTABLE already with matching primary keys

Read only

Former Member
0 Likes
598

Hi,

First you find records in z table. If record is already exist, then you delete duplicate records. After that you can use modify statement.

Regards,

Bhaskar

Read only

Former Member
0 Likes
598

Manu,

If you got the answer than plz marked it as answered.

Regards,

Amey