User defined query parameter in query generator
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
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.)
Similar Messages
-
How do I refer to a user defined field in a query (using $ notation) ?
if i have a user defined field in Invoice header called U_Test, and if I need to read it using a query (to be used on a formatted search).
I am not quite sure of the syntax. can anyone help please?
I tried
$[$U_Test.0.0] which is the accepted way with fields with numerical ids such as $[$8.0.0] etc.
appreciate any help,
Indika.Hi all,
Aliw, the 38 is not the form number, is the Item Number (which I guess is a matrix). In your case the User Defined Field is a line UDF. In Indika´s case is a header UDF.
And that´s the issue. As the indika´s UDF is a header UDF, it lays in a different form (which is named "-" + Main Form Name). Formatted searches work with the $[$Field.Column.Format] notation ONLY in the same form. So, if you try to get the UDF from another UDF, it will work with that notation (they are in the same form). But if you try to get the UDF from the main form, it won´t find it (It is in another form).
In that case you should use the other notation, as Andrea, Alexey and Salvador told you in the posts before.
Hope this clears a bit the issue.
Regards,
Ibai Peñ -
User Defined Type - Array bind Query very slow
Hi.
I have following Problem. I try to use Oracle Instant Client 11 and ODP.NET to pass Arrays in SELECT statements as Bind Parameters. I did it, but it runs very-very slow. Example:
- Inittial Query:
SELECT tbl1.field1, tbl1.field2, tbl2.field1, tbl2.field2 ... FROM tbl1
LEFT JOIN tbl2 ON tbl1.field11=tbl2.field0
LEFT JOIN tbl3 ON tbl2.field11=tbl3.field0 AND tbll1.field5=tbl3.field1
...and another LEFT JOINS
WHERE
tbl1.field0 IN ('id01', 'id02', 'id03'...)
this query with 100 elements in "IN" on my database takes 3 seconds.
- Query with Array bind:
in Oracle I did UDT: create or replace type myschema.mytype as table of varchar2(1000)
than, as described in Oracle Example I did few classes (Factory and implementing IOracleCustomType) and use it in Query,
instead of IN ('id01', 'id02', 'id03'...) I have tbl1.field0 IN (select column_value from table(:prmTable)), and :prmTable is bound array.
this query takes 190 seconds!!! Why? I works, but the HDD of Oracle server works very hard, and it takes too long.
Oracle server we habe 10g.
PS: I tried to use only 5 elements in array - the same result, it takes also 190 seconds...
Please help!I recommend you generate an explain plan for each query and post them here. Based on what you have given the following MAY be happening:
Your first query has as static IN list when it is submitted to the server. Therefore when Oracle generates the execution plan the CBO can accurately determine it based on a KNOWN set of input parameters. However the second query has a bind variable for this list of parameters and Oracle has no way of knowing at the time the execution plan is generated what that list contains. If it does not know what the list contains it cannot generate the most optimal execution plan. Therefore I would guess that it is probably doing some sort of full table scan (although these aren't always bad, remember that!).
Again please post the execution plans for each.
HTH! -
How to use user defined function in select query using Toplink
Hi Friends
I am little bit of new in Toplink stuff... so please help me...
I have to database functions 1. encrypt and 2. decrypt.
I want to exceute the following sql query using toplink
select port, database, user_name, decrypt(encrypt('String which is to be encrypt ','password'),'password') from CONFIGURATION
can anyone tell me , how to write code in toplink which will give the about sql output.
thanks .....The "Specifying a Custom SQL String in a DatabaseQuery" section in the TopLink Developer's Guide may help... http://download-uk.oracle.com/docs/cd/B32110_01/web.1013/b28218/qrybas.htm#BCFHDHBG
-
Query parameter transaction,Query transported but not found in QAS
Hello all,
I have an issue with my custom transactions pointing to queries I created. Here is one of 2 examples:
I have a query in the Global and Standard areas in DEV. Here are my transaction parameters from SE93:
D_SREPOVARI-EXTDREPORT QUE_JPTREMB_02
D_SREPOVARI-REPORTTYPE AQ
D_SREPOVARI-REPORT /SAPQUERY/H2/QUE_JPTREMB_02
This works perfectly fine in DEV, in all the clients.
I transported the query using the Export/Import function to QAS. My query in QAS exists only in the Standard Area. I am not able to export/import queries from the global area.
When I try to run the transaction in QAS, I get the following message:
"Query QUE_JPTREMB_02 does not exist in user group /SAPQUERY/H2"
Can any one tell me what is going on here? How can I resolve this issue? Does this have anything to do with global VS standard areas? How do I point the transaction to the Standard Area if that's the case?
All help appreciated, thank you so much.Hi Jean,
What are the steps you have followed? If I remember correctly the following must be carried out in the following sequence.
1) Use RSAQR3TR to export the query, usergroup and infoset in dev system.
2) release the transports in Dev.
3) import the transports into QAS using STMS (normal Transport mechanism)
4) import the query, usergroup and infoset into QAS using RSAQR3TR
5) identify the ABAP program associated with the query in QAS system.
6) create a Transaction code in dev system, assign it to the same query program (even if it does not exist in DEV) and transport the tcodes into QAS.
7) Execute the query once using SQ01 and then try again using the transaction code.
(I do not know why steps 6 and 7 are necessary, but that is the way they have worked for me, if I omit the steps, the query program dumps)
Anyway, I hope the above helps. -
How to define Lexical Parameter in Oracle report.
Dear all,
I need to know that how i will define lexical parameter in query of report builder
i have like this
SELECT R.EXCEPTION_MESSAGE EXP_MESSAGE,
ER.PROD_ID PRODUCT,
ER.TNAME SEGMENT1 ,
DECODE(R.STATUS,'Y','ROW',
'L','TABLE',
'Z','CIB LEVEL',
NULL) STATUS,
NVL(COUNT(*),0) CNT
FROM EXCEPTION_RECORDS ER,CIB_PROC_TABLES_RULES R
WHERE ER.TABLE_ID=R.CIB_TABLE_ID
AND ER.EXP LIKE '%'||R.EXCEPTION_MESSAGE||'%'
AND ER.BRWR=:v_brwr
&v_where
GROUP BY R.EXCEPTION_MESSAGE,ER.PROD_ID,ER.TNAME,R.STATUS
ORDER BY 2
It is giving an errorV_WHERE should be defined same way as regular parameter. It should acquire certain value that makes the query syntaxically correct bofore the sql is run, usually in the After Param Form trigger, e.g.
v_where := 'WHERE 1=1';
... -
CANT execute query with parameter on user defined tables using query genera
Dear All,
I have problem when executing query with parameter on user defined tables using query generator.
It seems SBO cannot accept parameter to query user defined tables.
I've tried these:
SELECT T0.U_Status FROM [@ST_PR_H] T0 WHERE T0.U_Status = [%0] --- this FAIL
I try to pass the value directly without using parameter and It works
SELECT T0.U_Status FROM [@ST_PR_H] T0 WHERE T0.U_Status = 2 --- this SUCCESS
This one works
SELECT * FROM RDOC T0 WHERE T0.width =[%0] --- this SUCCESS
and this one works too
SELECT * FROM RDOC T0 WHERE T0.width = 595 --- this SUCCESS
Is there anyone can help me ....???
Thanks,
AlfaI generated this code using query wizard ....
SELECT T0.[U_Status] AS 'Document Status' FROM [dbo].[@ST_PR_H] T0 WHERE T0.[U_Status] = (N'2' )
and replaced the (N'2' ) with [%0]
SELECT T0.[U_Status] AS 'Document Status' FROM [dbo].[@ST_PR_H] T0 WHERE T0.[U_Status] = [%0]
and It worked ......
Thanks 4 all ..... -
User defined query parameter in QLD
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. also, when I join 4-5 tables and union, it totally misinterprets the paramater. any idea as to how to handle it properly in SAP?
thanks in advance,
BinitaHi
I know it list many value but u can try by this way....
declare @a numeric(3)
set @a = (select top 100 docnum from oinv T1 where T1.[docnum]= [%0])
select T0.doctotal, (T0.doctotal * @a) / 100 as brokerage from OINV T0
Thanks
Kevin -
SAP B1 Query User defined parameter (checkbox)
Hi,
Is it possible in a query to add user defined parameters?
Example, I want to run a query from OITM table with Item Properties as parameter. But I want the users to be able to choose one or more properties as parameters in the query. I would like to use AND as a clause if more than one Item Property is choosed.
Query example:
Select ItemCode, ItemName, ItmsGrpCod
FROM OITM
WHERE ItmsGrpCod = 100 AND (Here I would like to add a parameter where user can choose one or more of the 64 different Item Properties. I.e. a checkbox would be perfect!)
Regards
Kjetil SandvikHi,
it is impossible in the query generator.
here is the sample:
The option is yes or no instead of checkbox.
You can use SSRS that possibly support checkbox
Regards, -
Unable to run user defined table in Query Generator...
hi experts,
iam unable to run the user defined table in query generator..this is the query iam using...
Select T0.U_Date from dbo.@ENQHEAD T0 where T0.U_EnqNo='[%0]'
When i run this query it popups a window & asking EnqNo,when i select any enquiry no it's saying an error like----- Incorrect syntax near '@ENQHEAD'. iam unable to solve the above problem can anybody suggest me sme ideas....
thanking you,
shangai.Hi Shangai,
I've just tried to reproduce the issue and found the following query worked correctly for me:
SELECT T0.[Name] FROM [dbo].[@D01] T0 WHERE T0.[U_SO] = '[%0]''
The only difference I can see is the square brackets [] in my query?
Regards,
Niall -
PLD report from user defined query
Hello experts,
Is possible to create a new PLD report from a user defined query ?
Thanks in advance.
Best regards
AndreaHi,
It is possible on Query Print Layout Design(QPLD) so Try to create QPLD.
Check this link u can get presentation slide form SAP.
[Query Pld from SAP site]
First you can try to create the Query report with UDF filed.
for example,
SELECT T0.DocNum, T0.DocDate, T0.CardName, T0.CheckSum, T0.U_UDF1, T0.U_UDF2, T0.U_UDF3
FROM OVPM T0 WHERE T0.DocNum>='%0' and T0.DocNum<='%1' ORDER BY T0.DocNum
Steps to Develop a User Report in QPLD:-
If you save your Query in Query Manager. Next you can do this,
->> Choose the Query Manager on Top Menu.
->> Open the Qeury Manager Window.
->> Select the specific Query report. and
->> Click the Create Report button in Bottom on Qeury Manager Window.
->> then, Open the Create User Report Window and Select the User Report(System) in Base Template.
If you Change the QPLD name.
->> Click OK.
->> (or) If your Query Report have parameter. Click OK.
Now your Query report was Created QPLD.
Note: All SELECT statement fields will be Stored and Display in Repetetive Area1. and
Parameter Fields are in Repetetive Area0 so you can Try to Copy & Paste the Field_ID's to Repetetive Area Header (or) Repetetive Area Footer.
Example:
->> Open the QPLD and Goto Field index Window, then
->> Select the Repetetive Area Header & Repetetive Area Footer ncrease the Height on Properties Window.
->> Create the Formula fields in Repetetive Area Header & Repetetive Area Footer.
->> Which Field you want to print in header or footer. Drag the Field ID(in Repetetive Area) Copy & Paste to Formula Field.
Can you see to your Query PLD? do this,
->> Choose the Tools on Top Menu.
->> Click the Queries. -> Query Print Layout...
->> Open the Query Print Layout Window.
->> Click Reports Tab and Double the Template (Requrie QPLD) on QPLD Window.
->> Customize and Save the QPLD.
Can you see your Query PLD Preveiw and Print? do this,
->> Choose the Tools on Top Menu.
->> Click the Queries. -> Query Print Layout...
->> Open the Query Print Layout Window.
->> Select Template in Report Tab on QPLD Window.
->> Click Print Preview on Top menu.
Close this thread if issue solved
Regards,
Madhan. -
How to assign a query retrived value to a user defined object in a table
how to assign a query retrived value to a user defined object in a table
Rajeshwar,
If you use the "Search" feature in this forum, you should be able to find helpful links to similar questions. You could also look at the RecordSet and DoQuery documentation in the SAP Business One SDK Help Center documentation to assist you with your question.
HTH,
Eddy -
How to make user-define value's query
Dear All,
In we have 3 user-defined fields in marketing document. When I type in field 1 and field 2, we need line total = field 1 * field 2.
Would it be possible for me to config it in SAP? I setup a user-define value and have a query for it. Make it updated when field 2 changed. But when I am not clear on how to write the query. I have a query select $[POR1.U_Field1]*$[POR1.U_Field2]
But I got an error message. It has to be some syn error in my query.
It is a service type document so that I cannot have a where POR1.Itemcode = ...
Can anybody help me out? Thanks in advance.
Regards,
Yuka
Edited by: Jie Jin on Mar 23, 2010 7:28 PMI use Select $(Por1.Price.number)*$(Por1.U_Numberofunit.number) //replace ( to [
The price was been change to null. Then my query is like select *6. Thanks.
Edited by: Jie Jin on Mar 23, 2010 7:42 PM
Edited by: Jie Jin on Mar 23, 2010 7:44 PM -
How can I access user defined column(in query) inside the trigger?
Hi
I have 3 unions and each query displays different records on some criteria. I also have a column hard-coded
Ex:
select a.col1, a.col2,
add as update
from table1 a
where ...
union
select a.col1, a.col2,
change as update
from table1 a
where ...
union
select a.col1, a.col2,
del as update
from table1 a
where ...
And I need to display a column in the report only if update is Add. I was thinking of writing a format trigger for that field. But I do not know how can I access this user defined column named update in the trigger?
Any help?Try ":update" minus the double-quotes. Ex:
IF :update = 'add' THEN
RETURN(TRUE);
ELSE
RETURN FALSE;
END IF;
You'll want to place your hard-coded values in single-quotes. Ex:
select a.col1, a.col2,
'add' as update
- Brian -
Using SQL query on user defined table
Hi all,
i'am currently working on a project which use user defined table and i would like to know if sap allow us to do insertion/deletion/update on those table using sql query or if we have to use the DI only?
thanks
Best regards,Hi,
Definitely you can insert in UDT. You can update but you cant change the Code field after added the rest of the field
can be updated. You cant delete in UDT but you cant delete anytime in SQL Management Studio.
THanks.
CLint
Maybe you are looking for
-
I can receive but cannot send IMAP email on my 1&1 mail account from Mac OS 10.10.1 Yosemite Mail on my new Macbook Pro. The account is set up the same port, password, username, server name as on my old Macbook and emails are sending just fine on the
-
How to do a load testing in Sharepoint 2010 site
Hi, I have never done a performance or load testing on SharePoint 2010 site. I have a site which has only one custom code written for consolidating documents. I want to check the performance of the site. How do I go about this ? I want to know how ma
-
For years I have relied upon Appleworks for my simple database issues but have not hit a snag. The nature of the data I am now storing requires large numbers of characters to be stored in a single field. Appleworks has a character limit of approx 500
-
Mb881 how big of a hard drive will work? Will a 1tb hard drive work?
Im looking at getting a MB881 but the 120gb is way to small so I would upgrade I'm thinking a 1tb. Will it properly read the 1tb hard drive? What is the max haEd drive size that can go in a MB881 Macbook?
-
Should I slice text or not?
If I put a slice on my text does it hide it in a div tag in the html code? I'd like it visible so that my page is deemed "relevant" to the search engines when it views my content. Thanks- Stacy