Skip to Content
-2
Aug 29, 2018 at 06:28 AM

Is it possible to pass the IMPORT Parameter of AMDP Class as SQL APPLY_FILTER's second parameter.

4223 Views

Hello All,

I have an Import parameter of an AMDP Class's Method say "iv_sel_opt" of type String.

Which would be indeed having values from "CL_SHDB_SELTAB=>combine_seltabs", so it will convert Select-Options of a Report Screen and convert it into SQL Where Clause.

Now am not able to use this "iv_sel_opt" inside AMDP Method Implementation as second parameter for "APPLY_FILTER".

It says "SQLSCRIPT message: Parameter has a non supported type: APPLY_FILTER: second parameter has to be a scalar variable &A0&A1&A2&A3&A4&A5&A6&A7&A8&A9"

Is there anyway it could be achieved apart from using CDS Table Functions ?

Helpful comments much appreciated.

Thanks,

Sijin

Please find my code :

CLASS zcl_demo_consume_amdp_abap DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .


PUBLIC SECTION.
  INTERFACES : if_amdp_marker_hdb.


  TYPES:
    BEGIN OF ty_mara,
        matnr TYPE c LENGTH 40,
        ernam TYPE c LENGTH 12,
    END OF ty_mara,


    tt_mara TYPE STANDARD TABLE OF ty_mara.
    
  CLASS-METHODS get_mara
    IMPORTING
        VALUE(iv_client)  TYPE mandt
        VALUE(iv_sel_opt) TYPE string
    EXPORTING
        VALUE(et_mara)    TYPE tt_mara.
        
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.


CLASS zcl_demo_consume_amdp_abap IMPLEMENTATION.
  METHOD get_mara BY DATABASE PROCEDURE
                  FOR HDB
                  LANGUAGE SQLSCRIPT
                  OPTIONS  READ-ONLY
                  USING mara.
    et_mara = apply_filter ( mara , iv_sel_opt); " <== Here is the error
  ENDMETHOD.
ENDCLASS.
<br>