‎2009 Jan 07 2:45 AM
Hi ,
this read is not working as expected any suggestions????
SELECT * FROM cdpos INTO TABLE t_cdpos
WHERE objectid = t_cdhdr1-objectid AND
objectclas = 'EINKBELEG' AND
changenr = t_cdhdr1-changenr and
tabname = 'EKPO' .
IF sy-subrc = 0.
read table t_cdpos with
key tabkey+16(2) = tbl_output-ebelp binary search.
if sy-subrc = 0 .
l_ponum = t_cdpos-tabkey+3(10).
l_poline = t_cdpos-tabkey+16(2).
endif.
ENDIF.
ENDIF.
‎2009 Jan 07 2:49 AM
hi,
You need to use the sort on table t_cdpos before using Binary search in the Read Statement.
And check value exists in tbl_output-ebelp .
Edited by: avinash kodarapu on Jan 7, 2009 8:22 AM
‎2009 Jan 07 2:49 AM
hi,
You need to use the sort on table t_cdpos before using Binary search in the Read Statement.
And check value exists in tbl_output-ebelp .
Edited by: avinash kodarapu on Jan 7, 2009 8:22 AM
‎2009 Jan 07 4:19 AM
Hi,
U need to sort the table before applying Read using binary search,
Chk this
http://help.sap.com/saphelp_nw04s/helpdata/en/fa/e8a9c30c1711d5b38a0050dadfafba/frameset.htm
Regards,
Manish
‎2009 Jan 07 4:25 AM
> SELECT * FROM cdpos INTO TABLE t_cdpos
> WHERE objectid = t_cdhdr1-objectid AND
> objectclas = 'EINKBELEG' AND
> changenr = t_cdhdr1-changenr and
> tabname = 'EKPO' .
> sort table t_cdpos with key key tabkey. "<<<addition
> IF sy-subrc = 0.
> read table t_cdpos with
> key tabkey+16(2) = tbl_output-ebelp binary search.
> if sy-subrc = 0 .
> l_ponum = t_cdpos-tabkey+3(10).
> l_poline = t_cdpos-tabkey+16(2).
> endif.
> ENDIF.
> ENDIF.
‎2009 Jan 07 4:30 AM
always sort the internal table with the filelds that you used in read statement key ....when u use binary search ...that's it .
‎2009 Jan 07 4:51 AM
Hi Revanth,
One liner from my side i.e. Sort the table before deleting the adjacent duplicate records.
regards
Sachin Sharma
‎2009 Jan 07 4:55 AM
hi,
SELECT * FROM cdpos
INTO TABLE t_cdpos
WHERE objectid = t_cdhdr1-objectid AND
objectclas = 'EINKBELEG' AND
changenr = t_cdhdr1-changenr and
tabname = 'EKPO' .
IF sy-subrc = 0.
read table t_cdpos with
key tabkey+16(2) = tbl_output-ebelp binary search.
if sy-subrc = 0 .
l_ponum = t_cdpos-tabkey+3(10).
l_poline = t_cdpos-tabkey+16(2).
endif.
ENDIF.
ENDIF.
after select sort the internal table with key.
‎2009 Jan 07 4:58 AM
hi,
SELECT * FROM cdpos
INTO TABLE t_cdpos
WHERE objectid = t_cdhdr1-objectid AND
objectclas = 'EINKBELEG' AND
changenr = t_cdhdr1-changenr and
tabname = 'EKPO' .
sort t_cdpos by ebelp. "with ur key
IF sy-subrc = 0.
read table t_cdpos with key tabkey+16(2) = tbl_output-ebelp binary search.
if sy-subrc = 0 .
l_ponum = t_cdpos-tabkey+3(10).
l_poline = t_cdpos-tabkey+16(2).
endif.
ENDIF.
ENDIF.
‎2009 Jan 07 5:08 AM
Hi,
When you are using binary search in the read statement you want to sort the table before itself.
Have you checked the SY-SUBRC = 0 after the select statement.
Regards,
Joan