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

Performance for tables statement

Former Member
0 Likes
1,308

Hi,

In below statements which one give the better performance and why?

1.tables mara.

select-options s_matnr for mara-matnr.

2.data: mara_wa type mara.

select-options:s_matnr for mara_wa-matnr.

Regards,

Suresh

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,096

Dear Suresh,

1.tables mara.

select-options s_matnr for mara-matnr.

2.data: mara_wa type mara.

select-options:s_matnr for mara_wa-matnr.

the second statement give the better performance. As tables:mara take global memory if u definde as data: mara_wa type mara. it is local to that program 7 if u made any changes to the table it will not affect the program also.

So in the program try to use as many as u can local variables for the performances issues.

Best Regards,

Flavya

10 REPLIES 10
Read only

JozsefSzikszai
Active Contributor
0 Likes
1,096

there is no significant difference, this shouldn't be a performance issue! if there are performance problems with your program, it is not because of these statements!

Read only

Former Member
0 Likes
1,096

Hello,

One which does not have a Tables statement will give you better performance because it does not goes out searching for reference outside your program. I think so though with every declaration it will validate whether the declaration exist in the local declaration first and then the global declaration.

Thanks,

Jayant

Read only

Former Member
0 Likes
1,097

Dear Suresh,

1.tables mara.

select-options s_matnr for mara-matnr.

2.data: mara_wa type mara.

select-options:s_matnr for mara_wa-matnr.

the second statement give the better performance. As tables:mara take global memory if u definde as data: mara_wa type mara. it is local to that program 7 if u made any changes to the table it will not affect the program also.

So in the program try to use as many as u can local variables for the performances issues.

Best Regards,

Flavya

Read only

0 Likes
1,096

>

> the second statement give the better performance. As tables:mara take global memory if u definde as data: mara_wa type mara. it is local to that program 7 if u made any changes to the table it will not affect the program also.

>

> So in the program try to use as many as u can local variables for the performances issues.

most of your statements are completely incorrect...

both statements will define the same work area, if they are global or local, it depends on where they are placed in the program (in this case both will be global, otherwise you couldn't use it on the selection screen)

Read only

0 Likes
1,096

Hi Eric,

Thanks a lot for correction.

Regards,

Flavya

Read only

Former Member
0 Likes
1,096

this statement doesnot deal with the performance issue, it might be when you have used more loop statements and join select statements only then the performance gets affected.

Read only

Former Member
0 Likes
1,096

Hi,

Table statement automatically creates a WA in the memory with the Tables' name.

Hence i believe, the "select-options s_matnr for mara-matnr" is better.

In the second option you are creating one more wa with same reference., which is waste of money.

-Raj

Edited by: Rajat Chaturvedi on Dec 5, 2008 3:39 PM

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,096

Look at [TABLES|http://help.sap.com/abapdocu/en/ABAPTABLES.htm].

The TABLES work area is an Interface Work Area, where the DATA work area is local. So performance derives from the kind of programs which are running, are there only one report or many reports that are interfaced, also how are the data selected record by record or mass selection, are there any screen involved, you have not really enough information for an absolute and definitive answer, for hints :

- TABLES should consume more space and resources, but is sharable

- DATA consumes less, but if sharing is necessary, you will consumer resources to transfer data...

- TABLES may be requested in some report/screen communication

- TABLES is not allowed in classes (OO)

Regards

Read only

Former Member
0 Likes
1,096

Hi,

As Eric suggested, this should not cause performance issue.

If you are asking just for info -

First method will take slightly more time than second one.

(I would rather say, first method will take slightly more memory than second one).

Regards,

Mohaiyuddin

Read only

Former Member
0 Likes
1,096

If u put the TABLES statements in u r coding it was get the total fields from database,(it was affect to DB performance) if u doesn't require all the fields from MARA table better to avoid the TABLES statement.