Skip to Content
-1
Apr 07, 2020 at 03:51 AM

AMDP database function - NULL not working

1459 Views

Hi All,

I am having my logic inside AMDP with the CDS table function tagged to it. I can access the data with the table function and there are no issues with that. My problem is with the EKKO.LOEKZ = ' ' . This condition is not working. I have tried to use IS NULL and LOEKZ = ' ' but the records are not filtered with this condition. When I use the same query inside a HANA stored procedure, those null conditions are working fine without any issues and the data is filtered. Please let me know whether I need to take care of something in AMDP or Database function when using NULL or blank in the where clause.

CLASS zcl_openpo_amdp DEFINITION
  PUBLIC
  FINAL
  CREATE PUBLIC .
  PUBLIC SECTION.
    INTERFACES : if_amdp_marker_hdb.
    CLASS-METHODS get_po FOR TABLE FUNCTION zibp_cdstf_openpo.
  PROTECTED SECTION.
  PRIVATE SECTION.
ENDCLASS.

CLASS zcl_openpo_amdp IMPLEMENTATION.
  METHOD get_po BY DATABASE FUNCTION FOR HDB LANGUAGE SQLSCRIPT OPTIONS READ-ONLY.
    lt_openpo = select ekpo.matnr as product , ekpo.werks as recvsite,
                                   from "SCHEMA1"."EKPO" as ekpo inner join "SDIERP"."EKKO" as ekko                                                                 on  ekko.mandt = ekpo.mandt and
                                                     ekko.ebeln = ekpo.ebeln
                                                 where   ekko.bsart in ('NB','KV') and
                                                         ekko.loekz = ' ';
     return :lt_openpo;
  ENDMETHOD.
ENDCLASS.