Skip to Content
0
Former Member
Feb 10, 2007 at 07:24 AM

Performance wise which is the best

18 Views

Hi all,

Here iam giving you Two programs, which will give the same output. But My question is Performance wise which is the Best program.

Program No: 1.

DATA: WA_SBOOK TYPE SBOOK.

SELECT * FROM SBOOK INTO WA_SBOOK

WHERE

CARRID = 'LH ' AND

CONNID = '0400' AND

FLDATE = '20040424'

ORDER BY PRIMARY KEY.

WRITE: / WA_SBOOK-BOOKID,17 WA_SBOOK-CUSTOMID,

29 WA_SBOOK-CUSTTYPE, 40 WA_SBOOK-SMOKER,

50 WA_SBOOK-LUGGWEIGHT, 65 WA_SBOOK-WUNIT,

75 WA_SBOOK-INVOICE.

ENDSELECT.

-


Program No : 2.

DATA: BEGIN OF A_SBOOK,

BOOKID TYPE SBOOK-BOOKID,

CUSTOMID TYPE SBOOK-CUSTOMID,

CUSTTYPE TYPE SBOOK-CUSTTYPE,

SMOKER TYPE SBOOK-SMOKER,

LUGGWEIGHT TYPE SBOOK-LUGGWEIGHT,

WUNIT TYPE SBOOK-WUNIT,

INVOICE TYPE SBOOK-INVOICE,

END OF A_SBOOK.

DATA: ITAB LIKE STANDARD TABLE OF A_SBOOK.

START-OF-SELECTION.

SELECT BOOKID

CUSTOMID

CUSTTYPE

SMOKER

LUGGWEIGHT

WUNIT

INVOICE

FROM SBOOK

INTO TABLE ITAB

WHERE CARRID = 'LH ' AND

CONNID = '0400' AND

FLDATE = '20040424'.

LOOP AT ITAB INTO A_SBOOK.

WRITE: / A_SBOOK-BOOKID,17 A_SBOOK-CUSTOMID,

29 A_SBOOK-CUSTTYPE, 40 A_SBOOK-SMOKER,

50 A_SBOOK-LUGGWEIGHT, 65 A_SBOOK-WUNIT,

75 A_SBOOK-INVOICE.

ENDLOOP.

Thanks in Advance

Sri..