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,
Alfa

I  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 .....

Similar Messages

  • 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

  • Copy user defined table using copy express

    I have created some user defined tables.I want to take backup of these tables using copy express.I created xml file for all these tables.When I copied the tables to another company only two fields were copied Code and Name.Rest of the fields were ignored.

    Hi,
    Check this note:[940539|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E&note_numm=0000940539]
    Also [984935|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E&note_numm=0000984935],[1118767|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E&note_numm=0001118767],[1059284|https://websmp130.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/smb_searchnotes/display.htm?note_langu=E&note_numm=0001059284].
    And i kindly recommend you to upgrade CX Addon to its latest patch.
    Rgds
    Sundar

  • How to popup form according to query by  CFL for user defined tables?

    Hi Experts!
    Please write a simple code for adding CFL in UDO and popup the window according to query. suppose i want to execute query
    "select code,name from [@WITM]". I want to add CFL in edittext which is on UDO. how can we add CFL in that Edittext by code.
    Thanking You
    vishwajit kumar

    Hi Vishwajit,
    Please response to your previous posting or close it first. Whatever the answer working or not, you need reply.
    Thanks,
    Gordon

  • What the best way to create User defined table with ADDON purpose

    Hi folks, how are you ?
    I´m beginner in development to business one, and I m studying to develop ISV addons.
    But, during my exercises and analisys, I learned that have two ways to create tables and fields in business one. One way is throght by wizard in business one using Tools Menu > Configuration Tools > User Defined Tables >
    Obs: I ´m using Business One Patch Level 9.
    Other way, is create the tables and fields using DI API
    But, my question is. When I develop one addon, or one UDO form that uses one set of user defined tables or used defined fields that where created by the first way (by wizard in B1), how I deploy this in other business one installation ? The package process will ensure the creation of this tables in another enviroment or I must implement the creation of user defined tables using DI API so that this code is called during the installation?
    If in cases of addon develop I must use DI API to create user defined tables, How can I use my classes with this responsibility in package process ?
    Thanks my friends.

    Hi Renan,
    You just need to put your logic in to the startup of your application, after you've established your connection to the UI API and DI API. All this will be triggered in the constructor of your main class.
    namespace MyNamespace
    public class MyAddon
      bool runAddon = true;
      bool initialised = false;
      const string ADDON_NAME = "My Addon";
      public static void Main()
            MyAddon addOn = new MyAddon();
            if(runAddon)
                  System.Windows.Forms.Application.Run();
            else
             Application.Exit();
      public MyAddon()
            // Connect to SBO session for UI
            if(!SetApplication()) runAddon = false;
      private bool SetApplication()
            // Code goes in here to establish UI API and DI API connections
            // See SDK samples for examples
            // You should also define and filter the UI API events your addon will trap at this stage and create any menus
            // Call your routine to check if the required UDFs/UDTs exist on this company
            initialised = CheckInitialisation();
            if (!initialised)
               //  AddOn not yet intialised on this company so prompt the user to run the intialisation process
              int iResponse = app.MessageBox("The " + ADDON_NAME + " addon will now create all required fields and tables."
                                             + System.Environment.NewLine + System.Environment.NewLine
                                             + "WARNING: It is strongly recommended that all other users are logged out of this company "
                                             + "before running this process. Are you sure you wish to continue?", 2, "Yes", "No", "");
              if (iResponse == 1) initialised = InitialiseAddOn(); // Call your routine to create the objects
            return true;
    Kind Regards,
    Owen

  • Dealing with User Defined Tables with the DI Server

    I have a general question about the best way of working with the data in user defined tables using the DI Server. It appears from previous posts that it is not possible to use the standard methods such as UpdateObject. Also since update/insert and delete statements or explicitly forbidden using the ExecuteSQL method then how do we interact with the data in the tables?
    Do we need to code our own data access layer for this type of access and is this a good practice?
    Is this type of functionality going to be available in a future release of the DI Server?
    Thanks

    Using SQL for Update/Insert/Delete is not forbidden on UDTs (at least non-UDO UDTs; UDO UDTs are somehow in a gray area since they carry internal fields + e.g. inserts require further manipulation in B1 tables...)...
    I.e. using ExecuteSQL to add data into UDTs is OK for DI Server...
    HTH,
    Frank

  • Error while  adding records in user defined table

    Dear all,
                    I am adding a record in user defined table using   .add() method. the code is given below. while adding it raises the following error
    "-1[Microsoft]  [SQL Native Client] [SQL Server] Conversion failed when converting the nvarchar value '-3 @BG_MAILSETTINGS'  to data type int. (CINF).  "
    All the fields are varchar date type.  
                Dim oUDT As SAPbobsCOM.UserTable
                oUDT = oCompany.UserTables.Item("BG_MAILSETTINGS")
                With oForm.DataSources.UserDataSources           
                        oUDT.Code = "1"
                        oUDT.Name = "SMTPSERVER"
                        oUDT.UserFields.Fields.Item("U_SERVER").Value = .Item("EDTSMTPSVR").ValueEx
                        oUDT.UserFields.Fields.Item("U_EMAIL").Value = .Item("EDTFEMAIL").ValueEx
                        oUDT.UserFields.Fields.Item("U_PORT").Value = .Item("EDTSMTPPRT").ValueEx
                        oUDT.UserFields.Fields.Item("U_USERNAME").Value = .Item("EDTSMTPUSR").ValueEx
                        oUDT.UserFields.Fields.Item("U_PASSWORD").Value = .Item("EDTSMTPPWD").ValueEx
                        oUDT.UserFields.Fields.Item("U_AUTHENT").Value = .Item("CMBSMTPAUT").ValueEx
                        K = oUDT.Add
                        If K <> 0 Then
                            oCompany.GetLastError(iErrCode, sErrMsg)
                            MsgBox(CStr(iErrCode) & "-" & sErrMsg, vbCritical, "Error")
                            Exit Sub
                        End If
                 End with
    Could any one please say the solution for this.
    Many thanks,
    Manikandan.
    Edited by: Rui Pereira on Dec 23, 2008 3:49 PM

    Dear Manikandan P,
    Is there any change and check in stored procedure SBO_SP_TransactionNotification?
    Best Regards
    Jane Jing
    SAP Business One Forums team
    Edited by: Rui Pereira on Dec 23, 2008 3:56 PM

  • How to insert records in user defined tables through DI Server API

    Hi All,
    I have created a UDO using some userdefined tables .I am able to insert records in the user defined tables using DI API but problem is that now I want to insert records in those tables using DI Server API but I dont know how to do that please give me some way to do that
    Thanks and Regards
    Utpal

    The AddObject message is :
    <env:Envelope xmlns:env="http://www.w3.org/2003/05/soap-envelope">
      <env:Header>
        <SessionID>...</SessionID>
      </env:Header>
      <env:Body>
        <dis:AddObject xmlns:dis="http://www.sap.com/SBO/DIS">
          <BOM>
            <BO>
              <AdmInfo>
                <Object>...</Object>
              </AdmInfo>
            </BO>
          </BOM>
        </dis:AddObject>
      </env:Body>
    </env:Envelope>
    How to use it with a user defined table ?

  • Can we Customize Edit User-Defined Table Screen in Fusion Application

    Hi All,
    We have a requirement to add a ADFDI functionality to the 'Edit USer-Defined Table' screen by adding a 'Mass Upload' Button.
    Normally for Some of the screens (Fusion Compensation) i am seeing 'Personalize -> Edit Current Page' Option on Menu items on top. But on 'Edit User-Defined Table' i am not seeing this option in 'Personalize' Menu.
    So the questions is is this screen Customizable in Fusion Application? If So What will be EAR file which we need to use for Customization.
    The screen where we need to add ADFDI Functionality is under 'oracle/apps/setup' path.
    Can anyone point me to the Exact EAR on this and also let me know if we can customize it or not
    Thanks
    Kaja

    Generally the code structure can be observed run-time [url https://blogs.oracle.com/fadevrel/entry/finding_code_artifacts_for_customization]using the composer, however in your case the content comes through a portlet in which case the method does not work as you cannot drill down to the specific region details in the composer. Based on a search through the code I think the regions you are interested are:
    <li>hcmPayroll/userTables/ui/public_html/oracle/apps/hcm/userTables/ui/page/UserTableSearch.jsff --> This is the details page with header "Manage User-Defined Tables"
    <li>hcmPayroll/userTables/ui/public_html/oracle/apps/hcm/userTables/ui/page/ManageUserStructure.jsff --> This is the details page with header "User-Defined Table: <TABLE_NAME>"
    These would presumably be in EarHcmPayroll. I'll see if I can find out how the portlet content can be observed from the RT application..
    Jani Rautiainen
    Fusion Applications Developer Relations
    https://blogs.oracle.com/fadevrel/

  • Query SQL with variables Parameters and user defined tables

    Hi  everyone
    I got a problem about Query SQL
    [dbo].[@CSOURCE]  is a user defined table
    select * from [dbo].[@CSOURCE]
    you can get the result in following
    code    name
    T01      newspaper
    T02      TV
    T03      radio
    T04      friends
    when I execute the following SQL   Statements ,I get an error
    SELECT T0.CardCode , 0.CardName ,T1.Name ,T2.SONumber
    FROM OCRD T0    LEFT JOIN [dbo].[@CSOURCE]  T1 ON T0.U_CSOURCE = T1.Code
                                 LEFT JOIN (SELECT  T0.CardCode ,COUNT(T0.DocNum)SONumber
                                 FROM ODLN T0  INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
                                WHERE T1.GroupCode =111
                                AND   (T0.DocDate >=[%0] or [%0]='')
                                AND   (T0.DocDate <=[%1] or [%1]='')   
                                GROUP BY T0.CardCode) T2 ON T0.CardCode=T2.CardCode
    WHERE T0.GroupCode =111
    and  T0.CardType ='C
    Is there anyone can correct it for me
    thank you very much
    Edited by: Li Mishan on Jul 17, 2008 9:36 AM
    Edited by: Li Mishan on Jul 17, 2008 9:40 AM

    I am sorry .It is just a mistake of my typewriting.
    The following is the whole SQL
    dbo.@CSOURCE is a user table.It's content is
    code  name
    T01    newspaper
    T02    TV
    T03    radio
    T04    friends
    declare @m int
    declare @FromDate DateTime
    declare @ToDate DateTime
    set @m=(SELECT count(*)  FROM ORDR T0 WHERE T0.DocDate >=[%0] and  T0.DocDate <=[%1])
    set  @FromDate=[%0]
    set  @ToDate=[%1]
    /*****************If I do not connect user tavble dbo.@CSOURCE ,I will succed *****************************************************/
    SELECT T0.CardCode ,T0.CardName ,T2.SONumber,T1.Name
    FROM OCRD T0  LEFT JOIN [dbo].[@CSOURCE] T1 ON T0.U_CSOURCE = T1.Code
                               LEFT JOIN (
                                                SELECT T0.CardCode ,COUNT(T0.DocNum)SONumber                                            FROM ODLN T0 INNER JOIN OCRD T1 ON T0.CardCode = T1.CardCode
                                                WHERE T1.GroupCode =111
                                                AND (T0.DocDate >=@FromDate or @FromDate='')
                                                AND (T0.DocDate <=@ToDate  or  @ToDate ='')                                                                               
    GROUP BY T0.CardCode
                                            ) T2 ON T0.CardCode=T2.CardCode
    WHERE T0.GroupCode =111
    and T0.CardType ='C'
    when I excute the SQL, It return a error , whith says the column name '%0'  is invalid.
    If I delete "set @m=(SELECT count(*)  FROM ORDR T0 WHERE T0.DocDate >=[%0] and  T0.DocDate <=[%1])"
    and rewrite "set  @FromDate='2008.05.01' set  @ToDate='2008.07.01' "
    It Shows the following results
       CardCode     CardName     SONumber     name
    1      000070        Deng. Jiahua   1                newspaper
    2      000293        LU .Weijuan    1                radio
    3      000313         Xie .Jifang       3               TV
    Edited by: Li Mishan on Jul 18, 2008 4:42 AM
    Edited by: Li Mishan on Jul 18, 2008 4:43 AM
    Edited by: Li Mishan on Jul 18, 2008 5:43 AM

  • How do i declare a user defined table type sproc parameter as a local variable?

    I have a procedure that uses a user defined table type.
    I am trying to redeclare the @accountList parameter into a local variable but it's not working and says that i must declare the scalar variable @accountList.this is the line that is having the issue: must declare the scalar variable @accountListSET @local_accountList = @accountListALTER PROCEDURE [dbo].[sp_DynamicNumberVisits] @accountList AS integer_list_tbltype READONLY
    ,@startDate NVARCHAR(50)
    ,@endDate NVARCHAR(50)
    AS
    BEGIN
    DECLARE @local_accountList AS integer_list_tbltype
    DECLARE @local_startDate AS NVARCHAR(50)
    DECLARE @local_endDate AS NVARCHAR(50)
    SET @local_accountList = @accountList
    SET @local_startDate = @startDate
    SET @local_endDate = @endDate
    CREATE TYPE [dbo].[integer_list_tbltype] AS TABLE(
    [n] [int] NOT NULL,
    PRIMARY KEY CLUSTERED
    [n] ASC
    )WITH (IGNORE_DUP_KEY = OFF)
    GO

    Why are you asking how to be an awful SQL programmer??  Your whole approach to SQL is wrong.
    We have a DATE data type so your insanely long NVARCHAR(50) of Chinese Unicode strings is absurd. Perhaps you can post your careful research on this? Can you post one example of a fifty character date in any language? 
    The use of the "sp_" prefix has special meaning in T-SQL dialect. Good SQL programmers do not use CREATE TYPE for anything. It is dialect and useless. It is how OO programmers fake it in SQL. 
    The design flaw of using a "tbl-" prefix on town names is called "tibbling" and we laugh at it. 
    There are no lists in RDBMS; all values are shown as scalar values. First Normal Form (1NF)? This looks like a set, which would have a name. 
    In any -- repeat any -- declarative programming language, we do not use local variables. You have done nothing right at any level. You need more help than forum kludges. 
    --CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking
    in Sets / Trees and Hierarchies in SQL

  • 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

  • How to Execute User Defined Table in SQL?

    Hi Experts
    I have User Defined Table @SIN_MPLN in SAP B1 , i stored value in that User Defined Table and  if i execute that Table Through Query Generator it shows me value. it works fine.
    But when i go to SQL Server 2008 R2 and trying to execute this as..
    select * from @SIN_MPLN
    then it gives me Error --> Must declare the table variable "@SIN_MPLN"
    so please give me the answer
    Thanks

    Hello Navanath,
    Nagarajan's answer is correct.
    select * from [@SIN_MPLN] wil also work. the prefix "dbo" is not mandatory.
    Best Regards Teun

  • Problem in EIS with "user-defined table"

    Platform : z/osrdbms : db2 v7Olap : Db2OlapMy problem :I try to make a "User-Defined table" in a meta-model whith this SQL definitionselect a.idele, a.idele0, b.lbele from u1g.fordv0 a, u1g.eledv0 b where a.iddim = 4 and a.idarb = 10 and a.idele = b.idele and a.iddim = b.iddim(description of the two simple table :CREATE TABLE U1G.ARBD ( IDDIM INTEGER NOT NULL, IDARB INTEGER NOT NULL, LBARB VARCHAR(255) NOT NULL, DTCRE TIMESTAMP NOT NULL WITH DEFAULT, DTMAJ TIMESTAMP ) CREATE TABLE U1G.ELED ( IDDIM INTEGER NOT NULL, IDELE INTEGER NOT NULL, LBELE VARCHAR(255) NOT NULL, DDVAL DATE NOT NULL, DFVAL DATE, DTCRE TIMESTAMP NOT NULL WITH DEFAULT, DTMAJ TIMESTAMP, MDCEL CHAR(1) NOT NULL, TYPE CHAR(1) NOT NULL ) )When i look at this "user-defined table" data in the meta model, it's okWhen i try to use this table as a dimension in a meta-outiline, it's okexcept when i try to load members in a cube.The load result say "the load terminated with errors"I look in the IS log :?Tue Jul 27 10:56:40 2004~ /IS/Worker/0x0/1090922163/Error/-104/Build-PQ72292 {DB2 for OS/390}{ODBC Driver}{DSN07011} DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL ".". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: + - AS <IDENTIFIER> DSNT418I SQLSTATE = 42601 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNHPARS SQL PROCEDURE DETECTING ERROR DSNT416I SQLERRD = 0 0 0 -1 69 0 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'00000000' X'00000000' X'00000000' X'FFFFFFFF' X'00000045' X'00000000' SQL DIAGNOSTIC INFORMATION ERRLOC=1:13:1 ?Tue Jul 27 10:56:40 2004~ /IS/Worker/0x0/1090922163/Informational/-104/Build-PQ72292 SELECT. aa."IDELE0", aa."IDELE", aa."LBELE" FROM.(select a."idele" .., a."idele0" .., b."lbele" from u1g.fordv0 a, u1g."eledv0" b where a.iddim = 4 and a.idarb = 10 and a.idele = b.idele and a.iddim = b.iddim) aaI don't understand why it's working in the meta model (the sql is good, i got the data)and why it's not working in the meta outline ?

    Platform : z/osrdbms : db2 v7Olap : Db2OlapMy problem :I try to make a "User-Defined table" in a meta-model whith this SQL definitionselect a.idele, a.idele0, b.lbele from u1g.fordv0 a, u1g.eledv0 b where a.iddim = 4 and a.idarb = 10 and a.idele = b.idele and a.iddim = b.iddim(description of the two simple table :CREATE TABLE U1G.ARBD ( IDDIM INTEGER NOT NULL, IDARB INTEGER NOT NULL, LBARB VARCHAR(255) NOT NULL, DTCRE TIMESTAMP NOT NULL WITH DEFAULT, DTMAJ TIMESTAMP ) CREATE TABLE U1G.ELED ( IDDIM INTEGER NOT NULL, IDELE INTEGER NOT NULL, LBELE VARCHAR(255) NOT NULL, DDVAL DATE NOT NULL, DFVAL DATE, DTCRE TIMESTAMP NOT NULL WITH DEFAULT, DTMAJ TIMESTAMP, MDCEL CHAR(1) NOT NULL, TYPE CHAR(1) NOT NULL ) )When i look at this "user-defined table" data in the meta model, it's okWhen i try to use this table as a dimension in a meta-outiline, it's okexcept when i try to load members in a cube.The load result say "the load terminated with errors"I look in the IS log :?Tue Jul 27 10:56:40 2004~ /IS/Worker/0x0/1090922163/Error/-104/Build-PQ72292 {DB2 for OS/390}{ODBC Driver}{DSN07011} DSNT408I SQLCODE = -104, ERROR: ILLEGAL SYMBOL ".". SOME SYMBOLS THAT MIGHT BE LEGAL ARE: + - AS <IDENTIFIER> DSNT418I SQLSTATE = 42601 SQLSTATE RETURN CODE DSNT415I SQLERRP = DSNHPARS SQL PROCEDURE DETECTING ERROR DSNT416I SQLERRD = 0 0 0 -1 69 0 SQL DIAGNOSTIC INFORMATION DSNT416I SQLERRD = X'00000000' X'00000000' X'00000000' X'FFFFFFFF' X'00000045' X'00000000' SQL DIAGNOSTIC INFORMATION ERRLOC=1:13:1 ?Tue Jul 27 10:56:40 2004~ /IS/Worker/0x0/1090922163/Informational/-104/Build-PQ72292 SELECT. aa."IDELE0", aa."IDELE", aa."LBELE" FROM.(select a."idele" .., a."idele0" .., b."lbele" from u1g.fordv0 a, u1g."eledv0" b where a.iddim = 4 and a.idarb = 10 and a.idele = b.idele and a.iddim = b.iddim) aaI don't understand why it's working in the meta model (the sql is good, i got the data)and why it's not working in the meta outline ?

  • Send values to IN query with parameter

    Subject: send values to IN query with parameter
    Hello. Hope I'll explain my problem well enough:
    I have a query:
    -- select id from table where id in ('100')
    Now I used parameter for the IN part:
    -- select id from table where id in (:param)
    and I gave the parameter the value 100.
    now I want to have the query with two values:
    -- select id from table where id in ('100','200')
    I tried to use the parameter and give him the value of: '100','200'.
    It didn't worked :(
    Is there a syntax to give the parameter more then one value for the IN query (with out using another table or function etc')?
    Thanks in advance,Roy.

    This is the best solution I have for it.
    variable parameter varchar2(4000);
    exec :parameter := 'SYSTEM,SYS';
    select username
    from dba_users
    where username in ( select COLUMN_VALUE from table  (split_string(:parameter,',')))It uses this function
    CREATE OR REPLACE
    type string_table  as table of varchar2(4000)
    CREATE OR REPLACE
    FUNCTION split_string (
         string IN varchar2,
        delimiter IN varchar2
    ) RETURN  string_table IS
         tab string_table;
         pre integer;
         post integer;
         step integer;
         i integer;
    BEGIN
         pre := 1;
         step := length(delimiter);
         i := 0;
         tab := string_table();
         loop
              tab.extend;
              i := i + 1;
              post := instr(string,delimiter,pre);
              if ( post = 0 ) then
                   tab(i) := substr(string,pre);
                   return tab;
              end if;
              tab(i) := substr(string,pre,post-pre);
              pre := post + step;
         end loop;
    END;
    /Bye Alessandro

Maybe you are looking for