Problem in retriving data in query of user defined table(Document)
hi,
am retriving data from two tables(RDR1,@DOCUMNET) by making joins
when i am giving conditions in where clause of @DOCUMENT am got the below error
BUT without any conditons in where clause all data is retriving from tables
"This entry already exists in the following tables 'Service Contracts' (OCTR) (ODBC -2035) [Message 131-183]"
example:
" select * FROM ORDR T0 INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry LEFT JOIN [dbo].[@DOCUMENT] T2 ON T1.DocEntry=T2.U_DocEntry AND
T1.LineNum=T2.U_LineNum
WHERE T0.[DocNum]=[%0]
AND T1.[Dscription]='[%1]'"
Hello rajesh
As I see it, your problem may have something to do with the search variables the [%x] , sometimes you need to put quotes around '[%0]' if the field is alphanumeric or character based.
Please try this :
SELECT * FROM ORDR T0
INNER JOIN RDR1 T1 ON T0.DocEntry = T1.DocEntry
LEFT JOIN [dbo].[@DOCUMENT] T2 ON
T1.DocEntry=T2.U_DocEntry AND T1.LineNum=T2.U_LineNum
WHERE T0.DocNum='[%0]' AND T1.Dscription=' [%1]'
Best Regards
Amin
Similar Messages
-
Problems adding new rows to a simple user defined table manually
Hi
I have just created a user defined table ( SAP 2007 SP01 PL9 ) but when I try to add a line using tools ->userdefined tables I get the following error -
conversion failed when converting the nvarchar value '-3 @GLMAP to data type int ( CINF )
The table is called GLMAP and I simply added 3 alpha fields
I put 1 into all the fields on screen
Can anyone suggest anything please as ideally I would like the end user to be able to update this simple table
Many thanks
Regards AndyAndy
I think in your case you have used DBDataSource to display data from UDT on your form.
Easyier to use UDO than User Defined Table, because you do not have to programming at UDO based forms.
What István tried to say:
Check your sp_transactionnotification procedure, maybe you have used @object_type variable as integer instead of nvarchar
Regards
J -
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 -
Import data in user define table through DTW.
Hi experts,
Can any one tell me how can i import data from excle in User define tables through DTW. Is any other way/tool avaliable to
import data from excel sheet to User define tables
BR,
HariHi Hari,
I suppose u did not do the following..
1. Open DTW, in the menu click on advanced and clik on maintain interface...
2. Now here select the UDT which u want to impot the data.
3. right click on the UDT and click on Create template for structure
4. NOw u use this tempalte and try.
Please inform of the outcome so that i can think of another soluton.
Hope it helps,
Vasu Natari. -
Print Layout to User Defined Table
Hello guyz..
I want a make preprinted for my user query from user defined table where the header information is from another query.
I guess, the base template User Report (system) can only show the repetitve data from one query but the header area is not,
could you help, showing the header information from another query ??
Thanks RegardsRia
The word is that you cannot use the PLD with user defined tables (i wish it was possible). So in any case to do that you have to use third party tools such as Crystal Reports and Reporting Services -
Help needed for data updation in User Defined Tables
Hello Experts,
I am developing one add-on in SAP B1 8.8 to input data in a User Defined Table described as under
Table Name
DriverMst UDT Type is No Object
Description
Stores the Driver master data which are used to get reference in Sale Delivery Form and Driver data management activity
User defined fields
Data Name
Data source
Size
Pane Level
Description
Driver Code
Code
Alphanumeric
0
No object table fixed field
System Name
Name
Alphanumeric
30
0
No object table fixed field
Full Name
FullName
Text
50
0
Father Name
FatherName
Text
50
0
Birth Date
BirthDate
Date
0
Phone Number
PhoneNo
Alphanumeric
50
0
Mobile No
MobileNo
Alphanumeric
13
0
I have created one form using screen painter displaying text boxes and bind them to the table.
This form is working absolutely fine when there are some data in table (i.e. Browse using navigation)
My problem is, when I click add button from tool bar the "OK" button turn to "Add" that means the form is set to Add mode, but when I click "Add" button after entering some data nothing happens and input data is not stored in Table. The same "OK" Button turned to "Update" when I do changes in loaded data, but my changes are not reflected to table after I click "Update".Thanks Nagarajan,
None.
There is no such query. The table fields is directly linked to Edit Box or Combo Box in form.
From the examples I learned that I have to do something like this to get my table updated
Dim oUsrTbl As SAPbobsCOM.UserTable
Dim Res As Integer
oUsrTbl = oCompany.UserTables.Item("DRIVERMST")
oUsrTbl.Code = oBPC.Value 'Item Specific of Driver Code Edit Box
oUsrTbl.Name = Left(oBPN.Value, 30) 'Item Specific of Name Edit Box
oUsrTbl.UserFields.Fields.Item("U_FullName").Value = oMFN.Value
oUsrTbl.UserFields.Fields.Item("U_FatherName").Value = oFTHN.Value
oUsrTbl.UserFields.Fields.Item("U_BirthDate").Value = oDOB.Value
oUsrTbl.UserFields.Fields.Item("U_PhoneNo").Value = oPHN.Value
(Similar For rest ofthe fields)
Res = oUsrTbl.Add()
Just let me know that is this necessary to do like above.. To be frank there are few more fields and matrices on the form which I didn't mentioned. I am just trying to get recovered from first step to proceed further.
Regards -
User defined table types sometimes show up a unknown data type in Profiler
A couple of our users have a problem when using user defined table types. Calls are made using UDTT as variables and these are then passed to a stored procedure as parameters. Sometimes the application returns a timeout. In such situations a Profiler-Trace
shows the following:
declare @p4 unknown
whereas the correct trace (that is sometimes displayed) should be:
declare @p4 dbo.ReportFilterTableType
ReportFilterTableType is a UDTT. The users do have correct permissions for the UDTT (otherwise they would never be usable for the user). What could be the reason that the data types for the variable
@p4 in the example are sometimes returned as unknown and at other times are returned correctly as
ReportFilterTableType? Could this possibly be a network related issue?
Thank you.
Graham Goodwin Email: [email protected]I know this is a old post, but i am also facing the same issue that too in my production server. Did you find any workarround for this issue. Please do reply. Critical problem we are facing.
Alka, Is your problem timeouts when passing TVP parameters, or is it that a Profiler Trace shows type "unknown" for the TVP data type name?
If your problem is timeouts, be aware that TVPs do not have statistics so the optimizer might not be able to generate an optimal plan for non-trivial queries. Declaring a primary key or unique constraint on the table type may help since that will provide
useful cardinality information. You may need to resort to hints in some cases.
I suggest you start a new thread with details of your specific situation if the information in this thread doesn't help.
Dan Guzman, SQL Server MVP, http://www.dbdelta.com -
Update the data in user-defined table
Dear All,
Is there anyway we can insert / update the data in user-defined table in a batch instead of update it from the interface one by one? Our customer has 1,000+ data need to be imported.
They are on SAP2007A SP00 PL45, SQL 2005, CA localization. Thanks a lot.
Regards,
yukaDear Yuka,
If it is UDT, you may use any SQL query to insert, update it. It is not under SAP support anyway.
Thanks,
Gordon -
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 ..... -
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 AMI 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 -
Problems with After Report trigger Updating using User-defined functions
Hi,
I have a report which uses SQL to select data that uses a user-defined stored function in the WHERE clause.
I use the same SQL in the After Report trigger with and UPDATE statement to flag all records selected as being run.
Data is being selected by the report no problem, but the records are not being updated. In a test, If I remove the conditions using the user functions, the records update as expected. In Live conditions I must have these conditions in the script.
I originally tried putting the UPDATE in a formual column, but that would not fire on records where that page was not paged through (or paged to end) in the Runtime Previewer.
Can anyone advise?In case anyone is interested.
The issue was that the stored functions have roles assigned for security.
PL/SQL for After Report doesn't seem to recognise the roles having been assigned for the report, so the implicit cursor update/select I had wouldn't work.
I changed the SELECT into an explicit CURSOR and introduced a FOR LOOP, keeping the UPDATE as an implicit statement.
I know see this was more of a PL/SQL issues than a report one, but such is life. So if anyone feels the urge to move it to the PL/SQL forum, then feel free!!
Have a problem free afternoon. :-) -
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 ?
-
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 -
User Defined Table locked when multi users try to save data?
Hi All,
I am having a problem with User Define Table (UDT). I am just checking if somebody having the same problem as mine (any patch level).
I've developed an add-on to save additional data to some UDTs upon saving a Production Order. I added my code in FormDataEvent (After Action = True and ActionSuccess = True).
Here are my sequences to save the data:
1. Start Transaction
2. Remove Existing Data from 3 UDTs linked to the production order number.
3. Save to table 1, using UserTable object
4. Call function A to save to table2 , using UserTable object
5. Call function B to save to table 3, using UserTable object
6. Commit Transaction.
Note: I have a try catch and rollback the transaction if any exception thrown by .NET and SAP. Below are parts of my coding to handle exception from SAP
If oUserTable.Add() <> 0 Then
oCompany.GetLastError(ErrCode, ErrMsg)
Throw New ApplicationException(ErrCode & "-" & ErrMsg)
End If
in the try catch block, i add the following code
If oCompany.InTransaction Then
oCompany.EndTransaction(SAPbobsCOM.BoWfTransOpt.wf_RollBack)
SBO_Application.MessageBox("[SaveRoute]:" & ex.Message)
Return False
End If
Now, the issue is in some occasions, when multi users try to save the Production Order, the data get deleted from the UDTs, but some of the data did not get saved yet it did not throw an exception. From our observation, it only happens when multi users are trying to save to the same table.
Does anybody having the same or similar issue? Really appreciate if you can share on this.
Many Thanks,
Harianto NgI Believe you should look carefully where in your code writting, you should start transaction and be sure of using end.transaction commit if the insert sends a succesfull message, and rollback it for negative message.
I used to start transacción right before .add method
Wha DBMS are u using?
Hope it helps. -
How to read and write data to a user defined table?
I have created a srf with 2 edit box and a ok buttin, I want to insert data to the user defined table i created using sql query while i press OK button..
Please provide the complete code to insert and select da from the user defined table.Hi,
You can use the code below.
Dim ret As Long
d
Private Sub Add_Table_Click()
Dim oUserTablesMD As SAPbobsCOM.UserTablesMD
Set oUserTablesMD = oCompany.GetBusinessObject(oUserTables)
' When adding user tables or fields, use a prefix
' identifying your partner name space. This will
' prevent collisions from different partner add-ons
' SAP's name space prefix is "BE_"
'Set the two mandatory fields
oUserTablesMD.TableName = "T1"
oUserTablesMD.TableDescription = "Table1"
'Add the table (which contains 2 default, mandatory fields, 'Code' and 'Name')
ret = oUserTablesMD.Add
If ret <> 0 Then
oCompany.GetLastError ret, Str
MsgBox Str
Else
MsgBox "Table: " & oUserTablesMD.TableName & " was added successfully"
End If
End Sub
Private Sub Add_UDF_Click()
Dim oUserFieldsMD As SAPbobsCOM.UserFieldsMD
Set oUserFieldsMD = oCompany.GetBusinessObject(oUserFields)
oUserFieldsMD.TableName = "T1"
oUserFieldsMD.Name = "AlbUDF"
oUserFieldsMD.Description = "Albert UDF"
'Add the field to the table
lRetCode = oUserFieldsMD.Add
If lRetCode <> 0 Then
oCompany.GetLastError ret, Str
MsgBox Str
Else
MsgBox "Field: '" & oUserFieldsMD.Name & "' was added successfuly to " & oUserFieldsMD.TableName & " Table"
End If
End Sub
Private Sub Add_Data_Click()
Dim oUserTable As SAPbobsCOM.UserTable
Set oUserTable = oCompany.UserTables.Item(1)
oUserTable.GetByKey ("T1")
'Set default, mandatory fields
oUserTable.Code = "A"
oUserTable.Name = "Albert"
'Set user field
oUserTable.UserFields.Fields.Item("U_AlbUDF").Value = "1"
oUserTable.Add
If ret <> 0 Then
oCompany.GetLastError ret, Str
MsgBox Str
Else
MsgBox "Value to field: '" & oUserTable.UserFields.Fields.Item("U_AlbUDF").Name & "' was updated successfuly to " & oUserTable.TableName & " Table"
End If
End Sub
Regards,
Noor
Maybe you are looking for
-
I have an iMac purchased in May 2011. OSX Lion 10.7.3. I deleted backup file from the external hard drive which operates from Time Machine. Now, the trash can will not empty some of the files deleted from the backup harddrive. The trash contains--
-
Help Needed---Opening Attachments/Templates of a BP in non-editable mode
Hi... I am new to CRM... How do we open a document/Template attached to a BP in non-editable mode in web UI? Helpful Answers would be rewarded. Thanks Swapna
-
How to pass the internal table data to smartforms
Hi Gurus, I have a problem in passing the internal table data to the smartforms. In the print program I get the data into one internal table "LT_PRDLBL1". I am passing this internal table to the other in print program by calling the FM_NAME. CALL FUN
-
Help help help help (noob)
hey im doing a web start app using jtwain to scan and upload images. but when i run from the server its starts up the gui but nothing happens when scan is clicked... this works in netbeans "run main project". ive been told that this is because i need
-
I was moving some photos to desktop and accidentally started the computer flooding the desktop with jpegs. I turned the computer off to stop it continuing. These jpegs cannot be opened and if I try to trash them it says they are being used or that it