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: 

Read Statement

Former Member
0 Kudos

Hi All,

Can we use READ statment in between select and endselect statments.

Is work properly.

Please check this code...

SELECT KUNNR ZTERM FROM KNB1 INTO IKNB1.

READ TABLE ICUSTOMER WITH KEY KUNNR = IKNB1-KUNNR BINARY SEARCH.

IF SY-SUBRC = 0.

IF ICUSTOMER-KTOKD = 'Z001' OR

ICUSTOMER-KTOKD = 'Z004'.

ICUSTOMER-ZTERM = IKNB1-ZTERM.

MODIFY ICUSTOMER INDEX SY-TABIX.

ENDIF.

ENDIF.

ENDSELECT.

Here IKNB1is structure.

Please its urgent.....

Thanks,

Subbu.

1 ACCEPTED SOLUTION

amit_khare
Active Contributor
0 Kudos

yeah it will do, just add SORT ICUSTOMER before select statement.

Regards,

Amit

5 REPLIES 5

amit_khare
Active Contributor
0 Kudos

yeah it will do, just add SORT ICUSTOMER before select statement.

Regards,

Amit

Former Member
0 Kudos

Yes, it works.

Regards,

Santosh

anversha_s
Active Contributor
0 Kudos

Some Slight changes.

<b>clear iknb1.</b>

SELECT KUNNR ZTERM FROM KNB1 INTO IKNB1.

<b>sort icustomer by kunnr.</b>

READ TABLE ICUSTOMER WITH KEY KUNNR = IKNB1-KUNNR BINARY SEARCH.

IF SY-SUBRC = 0.

IF ICUSTOMER-KTOKD = 'Z001' OR ICUSTOMER-KTOKD = 'Z004'.

ICUSTOMER-ZTERM = IKNB1-ZTERM.

MODIFY ICUSTOMER INDEX SY-TABIX.

ENDIF.

ENDIF.

ENDSELECT.

Rgds

Anversha

Former Member
0 Kudos

Hi,

Is there any Aditions in READ Statment for increase the performance of above code.

Thanks,

Subbu

0 Kudos

Do not use select endselect and it will have more performance issue

use like this ..

clear iknb1.

refresh iknb1.

SELECT KUNNR ZTERM FROM KNB1 INTO table IKNB1.

sort icustomer by kunnr.

loop at iknb1.

READ TABLE ICUSTOMER WITH KEY KUNNR = IKNB1-KUNNR BINARY SEARCH.

IF SY-SUBRC = 0.

IF ICUSTOMER-KTOKD = 'Z001' OR ICUSTOMER-KTOKD = 'Z004'.

ICUSTOMER-ZTERM = IKNB1-ZTERM.

MODIFY ICUSTOMER INDEX SY-TABIX.

ENDIF.

ENDIF.

clear :iknb1,

icustomer.

endloop.

this query won't take that much time than ur code.

Reward Points if it is helpful

Thanks

Seshu