Skip to Content
avatar image
-1
Former Member

Error when trying to use new Abap 7.40 : FILTER #

Hello,
Using the new abap 7.40 capabilities, I'm trying to copy an internal table to another with a condition on a column.
And I receive this error :
Table "" does not have a key "PLNNR". A direct value or a dynamically specified key of the form "(name)" is expected.


Here is the structure of my table :
MANDT MANDT / KEY
PLNNR PLNNR / KEY
COUNTER ZCOUNTER / KEY
SUBMETHOD ZSUBMETHOD
DELETED ZDELFLAG

And following is the code :

DATA : lt_tmp_submethods TYPE TABLE OF zqm_les_jl_subm. 
DATA : lt_tmp_submethods_2 TYPE SORTED TABLE OF zqm_les_jl_subm 
WITH NON-UNIQUE KEY plnnr.

LOOP AT xtab ASSIGNING FIELD-SYMBOL(<jl_submeth>).
lt_tmp_submethods = FILTER #( lt_tmp_submethods_2 USING KEY 
plnnr WHERE plnnr = <jl_submeth>-plnnr ).
ENDLOOP.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • May 03 at 05:47 PM

    Your internal table indeed has no secondary key named plnnr. It has only a primary key with a key field plnnr.

    Read the documentation about internal table keys!

    Your code might work with USING KEY primary_key.

    https://help.sap.com/http.svc/rc/abapdocu_752_index_htm/7.52/en-US/index.htm?file=abenconstructor_expr_filter_basic.htm

    Add comment
    10|10000 characters needed characters exceeded