Skip to Content
0
May 17, 2019 at 03:39 PM

AMDP select from document store collection

1188 Views

Hi,

I have a DocStore collection named food_collection from which I'm getting data into the ABAP world through an AMDP.

The code for the AMDP looks like this:

PUBLIC SECTION.
    INTERFACES if_amdp_marker_hdb.
    TYPES:
      BEGIN OF ty_food_json,
        food_collection TYPE string,
      END OF ty_food_json,

      tt_food_json TYPE STANDARD TABLE OF ty_food_json WITH DEFAULT KEY.

    CLASS-METHODS:
      read_by_group IMPORTING VALUE(group)    TYPE string
                    EXPORTING VALUE(result) TYPE tt_food_json.

CLASS zfetch_food_collection IMPLEMENTATION .
  METHOD read_by_group BY DATABASE PROCEDURE
                                FOR HDB
                                LANGUAGE SQLSCRIPT
                                OPTIONS READ-ONLY.
      result =
        SELECT * FROM "MYSCHEMA"."FOOD_COLLECTION"
            where "group" = :group;
  ENDMETHOD.
ENDCLASS.

Now, when I try to call to this AMDP with something like:

zfetch_food_collection=>read_by_group(  
EXPORTING  group  = `'Vegetables'`  
IMPORTING  et_result = data(food)).  

cl_demo_output=>display( food ).

I get the following error:

feature not supported: ... line 9 col 5 (at pos 302): a where clause has an expression that cannot be supported by collection tables

So for some reason I can't query JSON properties from the AMDP. This query works perfectly in the SQL console:

SELECT * FROM "MYSCHEMA"."FOOD_COLLECTION"where "group" = 'Vegetables';


Statement 'SELECT * FROM "MYSCHEMA"."FOOD_COLLECTION" where "group" = 'Vegetables'' 
successfully executed in 44 ms 26 µs  (server processing time: 5 ms 994 µs)
Fetched 3 row(s) in 0 ms 44 µs (server processing time: 0 ms 0 µs)

I tried changing the parameter name to |'Vegetables'|, didn't work. I also tried concatenating the single quotes inside the AMDP body rather than from the caller, didn't work either.

Has anyone experienced this?