cancel
Showing results for 
Search instead for 
Did you mean: 

SAP user query

Former Member
0 Kudos

Dear All,

Can we make our user query like this

If [%2] != 'C'

Begin

...

End

I tried on my side. It doesn't work. Is there anything wrong with my code? Thanks a lot.

Regards,

yuka

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

User input like [%2\] will not work based on your query. What do you need to achieve?

Thanks,

Gordon

Former Member
0 Kudos

Thanks for reply. I would like to have 2 queries in the user query. If user input is not 'S' run query 1. Otherwise run query 2.

User input [%2]

If the input is not 'S'

...

else

...

end if

Former Member
0 Kudos

That is not supported within B1. You have to put [%2\] variable in the where clause.

Former Member
0 Kudos

Is there any other way I can make my query like that in user query? thanks

Former Member
0 Kudos

Using one query to display the result base on user inputs. Post your current query in mind to see.

Former Member
0 Kudos

So in SAP user query, if we have 2 queries, we have create 2 user queries? We cannot use input parameter to determine which one we would like to run? Thanks

Former Member
0 Kudos

I would do this:

Declare @campo nvarchar (3)

Set @campo = 'xxx'

IF @campo is null or Rtrim (@campo) =' '

BEGIN

Select * From Tabla T0

END

ELSE

IF @campo is not null or rtrim (@campo)< >' '

BEGIN

Select * From Tabla T0 Where T0.campo =@campo

END

-


With pop up variables is the same, just replace Declare query format with /* select from ...*/ variable syntax.

(If you need more information about the Declare in SAPB1 user queries, just let me know).

Answers (1)

Answers (1)

Former Member
0 Kudos

That is right. You may not have options to create menu like interface for query to run.