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

Edit primary fields of database table through debugging

Former Member
0 Likes
3,605

How to edit primary fields of database table through debugging?

12 REPLIES 12
Read only

Sandra_Rossi
Active Contributor
0 Likes
2,980

In transaction SE16, SM30, something else?

Read only

loyd_enochs3
Participant
0 Likes
2,980

It is impossible to answer definitively without knowing what program you are debugging. Add that information the next time you ask a question.

I suspect that what you are seeing in the debugger is the table work area related to a TABLES statement in an old standard SAP program. This table work area location is a structure that is formatted exactly as the database table is and crucially HAS THE SAME NAME. The code looks something like this:

REPORT......
TABLES: MARA.
...
START-OF-SELECTION.
...

SELECT * FROM MARA WHERE.....

My guess is that while you were debugging something like this, you double clicked on the name MARA in the line of code containing the SELECT * , and then changed the the contents of MARA in the debugger.

When you change the values of MARA in the debugger, you are modifying the fields in the structure MARA, declared by the TABLES statement, NOT the database table MARA. Updating the database table would require writing a procedure that physically updates the database.

Of course, changing the primary key of any database table directly is strictly verbotten, so you wouldn't want to do this even if you could.

BTW, the Tables statement has been obsolete in ABAP OO programming since version 4.0 - today it used as the conduit to pass data from between a program and a Dynpro field and when working with logical databases. However, you will still see this construct in older SAP code (prior to version 4.0) and in custom code written consultants who haven't stayed up to date on syntax rules.

For reference, read up in transaction ABAPDOCU using the menu path: ABAP Programming Guidelines -> Robust ABAP -> Data Types and Data Objects -> Table Work Areas

Read only

Former Member
0 Likes
2,980

Through se16 we will not be able to edit the primary entries..

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,980

Can you elaborate in what context you want to "edit the primary fields of database table through debugging"? Do you mean the key components of an internal table?

PS: database table <> internal table !!

Read only

SimoneMilesi
Active Contributor
2,980

Can you guess why? If they are the keys, they identify the record.

Can I suggest a quick read about keys in DB?
If you give a read, you'll understand why you cannot change them...

Read only

SachinArtani
Active Participant
0 Likes
2,980

No, you cannot change the structure of db tables while debugging. Though, changing the table structure can be done through T-code - SE11. So, you can change the structure of table and then start debugging.

Read only

Former Member
0 Likes
2,980

Would like to elaborate more on the same..

If we r hvng a database table mara and in that matnr is a key field..so if we will execute the table then we will not be able to edit the entries for matnr as that is the key field .So is there any way to edit these entries?

Read only

SimoneMilesi
Active Contributor
2,980

I repeat myself: study the concept of Database Key!

Your question is no sense.

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,980

Aashna Sikka It's technically possible but why do you want to do that??? Like how to crash a computer, it's possible but nobody wants to answer because it's beyond the limit of acceptable.

Read only

dev_parbutteea
Active Contributor
0 Likes
2,980

Aashna,

If someone messed up while creating a material, just put a deletion indicator on the material and create a new one.

Dev.

Read only

Former Member
0 Likes
2,980

Just to give more explanation on the same..for example if we are having a database table MARA and a primary key field MATNR,when we will execute the table after that is it possible to change the table entries for the field MATNR in database table as this is primary key field.?

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,980

Yes but nobody wants to answer as I said. Except if you give a good reason to do that...