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

Internal table

Former Member
0 Likes
640

Dear friends,

My requirement is to fetch data only names, not numbers.

SELECT ernam FROM VBAK

INTO CORRESPONDING FIELDS OF

TABLE ITAB.

LOOP AT itab.

IF itab-ernam CA '0123456789'.

DELETE itab.

ENDIF.

ENDLOOP.

this code is working fine to fetch names only.

But my problem is i have data more than 4,00,000 records.

Above loop is going to Dump.

So i have decided to fetch data only names in SELECT query itself.

Is there any possible way to fetch only names in select query itself ? instead of using the loop.

Thanks in advance

Regards,

Ajay

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
614

Hi,

After the select statement you write delete statement as shown below.

SELECT ernam FROM VBAK

INTO CORRESPONDING FIELDS OF

TABLE ITAB.

DELETE ITAB WHERE NOT ernam CA SY-ABCDE.

Edited by: Velangini Showry Maria Kumar Bandanadham on Apr 15, 2008 9:13 AM

7 REPLIES 7
Read only

Former Member
0 Likes
614

HI,

to do it without loop, u just write the select query as:

SELECT ernam FROM VBAK

INTO CORRESPONDING FIELDS OF

TABLE ITAB where ernam ne '0123456789'.

then it validates while fetching the data it self.

then u'll get the other records only.

reward if helps u.

Read only

0 Likes
614

Dear Mytri,

this is not working. I have tried it. but still fetching numbers.

Kindly suggest me

Thanks,

Ajay

Read only

peter_ruiz2
Active Contributor
0 Likes
614

hi,

use this code


SELECT ernam FROM VBAK
INTO CORRESPONDING FIELDS OF TABLE ITAB
where ernam na '0123456789'.

regards,

Peter

Read only

0 Likes
614

Dear Peter,

That is showing error message as " NA is not a valid comparison operator".

Kindly suggest

Thanks,

Ajay

Read only

Former Member
0 Likes
614

Hi,

Processing 4,00,000 records, this should not go for dump. Please check the code where exactly it is for dump.

And try this code as well.


LOOP AT itab.
   IF itab-ernam CA '0123456789'.
      DELETE itab.
      clear itab.
      continue.
   ENDIF.
ENDLOOP.

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
615

Hi,

After the select statement you write delete statement as shown below.

SELECT ernam FROM VBAK

INTO CORRESPONDING FIELDS OF

TABLE ITAB.

DELETE ITAB WHERE NOT ernam CA SY-ABCDE.

Edited by: Velangini Showry Maria Kumar Bandanadham on Apr 15, 2008 9:13 AM

Read only

0 Likes
614

Hi Velangini,

thanks it is working

Regards,

Ajay