Skip to Content
author's profile photo Former Member
Former Member

Select Vendors character format only from LFA1

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

8) 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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Dec 18, 2008 at 07:39 AM

    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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Dec 18, 2008 at 07:54 AM

    Answered and thanks

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.