Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Please solve the code inpsector error: Sequential read access possible

Former Member
0 Likes
8,722

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

5 REPLIES 5
Read only

HermannGahm
Product and Topic Expert
Product and Topic Expert
0 Likes
4,418

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

Read only

ravi_lanjewar
Contributor
0 Likes
4,418

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.

Read only

0 Likes
4,418

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

Read only

0 Likes
4,418

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.

Read only

Former Member
0 Likes
4,418

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