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: 

Select Vendors character format only from LFA1

Former Member
0 Kudos

hi ,

I have an internal Table with 53,890 vendors in first column.

the others columns contains vendor descirptions and their address.

for e,g say i have records in my internal table as follows.

LIFNR

1) 0000001109

2) 0000001111

3) 0000005581

4) E-115174

5) E-115175

6) E-115176

7) E-115177

😎 MR84

9) MR85

10) MR86

now i want to delete records starting from 1 to 3 as they are number format

but i don't want to delete records from 4 to 10 as they are character format.

i can do that deletion based on number and character formats

using the below code.

*Final Table for Diplsay of Vendors

LOOP AT t_lfa1 INTO wa_lfa1.

CALL FUNCTION 'NUMERIC_CHECK'

EXPORTING

string_in = wa_lfa1-lifnr

IMPORTING

htype = w_type.

IF w_type = 'NUMC'.

DELETE t_lfa1 WHERE lifnr = wa_lfa1-lifnr.

ENDIF.

ENDLOOP.

the above code fulfills my requirement but it takes lot of time when moved for testing since there are

53,890 records and DELETE will always increases the index cost and performance problem comes.

My requirement is there any condition we can put in my SELECT syntax where in i can select only

those records in character format

1 ACCEPTED SOLUTION

anuraag_aggarwal
Active Participant
0 Kudos

Hi Murali

I don't think that you can do anything in select query for this, instead enhance your current code.

1. For loop, use a field symbol, This will enhance your loop performance as the overhead to copy values into a work area is reduced.

2. Add another field of type CHAR 1 (let's say NUM_CHECK) to declaration of T_LFA1. If you find the vendor as numeric then set this field to X in loop. Do not delete anything in loop.

3) After loop, use DELETE T_LFA1 WHERE NUM_CHECK = 'X'.

This will take lesser time.

Thanks

Anuraag

3 REPLIES 3

anuraag_aggarwal
Active Participant
0 Kudos

Hi Murali

I don't think that you can do anything in select query for this, instead enhance your current code.

1. For loop, use a field symbol, This will enhance your loop performance as the overhead to copy values into a work area is reduced.

2. Add another field of type CHAR 1 (let's say NUM_CHECK) to declaration of T_LFA1. If you find the vendor as numeric then set this field to X in loop. Do not delete anything in loop.

3) After loop, use DELETE T_LFA1 WHERE NUM_CHECK = 'X'.

This will take lesser time.

Thanks

Anuraag

0 Kudos

i has got using RANGES

Former Member
0 Kudos

Answered and thanks