How to execute created function in query wizard or query generator

Hi to all
i create a function in sql and i want to use this in a query wizard or query generator, I tried to include this function in my query to create a report . but i im receiving a error saying 'invalid build function',
running the query with the created function in sql server produce the expected result..
I would like to know if is possible to used this created function in the query wizard or function?
thanks
Loren

Hi Owen
Thank you for your reply
The function falls on scalar valued function , Here is my code
  start of code -
USE [gk]
GO
/****** Object:  UserDefinedFunction [dbo].[SalesForThisDate]    Script Date: 01/19/2009 12:42:24 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER  FUNCTION [dbo].[SalesForThisDate]
(     @vItemCode nvarchar(20),
    @FrmDate DateTime,
     @ToDate  DateTime
Returns Real
AS
BEGIN
  RETURN (SELECT ISNULL(SUM(T1.[Quantity]),0)
     FROM OINV T0  INNER JOIN INV1 T1 ON T0.DocEntry = T1.DocEntry
     WHERE T0.[DocDate] Between @FrmDate and @ToDate
          and t1.[ItemCode]=@vItemCode
     GROUP BY  T1.[ItemCode])
END
  end of code -
then i tried to run this function on the query manager with this statement
SELECT T1.[ItemCode],
     ISNULL(dbo.SalesForThisDate(T1.[ItemCode],'2008-10-1','2008-10-8'),0) Value1,
     ISNULL(dbo.SalesForThisDate(T1.[ItemCode],'2008-11-1','2008-11-8'),0) Value2,
     ISNULL(dbo.SalesForThisDate(T1.[ItemCode],'2008-12-1','2008-12-8'),0) Value3,
     ISNULL(dbo.SalesForThisDate(T1.[ItemCode],'2009-1-1','2009-1-8'),0) Value4
FROM OITM T1
ORDER BY T1.[ItemCode]
executing this statements pop a error
"SalesForThisDate is not recognized build-in function name"
Thanks
Loren

Similar Messages

  • How can I Create function with an  out Parameter

    how all
    how can I Create function with an out Parameter
    I try to create it it sucess but how can I CALL it , it give me error
    please I want A simple example
    thanks

    3rd post on same question by same user :
    Re: how can I Create function with an  out Parameter
    how can I Create function with an  out Parameter

  • How to call store procedure in query generator

    Hi All,
    How to call store procedure in query generator.
    Regards
    Rajkumar Gupta
    Edited by: Rajkumar Gupta on Dec 7, 2010 2:11 AM

    Hi,
    Please check the following threads.
    How to use Stored Procedure in sap business one
    How to add parameters to a stored procedure in B1 Query generator
    How to execute the procedure in sap b1
    Hope it helps,
    Vasu Natari.

  • How to execute a function with date parameter as an input?

    HI
    I have a function named fun1(v_fun in date), with date as an input parameter and it returns a number. I have created the function successfully. But i couldnt execute this function in sqlplus. How to pass the dates? Can any one help me in this regard.

    Hi,
    V11081985 wrote:
    HI
    I have a function named fun1(v_fun in date), with date as an input parameter and it returns a number. I have created the function successfully. But i couldnt execute this function in sqlplus. It's hard for me to say what you're doing wrong when I don't know what you're doing. Post a complete test script that people can run to re-create the problem and test their ideas. Include a function definition, CREATE TABLE and INSERT statements for any of your own tables (if necessary), and the results you want to get from that data, as well as your query.
    How to pass the dates? Can any one help me in this regard.You can call the function like this:
    SELECT  fun1 (hiredate)  AS fun1_results
    FROM    scott.emp
    ;

  • How to execute a function and return the result into a bind variable

    Hi,
    I am trying to calculate the sum of salaries of all persons with a particular JOB_ID using a function TOTAL_INCOME(v_job_id).
    create or replace function total_income
    +(v_job_id IN varchar2)+
    RETURN number IS
    v_total number(6);
    cursor get_sal is
    select salary from employees
    where job_id = v_job_id;
    BEGIN
    v_total := 0;
    for emp in get_sal
    loop
    v_total := v_total emp.salary;+
    end loop;
    dbms_output.put_line('Total salary of '||v_job_id||' is: '|| v_total);
    return v_total;
    END;
    Now I woud like to execute this function and assign the returned value into a bind variable test_sal
    variable test_sal number(6)
    SELECT total_income('AD_VP') into :test_sal FROM DUAL;
    dbms_output.put_line('Total Sal:'||:test_sal);
    This is returning the below errors:
    SELECT total_income('AD_VP') into :test_sal FROM DUAL
    *+
    Error at line 0
    ORA-01036: illegal variable name/number
    dbms_output.put_line('Total Sal:'||:test_sal);
    Error at line 3
    ORA-00900: invalid SQL statement
    Could someone help me what could be the problem?? Thanks for your time...

    Dear,
    If everything you will do will be done inside PL/SQL (stored procedure or stored function) then you don't have to care about bind variable.
    When using PL/SQL (static SQL) you will never encounter issues related to bind variables. PL/SQL itself takes care of your code and uses bind variables behind the scene.
    The only situation where you have to look carefully to the use of bind variables within PL/SQL is when you use Dynamic sql into stored procedures or functions.
    So, see in the light of the above comment, if you have to care about returning your function into a bind variable?
    Best regards
    Mohamed Houri

  • How to execute a function returning type in oracle

    hi
    i want to execute a function which is returning table from oracle prompt.
    i have created type in order to return table from function.
    /*creating type
    CREATE OR REPLACE TYPE U_VOC.t_in_list_tab AS OBJECT (i_group NUMBER ,
                                  i_company number,
                                  i_estab number
    NOT FINAL ;
    CREATE OR REPLACE TYPE U_VOC.t_in_list_tab_type
    AS TABLE OF U_VOC.t_in_list_tab;
    /*function */
    CREATE OR REPLACE FUNCTION FU_VOC_S_VEHICLES(pi_group number,
                                                      pi_company number,
                                                 pi_estab number
         RETURN t_in_list_tab
    AS
    v_nb_idvehicle           U_REF.V_REF_VEHICLES.NB_IDVEHICLE%type ;
    v_vc_reference           U_REF.V_REF_VEHICLES.VC_REFERENCE%type ;
    v_vc_licenceplate      U_REF.V_REF_VEHICLES.VC_LICENCEPLATE%type ;
    l_tab t_in_list_tab := t_in_list_tab( pi_group ,pi_company, pi_estab );
    BEGIN
              SELECT      V_REF_VEHICLES.NB_IDVEHICLE,
                   V_REF_VEHICLES.VC_REFERENCE,
                   V_REF_VEHICLES.VC_LICENCEPLATE
              INTO      V_NB_IDVEHICLE,
                   V_VC_REFERENCE,
                   V_VC_LICENCEPLATE
              FROM      U_REF.V_REF_VEHICLES
              WHERE      V_REF_VEHICLES.NB_IDGROUP = pi_group
              AND      V_REF_VEHICLES.NB_IDCOMPANY = pi_company
              AND      V_REF_VEHICLES.NB_ESTABL = pi_estab;
    RETURN l_tab;
    END;
    please help
    Thank in advance
    Sandy

    Sandy,
    I have a series of examples on this issue in my demo application. See this one:
    http://htmldb.oracle.com/pls/otn/f?p=31517:146
    You will basicaly need to write it like this:
    CREATE OR REPLACE TYPE u_voc.t_in_list_tab AS OBJECT (
       i_group     NUMBER,
       i_company   NUMBER,
       i_estab     NUMBER
    CREATE OR REPLACE TYPE u_voc.t_in_list_tab_type AS TABLE OF u_voc.t_in_list_tab;
    CREATE OR REPLACE FUNCTION fu_voc_s_vehicles (
       pi_group     NUMBER,
       pi_company   NUMBER,
       pi_estab     NUMBER
       RETURN t_in_list_tab PIPELINED
    AS
       l_tab   t_in_list_tab := t_in_list_tab (NULL, NULL, NULL);
    BEGIN
       FOR c IN (SELECT v_ref_vehicles.nb_idvehicle, v_ref_vehicles.vc_reference,
                        v_ref_vehicles.vc_licenceplate
                   FROM u_ref.v_ref_vehicles
                  WHERE v_ref_vehicles.nb_idgroup = pi_group
                    AND v_ref_vehicles.nb_idcompany = pi_company
                    AND v_ref_vehicles.nb_establ = pi_estab)
       LOOP
          l_tab.i_group := c.nb_idvehicle;
          l_tab.i_company_number := c.vc_reference;
          l_tab.estab_number := vc_licenceplate;
       END LOOP;
       RETURN l_tab;
    END;
    SELECT *
      FROM TABLE (fu_voc_s_vehicles (value1, value2, value3))But looking at your code, your function will return only one record.
    Denes Kubicek
    http://deneskubicek.blogspot.com/
    http://www.opal-consulting.de/apex/f?p=107:7
    http://htmldb.oracle.com/pls/otn/f?p=31517:1
    -------------------------------------------------------------------

  • How to execute a function module?

    I am new to SAP and I need to execute a function module, per OSS Note 894279.
    It says I need to run a function module with a certian parameter.  Well I see how I can modify function modules in SE37 or SE80, but how do I run/execute them?
    I am sure this is something simple that I am not aware of.  Thanks.

    Hi,
    Go to SE37--> Give the FM name --> press F8 --> Give the values for Import parameters --> Press F8 or exection button on application tool bar.
    Thanks,
    Sri.

  • How PO is created  (  functionally )

    Hi,
       i want to understand how PO is created  & how po related to material ,vendor,what is GR & IR all functionally.is their is any cycle which we are suppose to follow.

    hi, Sachin this in very brief the functionality part .
    Purchasing is a component of Materials Management (MM). The Materials Management (MM) module is fully integrated with the other modules of the SAP System. It supports all the phases of materials management: materials planning and control, purchasing, goods receiving, inventory management, and invoice verification.
    The tasks of the MM Purchasing component are as follows:
    External procurement of materials and services
    Determination of possible sources of supply for a requirement identified by the materials planning and control system or arising directly within a user department
    Monitoring of deliveries from and payments to vendors
    External procurement in the MM System centers around a general cycle of activities.
    <b>Process Flow</b>
    The typical procurement cycle for a service or material consists of the following phases:
    <b>Determination of Requirements</b>
    Materials requirements are identified either in the user departments or via materials planning and control. (This can cover both MRP proper and the demand-based approach to inventory control. The regular checking of stock levels of materials defined by master records, use of the order-point method, and forecasting on the basis of past usage are important aspects of the latter.) You can enter purchase requisitions yourself, or they can be generated automatically by the materials planning and control system.
    <b>Source Determination</b>
    The Purchasing component helps you identify potential sources of supply based on past orders and existing longer-term purchase agreements. This speeds the process of creating requests for quotation (RFQs), which can be sent to vendors electronically via SAP EDI, if desired.
    <b>Vendor Selection and Comparison of Quotations</b>
    The system is capable of simulating pricing scenarios, allowing you to compare a number of different quotations. Rejection letters can be sent automatically.
    <b>Purchase Order Processing</b>
    The Purchasing system adopts information from the requisition and the quotation to help you create a purchase order. As with purchase requisitions, you can generate Pos yourself or have the system generate them automatically. Vendor scheduling agreements and contracts (in the SAP System, types of longer-term purchase agreement) are also supported.
    <b>Purchase Order Follow-Up</b>
    The system checks the reminder periods you have specified and - if necessary - automatically prints reminders or expediters at the predefined intervals. It also provides you with an up-to-date status of all purchase requisitions, quotations, and purchase orders.
    <b>Goods Receiving and Inventory Management</b>
    Goods Receiving personnel can confirm the receipt of goods simply by entering the Po number. By specifying permissible tolerances, buyers can limit over- and underdeliveries of ordered goods.
    <b>Invoice Verification</b>The system supports the checking and matching of invoices. The accounts payable clerk is notified of quantity and price variances because the system has access to PO and goods receipt data. This speeds the process of auditing and clearing invoices for payment.
    If you have any further queries please do write .
    cheers
    kp

  • How to execute create PDF  menu item

    hi all,
    I need to bind two pdf files.
    I did that by using File->Create PDF->From Multiple Files option.
    I want to automate this work using javascript.
    How can i do this?
    How can i execute the menu item Create PDF?
    Thanks in advance and urgent please....

    For the Acrobat SDK, no, it is not possible because there is no API to allow developers to do so via AppleScript. Now on to the world of "unsupported".
    It "might" and I do stress the word *MIGHT* be possible via AppleScript System Events, but this is in all worlds is a VERY BAD way to do things. It requires that no other applications running in the foreground and if your application loses focus for another applications dialog box (i.e. Adobe Updater, Mac OS X Software Update, etc...) you are, what some might say "hosed" because then your AppleScript no longer can execute properly. Surely NOT something to be used in a production environment.
    Sabian

  • How to execute the functionality of button at a time of pressing if function is in continuous loop?

    Hello,
    I am facing one basic problem that how can I execute the button which I have used in my vi at a time of pressing means in my vi I have used 4 button 1. Start 2. OK 3. Save and 4. Stop button
    when user press start button then continuous loop will be executed and after pressing OK it will stop that loop and waiting for next instruction from user whether he want to do reading operation again or he want to save or he want to stop.
    The thing is when I press start button then while loop is execute then its not possible to press stop button or save button, user need to wait until OK button is pressed.
    Will you please guide me how can I do so that when ever user press any button that button is executed at time.
    Thank you very much once again.
    Attachments:
    voltageforcecapacitance without instrument.vi ‏40 KB

    Hi Ankit,
    There are some issue in your code mention below please have a look and correct these will work fine for your requirement.
    1. Save button Boolean value pass to the lower wheel conditional loop means if you press save your bottom loop will stop working this is not the code requirement you have to continue loop and tigger start event in last using value tigger event property to tigger again start event.
           This step will reset your loop and start from zero.
    2. According to me I think both loop should stop only in stop condition so you can remove stop function from upper loop and pass the button value in both loop directly to wheel loop condition terminal.
           Upper loop direct and lower both loop local variable.
    3. Why you want to stop your upper loop on any error condition, you should Handel the errors and keep running the code.
    4. What is the use of queue no case related with dequeue in bottom loop.
    5. Wheel loop in a event is not  good practice so you can use your queue structure here to run continuous lower code.
    I hope these changes can improve your code.
    Thanks and Regards
    Himanshu Goyal | LabVIEW Engineer- Power System Automation
    Values that steer us ahead: Passion | Innovation | Ambition | Diligence | Teamwork
    It Only gets BETTER!!!

  • How to execute javascript function then Code Behind in an ASP Button

    Hi Guys,
    I am currently working in a web application. I have a problem with calling a js function and codebehind.
    I have this asp button that when clicked, a javascript function should be called.
    My javascript function is like this:
    function Calculate(){
    // Set Route in google map
    // Store distance, lat/long in an array
    Then, after the Calculate function was executed, it should execute the code behind:
    protected void btn_calculate_onclick(object sender, EventArgs e)
    // Pull data stored in the array created by javascript
    // connect to db
    // store data
    But the javascript function doesn't execute.
    What should i do?
    Thanks in advance

    Hello,
       javascript function can not executed in server side, you can tranlate javascription fuction to c# function.
     if the reply help you mark it as your answer.
     Free
    Managed .NET
    Word Component(Create,
    Modify, Convert & Print)

  • How to execute NIDAQ functions

    From LabVIEW, how do I tell if my SCXI chassis is powered / turned on?
    The knowledge base of NI site speaks about a NI-DAQ function called
    SCXI_ModuleID_Read, but there seems not to be any VI calling this
    function.
    How can I execute it?
    Thanks,

    See:
    http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3DD1356A4E034080020E74861&p_node=DZ52434&p_source=external
    2006 Ultimate LabVIEW G-eek.

  • How to execute callback functions progamatically

    Title says it all.
    I want to execute a callback for a Command Button programatically. How is this possible?
    Solved!
    Go to Solution.

    Wolfgang answer is the most direct and indeed it works. Nevertheless, there can be different approaches that has been discussed severl times in this board. I can point you to this discussion and this one that offers alternatives to direct calling of the function.
    Additionally, as a minor correction to Wolfgang's words, please note both in direct callback calling and if using CallCtrlCallback () you must pass the panel handle to the function, not the panel ID.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • How to execute a report in Query Designer

    Hi Expert,
    I found that I can execute some report by IE in query design, but some are not support, When I clicked "Execute" Button,  no response and no error message. is there any special setting need to be done?
    Thank you in advance

    No special setting needs to be done for this as it is working for some queries...could be a network issue, or something with the portal.

  • How can I create an sql query updateable report

    Seems as though after upgrading our APEX version I no longer have the option to create an updateable report. Some of my old updateable reports seem to be working fine but some will not update after I click my submit button. AT first they just refreshed the page and ignored my changes to the data in the text field. After tinkering with the non working region, now I get a ORA-20001 current version of data in database has changed etc.
    HELP!

    Hi,
    OK - first, you can still create an Updatable Report. When you create a new report, select the Wizard Report option and follow the prompts. When the report has been created you can then switch it to be updatable. I don't know why it has been done this way, but that works.
    Second, on the reports that return that error, do you have any columns set a Standard Report Column? I have found that you need to include ALL columns in the data being submitted, even if that means you have to create a second instance of a column in your SQL statement and then make one of the columns Hidden. For example, if you created a Tabular Form using the wizard on the EMP table, you get EMPNO and EMPNO_DISPLAY, with EMPNO hidden. You would need to do the same for any column not being edited by the user. Something similar may also happen if you have made any of the INPUT items readonly or disabled as these are not submitted by the browser.
    Andy

Maybe you are looking for

  • Ipod touch 4g black screen ,unresponsive

    i was jailbreaking(tethered) ios 5 (beta 3) and i mistakingly cancelled it. now my itouch(4g) is unresponsive. itunes does detect it when i press home and power button for 15 sec and says "itunes has detected an ipod in restore mode" "please restore

  • Pdf files websites does not open

    Hi, I can open most links with .pdf extension on any other browsers like Google Chrome and IE9 but not with Firefox 4. Actually I don't think I was able to open these type of files even with Firefox 3.6. When I click on a link with a .pdf it would ju

  • Can a Time machine backup be moved from one hard drive to another.

    Hello There are a few questions tucked away in here... 1 My Mac crashed due to a Kernal Panic (screen was flashing) this was happening over 2 weeks so I decided to restore from Time Machine. During a restore the Mac crashed again. So I aborted the re

  • Olap like table in java swing

    I need to show olap data in java swing. Can anybody help me providing the source code. It show the olap data from sql server in java swing with following facility like 1) row span 2) column span 3) drill down 4) expand and colapse any row and column

  • Part 1: Instrument Not Found

    Hi At start up I get this message. In three songs actually. I don´t seem to miss any instruments in the songs. What is it? JanD