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

how to refresh old data

Former Member
0 Likes
1,543

original table has column A, now add column B, right now is input A , B will automatically show up. but old data will have B blank, how to make the old data have B automatically refreshed.

thanks kitty

16 REPLIES 16
Read only

abdul_hakim
Active Contributor
0 Likes
1,485

Can you explain your question more clearly.

If you want to refresh an itab then u can use

REFRESH itab.

Abdul

Read only

Former Member
0 Likes
1,485

To set e default value,

UPDATE table SET b = value WHERE b IS INITIAL.

Is that what you want?

Read only

Former Member
0 Likes
1,485

you have to match the value of col a and col b manually and update the table

Read only

0 Likes
1,485

what's your meaning 'manual matech a and b'.

thanks kitty

Read only

Former Member
0 Likes
1,485

Hi,

Use Delete and in the condition where column B = Space

it will work ..

Regards,

PAVAN.

Read only

Former Member
0 Likes
1,485

Hi kitty,

1. The old data of B will NOT GET

automaticlly refreshed.

2. Either one needs to etner it via SM30

3. OR

4. Make a new program.

USE THIS KIND OF LOGIC :

*----


Get all B Blank Records

select * from DBTAB into table ITAB.

where B is initial.

*----


Get the value of B from SOURCE TABLE

Loop at ITAB.

select single FIELD

into itab-B

from sourcetable

where primarykey = itab-A.

*----


update in DBTAB

MODIFY dbtab FROM itab.

endloop.

regards,

amit m.

Message was edited by: Amit Mittal

Read only

0 Likes
1,485

could you pls further explain how to do in SM30? thanks kitty.

Read only

0 Likes
1,485

Open your table in SE11.

Go to menu Utilities -> Table Maintenance Generator

and create the table maintenance prog.

Now go to SM30 and open your table amd maintain. You can do the changes / insert data to your tables here.

Ps: Reward points if helpful.

Read only

0 Likes
1,485

I have sm30, but the question is how to update old data.

and you said to create table maintenance prog. where ?

thanks kitty

Read only

0 Likes
1,485

The table maintenance generator creates the maintenance program for you.

After which you may use SM30 for Table maintenance.

Read only

0 Likes
1,485

yes, can maintain and insert new record, but how about the old one, you only indicate the normal procedure, but I need get the old data updated.need a program to update?

thanks kitty

Read only

0 Likes
1,485

Yes then, you may use a program to update like,

Update table SET field1 = value WHERE field1 IS INITIAL.

This updates all the INITIAL VALUES to a constant value.

You may also use logical condition to update values differently for a specified value in other field.

Read only

0 Likes
1,485

but this is not set to a constant value, the data in B will be displayed automatically as input A.

thanks kitty

Read only

0 Likes
1,485

but this is not set to a constant value, the data in B will be displayed automatically as input A.

thanks kitty

Read only

Former Member
0 Likes
1,485

itab_tmp[] = itab[]

sort itab_tmp .

loop at itab.

read table itab_tmp with key field_a = itab-field_a

binary search.

if sy-subrc = 0 and itab-field_b is initial.

delete itab where field_a = itab_tmp-field_a.

endif.

endloop.

this also works ..

Regards,

PAVAN..

Read only

Former Member
0 Likes
1,485

HI

select cola colb into table itab from <table>.

loop at itab.

if itab-colb is initial.

update <table> set colb = value.

endif.

endloop.