cancel
Showing results for 
Search instead for 
Did you mean: 

[Help] - APPLY_FILTER error

Former Member
0 Kudos

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";

Accepted Solutions (0)

Answers (2)

Answers (2)

srujan_gannamaneni
Participant
0 Kudos

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

Former Member
0 Kudos

Anyone who already tried this?