Skip to Content
0

How to use [%0] , [%1] , ..... etc perfectly

Aug 22, 2017 at 07:45 AM

19

avatar image
Former Member

Good Morning SAP Experts,

i really have a very important Issue ( to me ) and i tried every possible way to solve it but still have no result.

select t.a , t.b , t.c from myTable where t.d = [%0]

this is going to work very well and the user has to input the value of "d".

why doesnt it work like this :

declare @aa varchar(20)

SET @aa = [%0]

select t.a , t.b , t.c from myTable where t.d = @aa

??

my problem is simply that i need sometimes to use this input in two different positions in the same Qurey.

i need to let the user input the value that i store as a variable and use this variable wherever i need it in my Query... as simple as this.

Can anyone help me or make me understand why it doesnt work like this?

Thanks in Advance

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Anand Singh Aug 24, 2017 at 11:25 AM
0

Hi ,

Use Below logic:-

declare @aa varchar(20)

SET @aa = (select x.d from mytable x where x.d = [%0])

select t.a , t.b , t.c from myTable t where t.d = @aa

from this way you can use @aa variable more than one time.

Regards,

Anand

Share
10 |10000 characters needed characters left characters exceeded