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: 

about views

Former Member
0 Kudos

am using blow code 8 times in the program with different condition, which can'b changed, coz b4 that am coalculating some field to pass them in where clause.

i have decided to create a new custom view,

1. can i get better performance

2. can i declare an internal table with that view like we do with db table? if so how?

3. i want to create view with required fields only if i use select *, will it effect later? is it advisable to use * in this case?

SELECT

a~lgnum

a~tanum

a~bwart

a~bwlvs

a~bdatu

a~bzeit

a~qdatu

a~betyp

a~benum

b~tapos

b~werks

b~matnr

b~vltyp

b~nltyp

b~vlenr

b~nlenr

b~nsola

b~nista

b~meins

b~wdatu

b~wenum

a~mjahr

b~wepos

b~zeugn

INTO TABLE gt_ltap

FROM ltak AS a INNER JOIN ltap

AS b ON atanum = btanum

AND algnum = blgnum

FOR ALL ENTRIES IN gt_matnr "MB

WHERE a~lgnum EQ p_lgnum

AND a~qdatu GE gw_ref-l_date

AND b~matnr EQ gt_matnr-matnr "MB

AND b~pquit EQ 'X'

AND b~vltyp IN gr_vltyp

AND b~nltyp IN gr_nltyp

  • AND b~vlenr IN gr_vlenr

AND b~werks EQ p_werks.

waiting for responce.

3 REPLIES 3

Former Member
0 Kudos

Hi,

Create a view on this. You will get good performance.

Regards,

Atish

0 Kudos

hi,

how we can get better performance? coz the view also using inner join to select the data from base tables right?

can we declare a internal table by using this view?

Former Member
0 Kudos

Try this below query. I have made a few small modifications.

SELECT

a~lgnum

a~tanum

a~bwart

a~bwlvs

a~bdatu

a~bzeit

a~qdatu

a~betyp

a~benum

b~tapos

b~werks

b~matnr

b~vltyp

b~nltyp

b~vlenr

b~nlenr

b~nsola

b~nista

b~meins

b~wdatu

b~wenum

a~mjahr

b~wepos

b~zeugn

INTO TABLE gt_ltap

FROM ltak AS a

INNER JOIN ltap AS b

ON algnum = blgnum

AND atanum = btanum

FOR ALL ENTRIES IN gt_matnr

WHERE a~lgnum EQ p_lgnum

AND a~qdatu GE gw_ref-l_date

AND b~matnr EQ gt_matnr-matnr

AND b~werks EQ p_werks

AND b~pquit EQ 'X'

AND b~vltyp IN gr_vltyp

AND b~nltyp IN gr_nltyp.

Note : Reward points if useful.