Application Development 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: 

delete key fields in a table

Former Member
0 Kudos
143

Hi,

I use a very simple program to delete an entire table. Like the following:

REPORT z_erase_vcom1.

TABLES /bic/pvcom1.

DELETE FROM /bic/pvcom1.

the data is erased, but the table still contains the key fields. how can i completely erase the table including all fields?

afterwards i want to fill the table with fresh data from another system. so i want this table to be clean.

thanks,

stefan

1 ACCEPTED SOLUTION

Former Member
0 Kudos
73

hi,

refrash tablename.

6 REPLIES 6

Former Member
0 Kudos
74

hi,

refrash tablename.

anversha_s
Active Contributor
0 Kudos
73

Hi,

chk this.

SELECT * FROM /bic/pvcom1 
INTO CORRESPONDING FIELDS OF TABLE it_tab. 

 
DELETE /bic/pvcom1 FROM TABLE it_tab
 
CALL FUNCTION 'DB_COMMIT'.

regards

Anver

<i><b>if hlpe pls mark points</b></i>

Former Member
0 Kudos
73

Hi,

DELETE statement will delete records in internal table.

CLEAR statement will clear work area. (i.e data stored in header)

REFRESH will clear all records including header record in table. And table will be empty.

For your requirement REFRESH is appropriate.

*MARK all helpful answers

0 Kudos
73

Hi thank you all,

good work:)

this rewarding system does not work sometimes...

Former Member
0 Kudos
73

hai ,

do this way.

data : i_/bic/pvcom1 like /bic/pvcom1 occurs 0 .

select * from /bic/pvcom1 into i_/bic/pvcom1 .

delete /bic/pvcom1 from table i_/bic/pvcom1 .

roberto_tagliento
Active Contributor
0 Kudos
73

DELETE FROM /bic/pvcom1 WHERE condition.

Find the condition that is true for all lines.

For example, a numeric field that is always positive the condition is:

DELETE FROM /bic/pvcom1 WHERE field GT -1.