‎2009 Nov 13 7:58 AM
Hello Expert,
I am geting problem in read statement.
I am looping internal table Gt-ZSD0122t with vbeln and ponr and inside i am reading the one more internal table
GT_LIPS with GT_ZSD0122t-VBELN and GT_ZSD0122t-POSNR.
I have same value for vbeln and posnr in the 2 internal table than also sy-subrc i am getting 8.
So can u please tell me what is problem.
LOOP AT GT_ZSD0122T.
READ TABLE GT_LIPS INTO WA_LIPS WITH KEY VBELV = GT_ZSD0122T-VBELN
POSNV = GT_ZSD0122T-POSNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE WA_LIPS-VBELN TO GT_ZSD0122T-VBELN_D.
CLEAR:WA_LIPS-VBELN.
MODIFY GT_ZSD0122T.
ENDIF.
ENDLOOP.
what is the problem if sy-subrc equal to 8?
‎2009 Nov 13 8:01 AM
Hello,
Before the loop sort the internal table and check
sort gt_lips by vbelv posnv. "add this
LOOP AT GT_ZSD0122T.
READ TABLE GT_LIPS INTO WA_LIPS WITH KEY VBELV = GT_ZSD0122T-VBELN
POSNV = GT_ZSD0122T-POSNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE WA_LIPS-VBELN TO GT_ZSD0122T-VBELN_D.
CLEAR:WA_LIPS-VBELN.
MODIFY GT_ZSD0122T.
ENDIF.
ENDLOOP.
Vikranth
‎2009 Nov 13 8:01 AM
Hello,
Before the loop sort the internal table and check
sort gt_lips by vbelv posnv. "add this
LOOP AT GT_ZSD0122T.
READ TABLE GT_LIPS INTO WA_LIPS WITH KEY VBELV = GT_ZSD0122T-VBELN
POSNV = GT_ZSD0122T-POSNR
BINARY SEARCH.
IF SY-SUBRC EQ 0.
MOVE WA_LIPS-VBELN TO GT_ZSD0122T-VBELN_D.
CLEAR:WA_LIPS-VBELN.
MODIFY GT_ZSD0122T.
ENDIF.
ENDLOOP.
Vikranth
‎2009 Nov 13 8:03 AM
Hi ,
First u sort the internal table GT_LIPS based on vbelv and posnv .
then u can perform the binary search. because for binary serch , u should sort the table based on key field (ie u r using in read statement)
‎2009 Nov 13 8:43 AM
Hi shridarudupi ,
Before using the BINARY SEARCH option in read statement you should sort the internal.
This is the primary requirement for using Binary Search.
‎2009 Nov 13 8:51 AM
Always sort the internal table before using Binary search
SOR GT_ZSD0122T VBELV POSNV ASCENDING.
‎2009 Nov 15 12:00 AM