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: 

how to avoid this code?

Former Member
0 Kudos
80

HI all,

      i want  to improve performance of my program

could anyone suggest how to avoid this

" SELECT werk UP TO 1 ROWS

INTO l_iwerk

FROM ser03

WHERE obknr IN ( select OBKNR

                  from OBJK

                  WHERE equnr EQ p_equnr

                  AND   taser EQ 'SER03' )."

Moderator message: please don't open new discussions for each similar issue, also search for available information before posting.

Message was edited by: Thomas Zloch

3 REPLIES 3

Former Member
0 Kudos
45

Hi Pavan,

Please try this,

select OBKNR

                  from OBJK

                    into table < a table of type objk>

                  WHERE equnr EQ p_equnr

                  AND   taser EQ 'SER03'.

if sy-subrc = 0.

sort < a table of type objk> by objknr.

SELECT  werk

INTO table lt_iwerk

FROM ser03

for all entries in  < a table of type objk>

where WHERE obknr IN  < a table of type objk>-obknr.

endif.

Regards,

Amit

0 Kudos
45

If you have no related data in SER03, you would still end up wasting time to fetch all relevant data from table OBJK, apart from hogging memory.

Former Member
0 Kudos
45

SELECT Single werk  INTO l_iwerk

FROM ser03

Join OBJK

on ser03~obknr eq objk~obknr

WHERE objk~equnr EQ p_equnr

AND       objk~taser EQ 'SER03'