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

Populating new database table field?

Former Member
0 Likes
2,042

Hello,

I've added a new field (key) to an existing database table. Is there an "easy" way to populate field without writing an ABAP program?

FYI: I know field is populated with initial values per field data type when table activated. I want to initially populate with a "real" value.

Thanks in advance,

Billy

14 REPLIES 14
Read only

Former Member
0 Likes
1,425

there is NO way, easy or otherwise; to populate the new field for the existing records as you have defined that as a key field

Read only

0 Likes
1,425

Thanks MxG....If it wasn't a key field what would you suggest?

Read only

Former Member
0 Likes
1,425

go to se11 create a table maintenence for your table once you have created that ,go to SM30 and start maintaining your table.

In this case you don`t need to write any ABAP Program.

Regards

Neha

Edited by: Neha Shukla on Dec 3, 2008 11:36 PM

Read only

0 Likes
1,425

Thanks Neha..I did consider that but there are thousands of existing records.

Read only

0 Likes
1,425

Hi ,

Better write the program in case of having thousand of records rather than the entering through SM30 .

regards,

Bharani

Read only

0 Likes
1,425

I for myself will write simple code using ABAP query to update the non key field for a custom table if needed

Read only

Former Member
0 Likes
1,425

Hi

Generate the table maintains from SE11. Create a LSMW to fill the field from SM30. if the table data in DEV and PRD are same you can atttach the new rows into a request and can transport it to PRD.

You can minimise the efforts this way.

Thanks

Lakshman

Read only

Former Member
0 Likes
1,425

Hi

A simple piece of code in program which updates the table field seems very appropriate. ( if the values that need to be updated are less in number and the conditions precise ).

Regards

Raj

Edited by: Rajasekhar Dinavahi on Dec 9, 2008 3:43 AM

Read only

0 Likes
1,425

Thanks to all who replied....I considered most suggested (SM30, LSMW, ABAP, etc). I was hoping that database utility (SE14) was "smart enough" to reorganize data but obviously not. I probably should have been more specific in my question, but I didn't want to preclude another possibility. Again, thanks to all. FYI: ABAP is the path I choose.

Read only

0 Likes
1,425

how to populate custom database table through abap program. ? write sample code

Read only

0 Likes
1,425

Hello friend,

This is the simple code for populating the custom table.

select * from scarr into TABLE t_scarr.

loop at t_scarr into x_scarr.

insert zrtest1 from x_scarr.

ENDLOOP.

zrtest1 is the custom table which will be now populated with the values from the internal table t_scarr which in turn are having the values from scarr.

Thanks,

Sri Hari

Read only

Former Member
0 Likes
1,425

Hi,

By using Data Base Structures you can Add any number of new fields to an existing Table.

Warm Regards,

PavanKumar.G

Read only

kiran_k8
Active Contributor
0 Likes
1,425

You have added a new field as a primary key in an existing table which is having lots of entries and now you want to fill this field with some real value for all the existing entries.

A lot depends on the usage of this field,the kind of data that it is going to hold and were there any existing programs which is already having some logic build up based on the existing primary keys of this table.

1.If this Z table is getting updated from any standard transaction then it doesn't make any sense to populate a value to existing entries because the existing data is TRANSACTION DATA.

2.Won't this affect the existing programs logic if they are already using this table.

3.I suggest better you do a where used list of this table and check what are the programs that are already using this and accordingly take a call.

Thanks,

K.Kiran.

Read only

kiran_k8
Active Contributor
0 Likes
1,425

Deleted as the same reply got posted twice.

Edited by: Kiran K on Jan 4, 2012 9:57 AM