‎2009 Aug 25 7:57 AM
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
‎2009 Aug 25 8:59 AM
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
‎2009 Aug 25 8:59 AM
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
‎2009 Aug 25 10:39 AM
The table was not sorted before read statement , So i write one more sort statemet just before loop and values are getting populated.
‎2009 Aug 25 11:54 AM
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!