‎2008 Aug 26 9:45 PM
My read stmt is not working in ECC 6.0
READ TABLE gt_zadi_matnr_conv WITH KEY
mandt = sy-mandt zadi_key_type = 'WERKS'
zadi_key_value = gs_zadi_m_2017_gm02-plant BINARY SEARCH.
‎2008 Aug 26 9:59 PM
SORT gt_zadi_matnr_conv BY zadi_key_value.
LOOP AT gt_zadi_m_2017_gm02 INTO gs_zadi_m_2017_gm02.
READ TABLE gt_zadi_matnr_conv WITH KEY zadi_key_type = 'WERKS'
zadi_key_value = gs_zadi_m_2017_gm02-plant BINARY SEARCH.
IF sy-subrc = 0 .
gv_reebok_monitor = 'X'.
PERFORM convert_number_rbk_vs_adi USING gs_zadi_m_2017_gm02-plant
gs_zadi_m_2017_gm02-material
CHANGING gs_zadi_m_2017_gm02-material.
ENDIF.
Ihave commented sort stmt like
SORT gt_zadi_matnr_conv BY zadi_key_value.
Now my code is working ..
Now my doubt is Can I comment my sort ?????????
Or is there any issu ue?
If so please suggest me what to do ?
‎2008 Aug 26 9:48 PM
Pretty sure you don't need the MANDT in there, but not sure that is causing your problem. Do you mean you are getting a syntax error? What is the error? Or is it simply not returning anything?
READ TABLE gt_zadi_matnr_conv WITH KEY
zadi_key_type = 'WERKS' "<--- is this value correct?
zadi_key_value = gs_zadi_m_2017_gm02-plant
BINARY SEARCH.
if sy-subrc = 0.
...
endif.Regards,
Rich Heilman
‎2008 Aug 26 9:51 PM
‎2008 Aug 26 9:53 PM
Is gs_zadi_m_2017_gm02 a table with Header line?
Can you post the code for the entire loop where you are performing this read?
‎2008 Aug 26 9:59 PM
SORT gt_zadi_matnr_conv BY zadi_key_value.
LOOP AT gt_zadi_m_2017_gm02 INTO gs_zadi_m_2017_gm02.
READ TABLE gt_zadi_matnr_conv WITH KEY zadi_key_type = 'WERKS'
zadi_key_value = gs_zadi_m_2017_gm02-plant BINARY SEARCH.
IF sy-subrc = 0 .
gv_reebok_monitor = 'X'.
PERFORM convert_number_rbk_vs_adi USING gs_zadi_m_2017_gm02-plant
gs_zadi_m_2017_gm02-material
CHANGING gs_zadi_m_2017_gm02-material.
ENDIF.
Ihave commented sort stmt like
SORT gt_zadi_matnr_conv BY zadi_key_value.
Now my code is working ..
Now my doubt is Can I comment my sort ?????????
Or is there any issu ue?
If so please suggest me what to do ?
‎2008 Aug 26 10:04 PM
For using binnary search option you have to sort the table first with the same key. Did you try:
SORT gt_zadi_matnr_conv BY zadi_key_type zadi_key_value.
‎2008 Aug 26 10:16 PM
Hi,
If you are using BINARY SEARCH, then please use SORT on the fields which are getting used in the READ STATEMENT WITH KEY, else it will be huge performance issue.
SORT will sought out your problem.
Thanks,
Kartavya.
‎2008 Aug 26 10:50 PM
Aparna Sekahar and Karthavaya THANK S FOR YOUR TIMELY REPLY.....!