Procedure handle in Query manager
Sir,
I want to execute the user stored procedure in query manager with the following statement
" exec [Pr_AgingReport_NewN] '04/01/2009' , '03/27/2010','XYZ', null,'C',null "
i am getting SAP Message & error as follow
" 1).[Microsoft][SQL Native Client] Invalid cursor state "
Thanks
Rajesh B K
Hi Rajesh,
Try this,
Select dbo.storedProcedure (parameters, if applicable)
For example
Select dbo.NumToWords (2152.00)
Regards,
Bala
Similar Messages
-
Pass parameter to sql statement in query manager
Hai to all,
I want to pass the percentage as the parameter into the sql statemnet.i what to execute it in the query manager.
If i execute that statement then cann't found the tablename error is coming.
Other than the data in the table (general data) pass to the parameter in the sql at runtime.
for example:
select [%0] *100
how to pass 10 to that sql statement.
Please help me...
Regards,
Raji.Hi Ramya,
You can create a SP with parameters to accept and then execut this SP from SAP Business One Query Manager by passing the parameter (in your case 10). The result will be as desired.
Ex:
Create this Procedure in SQL Management Studio
create proc Test(@a as int)
as
begin
select (@a*100)
end
To Execute the Query use this Query and pass the desired values with parameters
execute Test 10
Regards,
Reno -
While Executing the Sp in Query manager Getting Error.
hi.
i need a small information.
I Created a small table in Sql
ccode
varchar
no
250
cname
varchar
no
250
ctype
varchar
no
250
My Stored Procedure at Sql
i am inserting values in to the temporary table by using below one after passing the parameter
i am executing the parameter is
EXEC 'cardcode' ,'cardname' ,'c'
if i execute the stored procedure in sql values are inserting same thing i want to do in sap b1 at query maanger
USE [WCTBRPLDB21-05-2014]
GO
/****** Object: StoredProcedure [dbo].[uspGetAddress1] Script Date: 8/1/2014 4:07:20 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER Procedure [dbo].[uspGetAddress1]
@Cuscode varchar(250),
@customertName VARCHAR(250) ,
@custype varchar(250)
As
Begin
DECLARE @Cur_Product CURSOR
set @Cur_Product= cursor for select CardCode,CardName,CardType from ocrd where CardCode =@Cuscode and CardName= @customertName and cardtype =@custype
open @Cur_Product
fetch next
from @Cur_Product into @Cuscode,@customertName,@custype
while @@FETCH_STATUS = 0
begin
insert into custupdate (ccode,cname,ctype) values (@Cuscode,@customertName,@custype)
fetch next
from @Cur_Product into @Cuscode,@customertName,@custype
end
close @Cur_Product
deallocate @Cur_Product
select * from custupdate
End
@Cuscode varchar(250),
@customertName VARCHAR(250) ,
@custype varchar(250),
select @Cuscode = T0.CARDCODE from OCRD T0 where T0.CARDCODE = '[%01]' AND
select @CARDNAME = T0.CARDNAME from OCRD T0 where T0.CARDNAME = '[%02]' AND
select @CARDTYPE = T0.CARDTYPE from OCRD T0 where T0.CARDTYPE = '[%03]'
uspGetAddress1 @Cuscode ,@CARDNAME ,@CARDTYPE
The above one i pasted at query manager.
if i run it it is asking the parameters
but after execute it
i am getting the error that must declare the Scalar variable like that it is showing.
but i am all ready giving the scalar variable but it is not running.
Any information plz update me
is there any declaration problem in query manager.....................Try below in query generator:
Declare @Cuscode varchar(250),
Declare @customertName VARCHAR(250) ,
Declare @custype varchar(250)
/*SELECT FROM [dbo].[OCRD] T0*/
/* WHERE */
SET @Cuscode = /* T0.CardCode */ '[%0]'
/*SELECT FROM [dbo].[OCRD] T0*/
/* WHERE */
SET @customertName = /* T0.CardName */ '[%1]'
/*SELECT FROM [dbo].[OCRD] T0*/
/* WHERE */
SET @custype = /* T0.CardType */ '[%2]'
EXEC uspGetAddress1 @Cuscode,@customertName,@custype
**Don't remove comments
Thanks
Navneet -
Query Manager Condition Problem
Dear expert,
In B1 query manager, i found a report called 'Production Order Report' and there is a searching condition which i don't understand.
Code:
T3.CardName= '[%9]' or '[%9]' = ''
If user dose not input this parameter, how the query manager handle the query??Hi Kit,
The query code you mentioned basically says that if the [%9] variable is blank, don't filter on it, else filter on it. You can test it with this query
declare @Code varchar(15)
set @Code= ''
--set @Code = 'C1000'
select * from ocrd where (Cardcode= @Code or @Code = '')
If you run it as is, all records in OCRD will be returned, if you run it with the commented line uncommented it will return only C1000.
Hope it helps,
Adele
<i>PS: I have seen that every post you make you set as answered/solved problem already. Please make sure which problems are solved and which not. People tend to not look at solved posts that often. Every question you asked have been marked as solved before anyone replied. Were they solved?</i> -
Add parameters in store proc + query manager
hello, i have a store procedure with 2 date parameter(begin and end), from addon tables. I want to execute from query manager, but, i have errors. I tried with :
/* SELECT FROM dbo.beas_arbzeit T0 */
DECLARE @FechaInicio AS datetime -- also date
DECLARE @FechaFinal AS datetime -- also date
/* WHERE */
SET @FechaInicio = /* T0.anfZeit */ '[%0]'
SET @FechaFinal = /* T0.anfZeit */ '[%1]'
exec dbo.MyProcedureTest @FechaInicio, @FechaFinal
-- FAILED. Error message: 'Document' (RDOC)
Can you help me ? thanks.Hi,
How did you store initial and final time on same field?
SET @FechaInicio = /* T0.anfZeit */ '[%0]'
SET @FechaFinal = /* T0.anfZeit */ '[%1] -
Running a SQL Stored Procedure from Power Query with Dynamic Parameters
Hi,
I want to execute a stored procedure from Power Query with dynamic parameters.
In normal process, query will look like below in Power Query. Here the value 'Dileep' is passed as a parameter value to SP.
Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData 'Dileep'"]
Now I want to pass the value dynamically taking from excel sheet. I can get the required excel cell value in a variable but unable to pass it to query.
Name_Parameter = Excel.CurrentWorkbook(){[Name="Table3"]}[Content],
Name_Value = Name_Parameter{0}[Value],
I have tried like below but it is not working.
Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData Name_Value"]
Can anyone please help me with this issue.
Thanks
DileepHi,
I got it. Below is the correct syntax.
Source = Sql.Database("ABC-PC", "SAMPLEDB", [Query="EXEC DBO.spGetData '" & Name_Value & "'"]
Thanks
Dileep -
How to add drop down list for query manager report in sap business one
Hi Every one,
I need drop down list for parameter selection in sap business one Query Manager.I have two Parameters 'Sales Order','Invoice'.
Please suggest.
Thanks and Regards
DEVHi,
you need to use this :
/*select from [dbo].[OINV] T2*/
DECLARE @Invoice varchar(100)
/*where*/
set @Invoice =/* T2.DocNum */N'[%2]'
you can change the tables and the parameter number but you have to write it exactly that way.
when you run the query within the SBO you will get list of objects ( in this case list of invoices)
hope it was helpful
Shachar -
Unable to create new query using query manager
Hi friends,
I have been trying to create a query using query manager for couple of hours but still not able to.I am following the instructions given in oracle Peopletools 8.52 : Peoplesoft query
Chapter - creating new queries.
Below are the steps I am going through to create new query:
Step - I open the component Reporting Tools-> Query->Query Manager , I don't get the tabbed pages one for search an existing query and another for create new query.
Please follow this link to see how the page is displayed in first step:
http://uploadpic.org/v.php?img=EvMvVAXX1E
Step 2 - When I click on create new query link, I am redirected to a page where it asks for record name to add in the query. But, even this page is not displayed as how it supposed to be
http://uploadpic.org/v.php?img=GzHh3f6krU
Step 3 - Following the above step, when I click on Person record to add into my query I am asked to select the fields that I want to display in the output.
But I somehow do not get the proper tabbed pages where individual pages are there to add the attributes to complete the query like adding multiple records, fields, query, expressions, prompt...etc
http://uploadpic.org/v.php?img=Wbbla3Q3jE
I am neither able to select multiple records in my query nor able to customize my query to get the desired results.
Below is the query that I want to create using query manager:
SELECT P.EMPLID,P.BIRTHDATE, N.NAME, A.ADDRESS1, A.ADDRESS2, A.CITY
FROM PS_PERSON P, PS_NAMES N, PS_ADDRESSES A
WHERE P.EMPLID = N.EMPLID AND
N.EMPLID = A.EMPLID AND
P.BIRTHDATE BETWEEN to_date('1990/1/1','yyyy/mm/dd') and to_date('1991/1/1','yyyy/mm/dd');Hi,
As I cannot access your screenshot by the blocking of company firewall rules.
I'm guessing currently you are using PT 8.52.00 version, correct?
This should be a bug, that you need to apply the 8.52.0X patch, not sure which patch fix this, you can apply the latest one to solve this issue for no tab page of query manager. (PT 8.52.06)
Hope this helps.
Thanks,
Saxon SI -
Here's an interesting problem a client is having. I have a simple query for them that retrieves some information from the primary B1 database, along with a UDT. The query works just fine inside SQL Server Management Studio. When we implement it into the query manager, before saving it, it worked just fine. We then saved it then tried running it again. One of the columns is not visibil. When click the edit button and try running it, it still doesn't work. But when we add or delete whitespace while in edit mode the query works just fine. I haven't been able to find anything on the notes yet and the customer is on 2007A PL 10 but they are planning on upgrading to 8.8+.
Any ideas on why the query manager is behaving this way? Is it a bug thats been fixed in a later patch for 2007A or is it something else entirely?You may add index to U_slsm column.
Update your query as:
Select T0.U_slsm as 'Slsm',
LEFT(T0.Code,9) as 'PC No',
T0.U_date,
T3.CardCode,
T1.DocNum as 'Shop',
T2.DocNum as 'Quote',
T0.U_amount,
T0.U_dm,
T0.U_comment
From [dbo].[@ORDERLOG T0]
Left Join dbo.ORDR T1 on T0.U_DocNum = T1.DocNum
Left Join dbo.OQUT T2 on T0.U_quote = T2.DocNum
Left Join dbo.OCRD T3 on T0.U_CardCode = T3.CardCode
Where T0.U_slsm = '[%0]'
Order By T0.U_date Desc, T0.U_amount
I have doubt regarding your links to those 3 system tables. Are those documents having internal links? -
How to call pl/sql stored procedure in JDBC query dialogbox
Hi,
how to call pl/sql stored procedure in JDBC query dialogbox(reports 9i) .
Cheers,
Raghuplease refer : Re: problem If you have more doubts, please ask in that question.
-
Easy query is not showing on Easy query Management(Browser)
Dear all,
I want to consume a bex query into SAP UI5. For that I found this document:-
http://cms.int13h.nl/wordpress/wp-content/uploads/2013/01/How-to-Create-OData-Services-for-Analytic-Queries.pdf
In this document, the first step is to define a query as EasyQuery. So I checked the option "By Easy Query" under Release for External Access.
After this I checked in Easy Query Management using EQMANAGER tcode, but there was no entry found for this query. It was blank.
Please help me in this issue.HI Antony Jerald J,
Do you have variables in your Bex Query.
Please check the pre requisites in the following link:
http://help.sap.com/saphelp_nw73ehp1/helpdata/en/b6/53d6c4e26a4504b8971c6e690d2105/frameset.htm
BR
Prabhith -
Not able to save / update SQL Query in Query manager
Hi,
I am using SBO 2005 B PL 25, facing unique problem in Query Manager.
There are various queries saved in Query manager, tried updating & creating / saving new query but not able to do so.
System displays messaged as operation completed successfully, but the query is not updated.
Kindly let me know is there any setting which blocks the updation.
Regards,
Yogesh Jadav
Edited by: YOGESH JADAV on Aug 11, 2008 3:07 PMHi
You cannot Modify or Update query in the 'System' Category.
If you are trying to create/ modify/ update query in some other category, check for the authorizations in
'Administration -> System Initialization -> Authorizations Window' -> Reports ->Query Generator'.
Check if you have authorizations for the following
New Queries
Create/Edit Categories
Saved Queries - Group No. 1
Saved Queries - Group No. 20 -
Hey All
How I can run query from Query Manager from addon level?
regards
Krzysztof SalaHi Krzysztof,
There is no object in the SDK to access and execute the queries programmatically so you have to use the UI to simulate the user opening and selecting the query (ie activate the menu object for the query you want to run, populate any parameters then click on the OK button to execute the query). It's a bit of a messy solution but it can work ok.
The alternative is to execute your query from within your add-on and display the results in a new form. This form can just have a matrix and an OK button so it's very easy to create (via Screenpainter or at runtime).
Hope this helps,
Owen -
Hi,
I want to restrict areas in the query manager to certain users. How can I do this please?
Thanks,
vankriYou may check these threads for further info:
Re: query manager
Query Group in Query Category different with Authorization's group number
Thanks,
Gordon -
How to set paramters through Query manager.
Hi,
I need to get Parameters when we are executing SQL Query through Query Manager.
In Query manager how to set prompt window for parameters.
Below I applied parameters for from date and to date but its showing error. How to set parameters prompt window.
SELECT OJDT.TransId, OJDT.Number,NNM1.SeriesName,ojdt.baseref as BaseRefNumber, JDT1.Account,JDT1.StornoAcc,OACT.AcctName,jdt1.credit,jdt1.debit, jdt1.profitcode as [Customer/Vendor],JDT1.OcrCode2 as [Region/Location] , JDT1.OcrCode3 as Department,
JDT1.OcrCode4 as [Core/Deputees/DailyWage/General], JDT1.OcrCode5 as [SubAccofCA&CL],OJDT.RefDate, OJDT.Project,jdt1.project
FROM OJDT
INNER JOIN JDT1 ON OJDT.TransId = JDT1.TransId
INNER JOIN OACT on OACT.AcctCode=JDT1.Account
INNER JOIN NNM1 ON OJDT.Series = NNM1.Series
where ojdt.transType=30 and ojdt.refdate >= '[%0]' AND ojdt.refdate <= '[%1]'
Please guide me.
Regds,
Sampath kumar devunuri.hi sampath,
Try this query
SELECT T0.TransId, T0.Number,T3.SeriesName,T0.baseref as BaseRefNumber, T1.Account,T1.StornoAcc,T2.AcctName,T1.credit,T1.debit, T1.profitcode as CustomerVendor,T1.OcrCode2 as RegionLocation , T1.OcrCode3 as Department,
T1.OcrCode4 as CoreDeputeesDailyWageGeneral, T1.OcrCode5 as SubAccofCACL,T0.RefDate, T0.Project,T1.project
FROM dbo.OJDT T0
INNER JOIN JDT1 T1 ON T0.TransId = T1.TransId
INNER JOIN OACT T2 on T2.AcctCode=T1.Account
INNER JOIN NNM1 T3 ON T0.Series = T3.Series
where
T0.transType='30' and CAST(T0.refdate AS datetime) BETWEEN '[%0]' AND '[%1]'
Jeyakanthan
Maybe you are looking for
-
Cannot deploy EAR. There are already active sessions
Hi WebDyn Pro's, I'm running NW SP14 Sporadically, I cannot deploy my WebDynpro app to the NW server. In NWDS, I indicate to Deploy and run. I get an error in the console indicating: <b>"Cannot log in. There are already active sessions. Session i
-
HP in Real Life - Tell us your story.
Hi everyone, In support of the HP in Real Life program, I thought we would support it by not only talking about it, but also starting some stories here about how we use our HP products to make our life, and the lives of those around us, better. Tell
-
Admin Commands issue on Windows Web Server 2008 R2 - 64Bit
Hi, I have tried exactly same process on FMS3.5 Installed on Centos and it worked perfectly. But not working in case of Windows Web Server 2008 R2 - 64Bit. Here is what i am trying to do - Basically i want to extract live streams list and display the
-
How to STOP and START the BO EXPLORER/POLESTAR - LINUX
Dear friends, Could you please let me know on How to STOP and START the BO EXPLORER/POLESTAR on LINUX platform? Thank you, Nikee
-
Re: Select statement fails under Express, but works underForte when usi
Hi there, I have logged this with Forte and it as been recognized as a bug ( #46554 ). The Express methods you need to look at if you want to modify this behavior are : 1 - BusinessQuery.BuildQuery() starting at line 217 2 - SqlQuery.GetWhereText() s