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 - behaving diffrently in development and prodution

Former Member
0 Likes
1,247

Dear friend,

 LOOP AT IT_DATA INTO WA_DATA.
       READ TABLE IT_BKPF INTO WA_BKPF---------------------------------------------------------------
                          WITH KEY BUKRS = WA_DATA-BUKRS
                                   GJAHR = WA_DATA-GJAHR
                                   BELNR = WA_DATA-BELNR BINARY SEARCH.
       IF SY-SUBRC = 0.
         WA_DATA-STGRD = WA_BKPF-STGRD.
         MODIFY IT_DATA FROM WA_DATA TRANSPORTING STGRD.
       ENDIF.

       CLEAR : WA_DATA, WA_BKPF.
     ENDLOOP.

piece code of my program, the most strange thing it working proper in devlopment ,but not in prodution

where i made big line(-------) in that work area data not coming when the cursor on sy-subrc.

kindly help me out

victor ezaaz

Edited by: Matt on Aug 8, 2011 1:20 PM added tags

14 REPLIES 14
Read only

Former Member
0 Likes
1,215

Hi,

Hi, i have faced the issue several times.

This issue is because of the use of binary search.You can remove it and test,Should work fine.

Read only

deepak_dhamat
Active Contributor
0 Likes
1,215

Hi ,

LOOP AT IT_DATA INTO WA_DATA.
READ TABLE IT_BKPF INTO WA_BKPF---------------------------------------------------------------
WITH KEY BUKRS = WA_DATA-BUKRS
GJAHR = WA_DATA-GJAHR
BELNR = WA_DATA-BELNR BINARY SEARCH.
IF SY-SUBRC = 0.
WA_DATA-STGRD = WA_BKPF-STGRD.
MODIFY IT_DATA FROM WA_DATA TRANSPORTING STGRD.
ENDIF.

CLEAR : WA_DATA, WA_BKPF.
ENDLOOP.

in above code you have used work area WA_DATA . Please check which table you have assigned while creating wa_data whether thay have same no of fields and order in Production and Development .

regards

Deepak.

Read only

former_member404244
Active Contributor
0 Likes
1,215

Hi,

Before using binary search .. hope you have sorted your internal table.

You need to sort the internal table before using read statment..Binary search.

Regards,

Nagaraj

Read only

0 Likes
1,215

Hi ,

Yes Nagarajan is right .

regards

Deepak.

Read only

Former Member
0 Likes
1,215

Firstly sort your internal table to read any table using binary search. above answer is correct

Read only

Former Member
0 Likes
1,215

You should Sort the internal table BY BURKS....it will be fine then...

Read only

Former Member
0 Likes
1,215

Hi Victor,

I too faced same issue and this is because of BINARY SEARCH keyword.

And sy-subrc values are set to 6 or 8.

so just remove Keyword BINARY SEARCH where ever you have used them and then move to productiona and run again.

BR

Dep

Read only

matt
Active Contributor
0 Likes
1,215

Anyone else wishing to suggest sorting before using Binary Search?

Read only

0 Likes
1,215

Anybody else want to suggest removing the binary saearch?

Rob

Read only

0 Likes
1,215

Anyone else wishing to suggest sorting before using Binary Search?

if I may add : use F1 help on READ statement...

Read only

Former Member
0 Likes
1,215

Hi

Every one will suggest

SORT IT_BKPF BY BUKRS GJAHR BELNR.

That is the basic rule of BINARY SEARCH.

The fields which are used for binary search must be sorted.

Don't ever remove it will affect your performance as it will flow linear search

Thanks

Hariharan.

Read only

matt
Active Contributor
0 Likes
1,215

Of course you remove it. Design your program correctly, and you'll never* need to use it. SORTED/HASHED tables anyone? I haven't used binary search in years.

*well, hardly ever.

Read only

0 Likes
1,215

Hi

IF YOU USE SORTED/HASHED TABLE NO NEED TO USE BINARY SEARCH . AS WE KNOW BOTH FOLLOW BINARY SEARCH .

THANKS MATT .

THANKS

HARIHARAN.

Read only

Former Member
0 Likes
1,215

Thanks nagrajan

Regards

Victor