‎2010 Aug 09 10:21 AM
Hi,
i am getting code inspector warning message . could u please try to provide the solution for that warning message.
code inspector warning message is : Sequential read access possible for a hashed table
My statment : read table <lt_product_mbr> with table key (ujr0_c_member_id) = <l_product> assigning <ls_product_mbr>.
i declared <LT_PRODUCT_MBR> TYPE ANY TABLE.
Eventough i delared it as a type hashed or sorted . it is giving same warning message.
Regards
Koti
‎2010 Aug 09 11:42 AM
Hi Koti,
you specified the key field dynamically (variable in brackets). That means
it can not be checked statically whether the table key of the hashed table
is used or not since this is only clear at run time.
If you use the dynamic key specification
read table <lt_product_mbr> with table key (ujr0_c_member_id) = <l_product> assigning <ls_product_mbr>.
and not the direct key:
read table <lt_product_mbr> with table key field = <l_product> assigning <ls_product_mbr>.
the CI will warn you that you may end up with a sequential red (if not the table key of the hashed table
is used in the variable at run time.
Kind regards,
Hermann
‎2010 Aug 12 1:15 PM
Hi,
read table <lt_product_mbr> with table key (ujr0_c_member_id) = <l_product> assigning <ls_product_mbr>.
Write the above code in following manner
read table <lt_product_mbr> with key (ujr0_c_member_id) = <l_product> assigning <ls_product_mbr>.
Don't use with table key use the with key
Try this One.
‎2010 Aug 13 5:55 AM
Hi Ravishankar ,
i tried ur solution ,but it is giving same warning message. i declared that table type as hashed table. i tried to change the table type as standard table the warning message is resolved but it is going to dump.
Thanks and Regards
Koti
‎2010 Aug 13 6:46 AM
Hi Koti,
Dynamic condition is not allowed on read table statement
read table <lt_product_mbr> with key field = <l_product> assigning <ls_product_mbr>.
Write the your statement above manner.
‎2010 Sep 15 12:44 PM
Hi Koti,
I faced similar kind of issue, I found some workaround solution, to fix the Code inspector warning.
I hope it will work for you also
read table <lt_product_mbr> with table key (ujr0_c_member_id) = <l_product> assigning <ls_product_mbr>.
Instead of reading table with dynamic condition, loop the field-symbol and within loop check the dynamic field value like mentioned below.
bold FIELD-SYMBOLS : <FS_FIELD> TYPE ANY.
LOOP AT <LT_PRODUCT_MBR> ASSIGNING <LS_PRODUCT_MBR>.
ASSIGN COMPONENT UJR0_C_MEMBER_ID OF STRUCTURE <LS_PRODUCT_MBR> TO <FS_FIELD>.
IF <FS_FIELD> EQ <L_PRODUCT>.
DO YOUR LOGIC.
EXIT.
ENDIF.
ENDLOOP.
bold
Thanks & Best Regards
Hari Babu