cancel
Showing results for 
Search instead for 
Did you mean: 

User defined query parameter in query generator

Former Member
0 Kudos

Hi All,

i am using query generator in SAP to print some records of user defined query. precisely, the details about sales employees are to be printed. now the columns which exist in the database (ie. sales employee code, name, cardcode) etc can be given as a parameter like [%0] and [%1]. but some user defined parameter such as sales commission does not show as such parameter. i want one column as



select T0.doctotal, (T0.doctotal * [%0]) / 100  as brokerage from OINV T0
--where [%0] is some commission percentage that the user will give while running this query

This query gives correct results but it gives the parameter name as 'doctotal' while showing. any idea as to how to handle it properly in SAP?

thanks in advance,

Binita

Edited by: Binita Joshi on Sep 8, 2009 3:35 PM

Accepted Solutions (0)

Answers (2)

Answers (2)

former_member204969
Active Contributor
0 Kudos

I sometimes defined a UDT only for getting the appropriate parameter entering window. The table has no data; I used it only for its field names in this window.

(The parameter request can be placed inside a comment and the entered value is used setting an SQL variable like this:

declare @d datetime
/*select t.createdate from ordr t where t.createdate=[%0]*/
set @d=[%0]

This SQL variable can be used later in the real query.)

Former Member
0 Kudos

Hi Binita,

You need at least an UDF in order to define query parameter. There is no option that you could give free form query parameter. All '[%0\]' variables are linked to a field.

Thanks,

Gordon