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

Read Statement

Former Member
0 Likes
677

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
Read only

amit_khare
Active Contributor
0 Likes
642

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

Regards,

Amit

5 REPLIES 5
Read only

amit_khare
Active Contributor
0 Likes
643

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

Regards,

Amit

Read only

Former Member
0 Likes
642

Yes, it works.

Regards,

Santosh

Read only

anversha_s
Active Contributor
0 Likes
642

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

Read only

Former Member
0 Likes
642

Hi,

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

Thanks,

Subbu

Read only

0 Likes
642

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