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 delete the data inside a internal table?

Former Member
0 Likes
1,154

I got a internal table name g_itab1.

currently my g_itab1 has a FNAME(50) component.

Inside my component there is ADMINO, EYEAR, FIRSTNAME, LASTNAME and CONTACT.

I want to clear away ADMINO, EYEAR, FIRSTNAME, LASTNAME and CONTACT inside my internal table.

How do i clear it? i have tried using CLEAR g_itab1.

It doesn't work.. the data are still inside.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,113

Use refresh g_itab1[]

I got a internal table name g_itab1.

currently my g_itab1 has a FNAME(50) component.

Inside my component there is ADMINO, EYEAR, FIRSTNAME, LASTNAME and CONTACT.

I want to clear away ADMINO, EYEAR, FIRSTNAME, LASTNAME and CONTACT inside my internal table.

How do i clear it? i have tried using CLEAR g_itab1.

It doesn't work.. the data are still inside.

9 REPLIES 9
Read only

Former Member
0 Likes
1,113

Hi,

Use Refresh Statement.

Refresh will clear the contents of both the header line and the body of the internal table. Free will clear both and release the memory allocated as well.

Syntax :

REFRESH itab.

Thanks.

Read only

Former Member
0 Likes
1,113

hi,

try to use delete statement

Read only

Former Member
0 Likes
1,114

Use refresh g_itab1[]

Read only

0 Likes
1,113

clear:g_itab1 ,g_itab1[]

Read only

varma_narayana
Active Contributor
0 Likes
1,113

Hi

You can use :

REFRESH g_itab1.

or

CLEAR g_itab1[] . "Delete the records from the BODY

Both statements will delete the Entire records from itab.

REWARD IF hELPFUL.

Read only

Former Member
0 Likes
1,113

Hi

if you want remove total then go for <b>refresh itab.</b>

if you want to go for some fields then use <b>DELETE itab where</b>

<b>Reward if usefull</b>

Read only

Former Member
0 Likes
1,113

use this.

CLEAR g_itab1[]. " FOR BODY CLEAR

REFRESH g_itab1. " FOR HEADER CLEAR

Message was edited by:

Amit Singla

Read only

Former Member
0 Likes
1,113

hi

DELETE TABLE itab WITH TABLE KEY k1 = v1 ... kn = vn.

Example to delete all of the lines between 5 and 36 in a table of names where the entry begins with one of the letters 'A' to 'C'.

DELETE itab FROM 5 TO 36 WHERE NAME CA 'ABC'.

reward if useful

regards

sree

Read only

Former Member
0 Likes
1,113

Thanks everyone!!!!

I've solved my problem!!! 😃