Skip to Content
avatar image
Former Member

[Help] - APPLY_FILTER error

Hi experts, I'm doing dynamic filtering in SAP B1 version for HANA. I'm reading this article APPLY_FILTER but I cannot get it.

I'm receiving this error:

Could not execute 'CALL "SBODEMOAU"."TEST1" ()'
SAP DBTech JDBC: [257]: sql syntax error:  SQLScript APPLY_FILTER: condition in filter variable is incorrect:  'WHERE "ItemCode" = 'OS0001''

Below is my sample query:

CREATE PROCEDURE "SBODEMOAU"."TEST1" ()
AS

BEGIN 

DECLARE oWHERE varchar(50);
oWHERE := ' WHERE "ItemCode" = ''OS0001'' ';

	lt_test = SELECT "ItemCode", "ItemName" FROM "OITM" ; 
	proc = APPLY_FILTER(:lt_test, :oWHERE);
	 
END;

CALL "SBODEMOAU"."TEST1" ();
DROP PROCEDURE "SBODEMOAU"."TEST1";
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • avatar image
    Former Member
    May 15, 2017 at 02:43 PM

    Anyone who already tried this?

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 14 at 03:57 AM

    Hi Bryan

    Greetings!!!

    You don't need to write "where" in your string while passing it in to APPLY_FILTER. Just simply mention

    oWHERE := 'ItemCode = ''OS0001''';

    Please include a select statement from :proc after APPLY_FILTER statement.

    Say,

    SELECT * FROM :proc;

    That should give you the output.

    Best Regards

    Srujan Gannamaneni

    Add comment
    10|10000 characters needed characters exceeded