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

how to give read statement checking condition

Former Member
0 Likes
1,623

hi,

i am trying to give like this, but it throws an error can u tell me how to give a read statement checking two conditions.

READ TABLE I_RSEG INTO WA_TAB_RSEG WITH KEY BELNR = WA_TAB_RBCO-BELNR

AND GJAHR = WA_TAB_RBCO-GJAHR

AND BUZEI = WA_TAB_RBCO-BUZEI.

hi,

i am trying to give like this, but it throws an error can u tell me how to give a read statement checking two conditions.

READ TABLE I_RSEG INTO WA_TAB_RSEG WITH KEY BELNR = WA_TAB_RBCO-BELNR

AND GJAHR = WA_TAB_RBCO-GJAHR

AND BUZEI = WA_TAB_RBCO-BUZEI.

7 REPLIES 7
Read only

Former Member
0 Likes
1,085

Remove 'AND'

<b>thanks for the reward!</b>

Read only

Former Member
0 Likes
1,085

Hi Anitha,

READ statement wont have 'AND's in them. Your statement will work fine without having 'AND's. Lets try by omitting 'AND's in ur statement.

Please change the code as follows.

1)

READ TABLE I_RSEG INTO WA_TAB_RSEG WITH KEY BELNR = WA_TAB_RBCO-BELNR

GJAHR = WA_TAB_RBCO-GJAHR

BUZEI = WA_TAB_RBCO-BUZEI.

2)sort i_resg by belnr gjahr buzei.

READ TABLE I_RSEG INTO WA_TAB_RSEG WITH KEY BELNR = WA_TAB_RBCO-BELNR

GJAHR = WA_TAB_RBCO-GJAHR

BUZEI = WA_TAB_RBCO-BUZEI binary search.

The above statement will fetch u particular record faster than the above READ statement.

Thanks,

Vinay

Message was edited by: Vinaykumar Gorrela

Read only

suresh_datti
Active Contributor
0 Likes
1,085

Pl change it to


sort I_rseg by belnr gjahr buzei.
READ TABLE I_RSEG INTO WA_TAB_RSEG WITH KEY 
BELNR = WA_TAB_RBCO-BELNR
GJAHR = WA_TAB_RBCO-GJAHR
BUZEI = WA_TAB_RBCO-BUZEI
binary search. 

Regards,

Suresh Datti

Read only

Former Member
0 Likes
1,085

Hi Anitha,

1. AND

Dont use AND keyword.

regards,

amit m.

Read only

Former Member
0 Likes
1,085

Hi Anitha,

Please change the code as shown below :

READ TABLE I_RSEG INTO WA_TAB_RSEG WITH KEY BELNR = WA_TAB_RBCO-BELNR

GJAHR = WA_TAB_RBCO-GJAHR

BUZEI = WA_TAB_RBCO-BUZEI.

Lanka

Read only

Former Member
0 Likes
1,085

Hi Anitha,

Do use it like this.

READ TABLE I_RSEG

INTO WA_TAB_RSEG WITH KEY BELNR = WA_TAB_RBCO-BELNR

GJAHR = WA_TAB_RBCO-GJAHR

BUZEI = WA_TAB_RBCO-BUZEI.

if sy-subrc eq 0.

else.

endif.

Cheers

JK

PS: Award points if this helps you

Read only

Former Member
0 Likes
1,085

read table i_rseg into wa_tab_rseg with key belnr = wa_tab_rbco-belnr

gjahr = wa_tab_rbco-gjahr

buzei = wa_tab_rbco-buzei.