Skip to Content
0
Aug 07, 2016 at 02:27 PM

Read Table With Key syntax - why cannot use 'EQ'?

759 Views

Hello,

I know that the READ TABLE statement can only return a single row, and for that reason the WITH (TABLE) KEY addition cannot accept anything but comparison ('=').

The question is, why can't I type 'EQ' instead of '='?

For example,

This is the possible syntax:

READ TABLE lt_materials[] INTO ls_material WITH KEY material_type = 'FOOD'.

This is my desired syntax:

READ TABLE lt_materials[] INTO ls_material WITH KEY material_type EQ 'FOOD'.


I always use only 'EQ' whenever I compare - in WHERE clauses of SELECTs and LOOP ATs, in IFs and CHECKs. So why does READ TABLE WITH KEY have to be different?

In my opinion, the '=' operator should only be used for assignments. When I go through my code quickly, I can easily see exactly where there are assignments and where there are comparisons, except this case of READ TABLE WITH KEY.


Does anyone have an explanation for this?