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 wise which is best

Former Member
0 Likes
621

Hi all,

Performance wise which of the following program is the Best . Why it is Best?

Program No : 1.

DATA: ITAB TYPE STANDARD TABLE OF scarr WITH NON-UNIQUE

DEFAULT KEY INITIAL SIZE 100,

wa_itab TYPE scarr.

  • WA_ITAB TYPE SCARR.

SELECT * INTO TABLE itab FROM scarr.

LOOP AT itab INTO wa_itab.

WRITE:/ wa_itab-carrid,10 wa_itab-carrname,35 wa_itab-CURRCODE, 45

wa_itab-URL.

ENDLOOP.

-


program No : 2

DATA: BEGIN OF D_SCARR,

CARRID TYPE SCARR-CARRID,

CARRNAME TYPE SCARR-CARRNAME,

CURRCODE TYPE SCARR-CURRCODE,

URL TYPE SCARR-URL,

END OF D_SCARR.

DATA: ITAB LIKE STANDARD TABLE OF D_SCARR.

SELECT CARRID CARRNAME CURRCODE URL

FROM SCARR

INTO TABLE ITAB.

LOOP AT ITAB INTO D_SCARR.

WRITE: D_SCARR-CARRID,10 D_SCARR-CARRNAME, 35 D_SCARR-CURRCODE, 45

D_SCARR-URL.

ENDLOOP.

-


2 ) what is the difference Between these two

wa_itab TYPE scarr. and

WA_ITAB TYPE SCARR.

Thanks in Advance

Sri...

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
586

i think 2nd one is better because instead of using select * always use the fieldnames in select query.

and

wa_itab TYPE scarr. and

WA_ITAB TYPE SCARR.

both are same because abap is not case sensitive.

regards

shiba dutta

Hi all,

Performance wise which of the following program is the Best . Why it is Best?

Program No : 1.

DATA: ITAB TYPE STANDARD TABLE OF scarr WITH NON-UNIQUE

DEFAULT KEY INITIAL SIZE 100,

wa_itab TYPE scarr.

  • WA_ITAB TYPE SCARR.

SELECT * INTO TABLE itab FROM scarr.

LOOP AT itab INTO wa_itab.

WRITE:/ wa_itab-carrid,10 wa_itab-carrname,35 wa_itab-CURRCODE, 45

wa_itab-URL.

ENDLOOP.

-


program No : 2

DATA: BEGIN OF D_SCARR,

CARRID TYPE SCARR-CARRID,

CARRNAME TYPE SCARR-CARRNAME,

CURRCODE TYPE SCARR-CURRCODE,

URL TYPE SCARR-URL,

END OF D_SCARR.

DATA: ITAB LIKE STANDARD TABLE OF D_SCARR.

SELECT CARRID CARRNAME CURRCODE URL

FROM SCARR

INTO TABLE ITAB.

LOOP AT ITAB INTO D_SCARR.

WRITE: D_SCARR-CARRID,10 D_SCARR-CARRNAME, 35 D_SCARR-CURRCODE, 45

D_SCARR-URL.

ENDLOOP.

-


2 ) what is the difference Between these two

wa_itab TYPE scarr. and

WA_ITAB TYPE SCARR.

Thanks in Advance

Sri...

4 REPLIES 4
Read only

Former Member
0 Likes
586

Hi,

Are you serious about these questions?

I remember someone has answered these questions last week.

Kindly search the SDN for your queries before you post any.

Regards

Subramanian

Read only

Former Member
0 Likes
586

Hi Krishna,

2nd is better because in this the internal table has the line type(structure) D_SCARR and fields like of database table SCARR . So loop at internal table instead of database table because internal table has already fetched values from SCARR by select query.

Hope this helps.

Reward if helpful.

Regards,

Sipra

Read only

Former Member
0 Likes
587

i think 2nd one is better because instead of using select * always use the fieldnames in select query.

and

wa_itab TYPE scarr. and

WA_ITAB TYPE SCARR.

both are same because abap is not case sensitive.

regards

shiba dutta

Read only

Former Member
0 Likes
586

1> the second statement is good, as u have selected only those fields which u need to print and also your internal table also contains the same fields. in the first statement you are selecting all fields wgich are not required in your case and will cause performance issue.

to much improve the second statement. declare the internal table with header line rather than declaring a sepearate work area.

2> the two statements

wa_itab TYPE scarr. and

WA_ITAB TYPE SCARR.

are same as ABAP is not case sensitive