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

Values not populating..

former_member192432
Participant
0 Likes
508

Hi ,

In below code values are not populating in work area gs_ekbe after READ statement .

If i put BINARY SEARCH keyword the values are not populating and if i remove it then values are populating.

Please can any one tell me the reason.

SELECT ebeln

ebelp

bewtp

bwart

budat

matnr

werks

FROM ekbe INTO TABLE t_ekbe

WHERE budat IN s_eindt

AND matnr IN so_matnr

AND werks IN s_werks

AND bewtp EQ 'E'

AND bwart IN ('101','105').

SORT t_ekbe DESCENDING BY ebeln ebelp budat.

DELETE ADJACENT DUPLICATES FROM t_ekbe COMPARING ebeln ebelp.

LOOP AT t_eket INTO gs_eket.

READ TABLE t_ekbe INTO gs_ekbe WITH KEY ebeln = gs_eket-ebeln

ebelp = gs_eket-ebelp BINARY SEARCH .

gst_table-budat = gs_ekbe-budat .

Regards

chetan

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
472

chetan,

Your SORT and WITH KEY parameters are not exactly the same.. Instead you can do:

SORT t_ekbe DESCENDING BY ebeln ebelp budat.

DELETE ADJACENT DUPLICATES FROM t_ekbe COMPARING ebeln ebelp.

SORT t_ekbe DESCENDING BY ebeln ebelp.

LOOP AT t_eket INTO gs_eket.

...

ENDLOOP.

BR,

SB

3 REPLIES 3
Read only

Former Member
0 Likes
473

chetan,

Your SORT and WITH KEY parameters are not exactly the same.. Instead you can do:

SORT t_ekbe DESCENDING BY ebeln ebelp budat.

DELETE ADJACENT DUPLICATES FROM t_ekbe COMPARING ebeln ebelp.

SORT t_ekbe DESCENDING BY ebeln ebelp.

LOOP AT t_eket INTO gs_eket.

...

ENDLOOP.

BR,

SB

Read only

former_member192432
Participant
0 Likes
472

The table was not sorted before read statement , So i write one more sort statemet just before loop and values are getting populated.

Read only

Former Member
0 Likes
472

answers yes, correct no!

Of course the table is sorted, but descending iws nonsense, the BINARY SEARCH needs ASCENDING.

And ASCENDING is fine with the DELETE ADJACENT DUPLICATES.

Sort once but correctly!