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

select query

Former Member
0 Likes
1,607

Hi,

DATA :IT_MARA LIKE MARC OCCURS 0 WITH HEADER LINE.

select matnr mtart mbrsh matkl from mara into corresponding fields of table it_mara where ......

If i declare an internal table as above and using into correponding fields will this rise any issues in the performance.

If so please help me how to define the table because they are many declarations like that in my program.

Thanks.

15 REPLIES 15
Read only

Former Member
0 Likes
1,506

Ramya,

If you don't want all fields from mara then you write like this.

DATA : Begin of i_mara occurs 0,

matnr LIKE MARA-matnr,

mtart LIKE MARA-mtart,

mbrsh LIKE MARA-mbrsh,

matkl LIKE MARA-matkl,

End of i_mara.

select matnr

mtart

mbrsh

matkl from mara into table it_mara

where ......

Reward if useful....

Read only

Former Member
0 Likes
1,506

hi,

if u dont want all the fields.

declare an internal table with the fields required.

and use

select matnr

mtart

mbrsh

matkl from

mara into

table it_mara where

Read only

Former Member
0 Likes
1,506

Hi,

If into corresponding fields is used, performance issue raises.

So declare the internal table which has specific fields like

data: begin of it_mara occurs 0,

matnr like mara-matnr,

mtart like mara-mtart,

mbrsh like mara-mbrsh,

maktl like mara-maktl,

end of it_mara.

so, there is no need to give into corresponding fields in a select query.

Regards,

K.Tharani.

Read only

0 Likes
1,506

HI,

Can i write

DATA IT_zzc10 LIKE zzc10 OCCURS 0 WITH HEADER LINE.

SELECT * FROM ZZC10 INTO TABLE IT_ZZC10_TEMP

FOR ALL ENTRIES IN IT_PKPS

WHERE PKKEY EQ IT_PKPS-PKKEY

AND PKNUM EQ IT_PKPS-PKNUM

AND ZDATE BETWEEN SO_BUDAT-LOW AND SY-DATUM

AND STATUS EQ '5'.

i need all fields in the table zzc10 .

If i use select * there will be performance issue or i need to declare all the fields of table zzc10 in an internal table.

thanks.

Read only

0 Likes
1,506

Hi

select the feilds which u want ....

dont use select *...

Read only

Former Member
0 Likes
1,506

Hi,

Based on perfornce we should not use the following

1.occurs 0

2.inner joins in select statement

3.into corresponding fields of

Use structure(which fields u want),create the external work area(for header),use "for all entries"(for inner join).

Reward points,if it is helpful.

Thanks,

chandu.

Read only

Former Member
0 Likes
1,506

HI

performance issue will occur if u use

occurs 0,

with header line.

instead declare work area.

DATA : it_vendor TYPE STANDARD TABLE OF st_vendor,

wa_vendor TYPE st_vendor,

Read only

Former Member
0 Likes
1,506

Hi,

Use only the fields which u need in the internal table rather than declaring everything in Internal table. Avoid 'into corresponding fields of'. And select fields in the same order of internal table.

Thus, your selection time reduces.

Regards,

Ramya

Read only

Former Member
0 Likes
1,506

Hi

Yes it will have little performance issue...

Because that way all the Marc fields will be cheked with ur Internal table fields ( for into corresponding )

Therefore INto table is good way of doing this .

Hope it helps .

Thanks

Praveen

Read only

Former Member
0 Likes
1,506

Hi,

If u dont want all fields u can use

DATA BEGIN OF TY_MARA OCCURS 0.

MATNR TYPE MARA-MATNR,

MBRSH TYPE MARA-MBRSH,

MAKTX TYPE MARA-MAKTX,

MTART TYPE MARA-MTART,

END OF TY_MARA.

If you use into corresponding fields performance will raise.

use workarea performance will improve.

Read only

Former Member
0 Likes
1,506

Hi,

If u dont want all fields u can use

DATA: begin of ty_mara occurs 0,

MATNR TYPE MARA-MATNR,

MBRSH TYPE MARA-MBRSH,

MAKTX TYPE MARA-MAKTX,

MTART TYPE MARA-MTART,

END OF TY_MARA.

If you use into corresponding fields performance will raise.

use workarea performance will improve.

Read only

Former Member
0 Likes
1,506

Hi,

Always define a structure in your program code,the ITAB can be then defiend as type table of the zstructure.

Types: begin of MARC,

matnr type marc-matnr,

mtart type marc-mtart,

mbrsh type marc-mbrsh,

matkl type marc-matkl,

end of marc.

data: itab type table of marc,

wa type marc.

using work area with the internal table is the preferred way now.

Now when you write your select query,you don't have to use into corresponding fields.

select matnr mtart mbrsh matkl

from mara

into table itab

where condition.

this will improve the program performance too.

Read only

Former Member
0 Likes
1,506

Hi,

Plz Don't use 'INTO CORRESPONDING FIELDS ' for whole table structure if u required only few fields to retrive... bcoz it will check field by field and only then it 'll pass the value.... insted create structure for required field and then use into corres. fields this 'll not create performance issue else it 'll....

Thanks

Arunprasad.

Read only

Former Member
0 Likes
1,506

Hi

DATA :IT_MARA LIKE MARC OCCURS 0 WITH HEADER LINE.

if you declare the internal table like this this will rise the issues in the performance level.

so this is the best way:

*structure declaration

types:begin of st_mara,

matnr type matnr,

mtart type mtart,

mbrsh type mbrsh,

matkl type matkl,

end of st_mara.

data:wa_mara type st_mara,"work area declaration

it_mara type standard table of st_mara.''internal table

select-options:pa_matnr for mara-matnr.

select matnr mtart mbrsh matkl from mara into table it_mara

where matnr in pa_matnr.

loop at it_mara into wa_mara.

write:/ wa_mara-matnr,

wa_mara-mtart,

wa_mara-mbrsh,

wa_mara-matkl.

endloop.

Read only

Former Member
0 Likes
1,506

Hi,

As perfomance is the main criteria of the program take care the below things are not present in ur program

1.occurs 0

2.inner joins in select statement

3.into corresponding fields of

4.select.........endselect

5. Loop within a loop

To improve the performance:

1. Use structure(which fields u want),

2. create the external work area(for header),

3. use "for all entries"(for inner join).

So declare, a stucture with fields u required.

Regards,

kavitha.