Linking UDF to User Defined Table
Dear Experts,
I have a UDF on the batch tables that I would like to link to a User defined table. After creating the link, the UDF drop down cannot open up to display anything. The drop down box is there on the UDF but cannot open or drop to display anything from the user defined table.
Has anyone came across this problem before ?
Regards,
Edited by: MARTIN KAMAU on Jan 4, 2011 10:12 AM
Hi Martin,
When you click on the UDF for the drop-down, do you see an option for "Define New"?
What version of SAP are you using?
Regards
Sudatt
Similar Messages
-
Error while linking user defined table to user defined field using vb6.0
Hi,
I am creating a userdefined field on a SAPB1 table(PDN1) using vb 6.0
I am trying to link this field to a user defined table.
When i do that i get the following error:
"The field 'Related table' should consist of 8 alphanumeric chracters with no valid or default values"
When i try to do the same thing from SAPB1(not using code) there is no such problem.
My vb code is as follows:
Set oUserFieldsMD = oCmp.GetBusinessObject(oUserFields)
oUserFieldsMD.TableName = "PDN1"
oUserFieldsMD.Name = "OB_Locn"
oUserFieldsMD.Description = "WH Location"
oUserFieldsMD.Type = db_Alpha
oUserFieldsMD.EditSize = 30
lRetCode = oUserFieldsMD.Add
If lRetCode <> 0 Then
oCmp.GetLastError lErrCode, sErrMsg
MsgBox sErrMsg
GoTo Err_
End If
If Not oUserFieldsMD.GetByKey("PDN1", 0) Then
MsgBox "Error"
GoTo Err_
End If
oUserFieldsMD.LinkedTable = "OB_TEST"
lRetCode = oUserFieldsMD.Update
Your help will be much appreciated.
Thanks.Great Sébastien!
Looks like we could not survive here one day without your contribution
Best regards,
Frank
PS: For readers of this thread who don't understand why
EditSize
must be "8":
This is the size of the
Code
field in the user-defined table to which the new field OB_Locn (in the DB it will be U_OB_Locn) is linked to...
So, it should be preferrably of the same size. -
UDT and UDF - User-defined Tables and Fields
Dear All,
I am writing a Query to permit the Cashier to check her Cash entries and balances on a Daily basis.
Basically, it's a General Ledger, but I want the Query - Selection Criteria window to display only a few GL codes namely GL codes 1240601, 1240602, 1240603 etc.
I don't know if I am doing it right. This is what I did (SAP B1 8.8):
UDT
I created a UDT called TEST2 using:
Tools -> Customization Tools -> User-defined Tables - Setup
UDF
Then I created a field in the UDT called GlCod using User-Defined Fields - Management
Title : GlCod
Description : GL Code
Type : Alphanumeric 30
Field Data
In the Field Data window, I ticked the Set Valid Values for Fields checkbox and filled in the blanks as follows:
# Value Description
1 1240601 Cash in Hand (Rs)
2 1240602 Cash in Hand (USD Notes)
3 1240603 Cash in Hand (Euro Notes)
etc...
Query
Then I wrote my Query (see below).
When I run it, I get the Selection Criteria screen as I wanted:
Query - Selection Criteria
GL Code ............... (arrow here)
Posting Date ...............
[OK] [Cancel]
When I click on the GL Code arrow, I get a window with the exact choices I need. It looks like this:
1240601 - Cash in Hand (Rs)
1240602 - Cash in Hand (USD Notes)
1240603 - Cash in Hand (Euro Notes)
Executing the Query
The Query seems to run normally, but nothing is generated on the screen, and there's no Error Message.
What can be wrong about this query?
I suspect that the GL codes in JDT1 and TEST2 are not of the same data type, so that INNER JOIN returns nothing.
Thanks,
Leon Lai
Here's my SQL
declare @TEST2 TABLE
(GlCod varchar(30))
declare @GlCod nvarchar (30)
set @GlCod =/*SELECT T0.U_GlCod from [dbo].[@TEST2] T0 where T0.U_GlCod=*/ '[%0]'
declare @refdt datetime
set @ref=/*SELECT T1.RefDate from [dbo].[JDT1] T1 where T1.RefDate=*/ '[%1]'
select
t1.Account as 'GL Code',
t1.RefDate as 'Posting Date',
t0.U_GlCod as 'Restricted GL Codes'
from JDT1 T1
INNER JOIN @TEST2 T0 ON T0.[U_GlCod] = T1.[Account]
WHERE
t1.RefDate <= @refdt
and
t0.U_GLCod = @GlCodTry this:
declare @GlCod nvarchar (30)
set @GlCod =/*SELECT T0.U_GlCod from [dbo].[@TEST2] T0 where T0.U_GlCod=*/ '[%0]'
declare @refdt datetime
set @refdt=/*SELECT T1.RefDate from [dbo].[JDT1] T1 where T1.RefDate=*/ '[%1]'
select
t1.Account as 'GL Code',
t1.RefDate as 'Posting Date'
from JDT1 T1
WHERE
t1.RefDate <= @refdt
and
T1.[Account] = @GlCod
(There is no need to declare the memoria table @test2 if you already created one table with this name.
And there is no need to a join.)
Edited by: István Korös on Aug 15, 2011 1:27 PM -
Item Code Auto Generation Based on User defined Tables
I need the Item code like
PRODUCT TYPE-ITEMGROUP-ITEMCODE-SUBITEM-BRAND-COLOR e.g .FG-01-01-00-001-00.
I created the following User define Tables and link to Item Master data
U_PRO - FOR PRODUCT TYPE
U_GROUP - FOR ITEM GROUP
U_ITEMCODE - FOR ITEMCODE
U_SUBITEM - FOR SUB ITEM
U_BRD - FOR BRAND NAME
U_COLOR - FOR COLOR
i need a formatted search in Item code to fetch the codes from the user defined table
i tried with the following
SELECT T5.[Code]'-'T2.[Code]'-'T3.[Code]'-'T4.[Code]'-'T0.[Code]'-'T1.[Code] FROM [dbo].[@BRD] T0 , [dbo].[@COLOR] T1, [dbo].[@GROUP] T2, [dbo].[@ITEMCODE] T3, [dbo].[@SUBITEM] T4, [dbo].[@PRO] T5 INNER JOIN OITM T6 ON T5.Code = T6.U_PRO WHERE
T5.[Code] = T6.[$U_PRO] AND
T2.[Code] = T6.[$ U_GROUP] AND
T3.[Code] = T6.[$U_ITEMCODE] AND
T4.[Code] = T6.[$U_SUBITEM] AND
T0.[Code] = T6.[$U_BRD] AND
T1.[Code] = T6.[$U_COLOR]
showing errors. Can any one help me regarding this. I badly need the query for Auto generation of ItemcodeHi,
How can you assign those UDF value without ItemCode in the first place?
Thanks,
Gordon -
How to fill the records from a User Define Table to PO item Grid
Hi To all,
I need to fill data from User Define table records into Purchase Order Item Grid.
I created an UDF Filed in PO - Header Part - "PRS"(Filed Name)
By using Formatted Search in itemcode column, i called a query,
"Select itemcode, qty from (@user define tablename) where PRS = $http://OPOR.U_PRS"
For eg:
Output from querry
ItemCode Qty
ABC 1
DEF 2
DFG 7
SDGD 9
By using formatted search it is filling only first data in to itemcode column in PO Grid.
Please help, how can i fill ALL the data in to my PO Grid?
Thanks in Advance
SAGARThe easisest way is to create datasource and the result bind to grid.
Datasource:
oDBDataSource = oForm.DataSources.DBDataSources.Add("@usertablename")
Dim xoConditions As SAPbouiCOM.Conditions
Dim xoCondition As SAPbouiCOM.Condition
xoConditions = New SAPbouiCOM.Conditions
xoCondition = xoConditions.Add
xoCondition.BracketOpenNum = 1
xoCondition.Alias = "u_zn"
xoCondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
xoCondition.CondVal = "cond"
xoCondition.BracketCloseNum = 1
oDBDataSource.Query(xoConditions)
binding (example for matrix, in grid is simillar)
oMatrix.Clear()
Dim cols As SAPbouiCOM.Columns
Dim column As SAPbouiCOM.Column
cols = oMatrix.Columns
column = cols.Item("colX")
column.DataBind.SetBound(True, "@usertable", "u_x")
oMatrix.LoadFromDataSource()
hoep it helps
Petr -
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 -
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 -
Import data to User defined table
Dear All
I created a user define table , it is so simple . and I make it as master object and also define it as a form.
I am going to import data from excel file, I also prepared import template form DTW (maintenance interface)
but I cannot import data. always it shows me error (65172).
Would be grateful if you can advice me in this matter.
thanksCheck this Note 804685 - Add records to UDO tables using the DI API
in this link [https://websmp230.sap-ag.de/sap(bD1lbiZjPTAwMQ==)/bc/bsp/spn/sapnotes/index2.htm?numm=804685] -
Dear Experts,
I would appriciate your advice on the sales budget screen that I am currently woking on.
the screen contains a matrix with a cfl on the product group column and a couple of columns stand for sale figures for each month.
this screen will be called form the BP form. so i would pass the selected BP code to my form.
I am not sure whether a user defined table is the answer to this job.
if i add productGroup,productCode,cardcode,Jan,Feb, ... user defined fields to this table then the system will add Code and Name fields automatically to this table, if the userdeined table is the right way to go for this job, what values i should held for the code and name fields considering both of these fields are stand alone primary key fields.
Many thanks.
Maryam.I usually load the same value into both fields, but since the code field is only eight bytes its kind of limiting. If you don't have any information to load in the table that would be unique, like a date or year field, (or your product code if its less than 9 bytes & will be unique) then a sequential number works fine. There are threads on this forum that show different ways to do it, but one way is basically to select max(code) from the table, convert the value to numeric, add one to it and then use it as the value for both fields.
Here's a link to a thread I posted with some code on the specifics of assigning the next sequential number as code and name:
[Re: Unique Value in Code and Name]
Edited by: John Chadwick on Sep 18, 2009 2:53 PM -
USER DEFINED TABLES IN XL REPORTER
Hello,
I have a user defined field based on a user defined table with code and name. I call my user defined field in XL reporter. This field varied with the data that I report. I would like to know how I can add the name of the table in my XL report. We can call additionnal tables, but I don't know how I can write the instruction to do it with a variable field.
Thanks
Isabelle LAGUERRE
Serena
FranceIsabelle,
Usere Defined Tables are not supported by the XL Report Writer. There is not a method to import UTD's at this time. User Defined Fields (UDF's) are supported.
Eddy -
Make CFL for user defined tables in Crystal Report 8.8 ?
Hi Experts
Use Follwing qry for CFL ( user defined tables) in Crystal Report But its not Show CFL after run the Report in SAP B1 8.8
Period@Select T0.* from @OICC T0
Thanks & Regards
Dinesh LadeHi,
As far as i know, SBO can't figure out in such instance what are you doing, try linking it to an original table.
I usually use OADM for this purpose.
Hope this helps.
Regards,
Daniel -
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. -
What is the Object Type for User Define table ?
Dear All Experts,
I create one of the User Define Table with no. of UDF's
I already register User Define Table with Unique ID.
As per my knowledge, Unique ID is our Object type for that User Define Table.
I want to add Transaction Notification Code for created Used Define Table.
This Transaction Notification prevents user to must enter name in that form.
IF (@object_type = 'Z_Roto' AND (@TRANSACTION_TYPE = 'A' or @TRANSACTION_TYPE = 'U'))
BEGIN
If not Exists (Select T0.DocEntry from [@Z_ROTO] T0 Where ( T0.Name is null OR T0.Name = ' ' ) AND T0.Code = @list_of_cols_val_tab_del )
begin
SET @error = 1
SET @error_message = 'Name is NULL then So, Please enter ZERO Value i.e. 0 in Filed_Name'
End
End
Please help me for this problem.
Thanks & Regards,
Nishit MakadiaHi All,
Thanks for your replay.
Below code is working for User Define Table's Transaction Notification
IF (@transaction_type = 'A' OR @transaction_type = 'U') AND @object_type = 'Z_Roto'
BEGIN
If Exists (Select T0.Code from [@Z_ROTO] T0 Where ( T0.Name is null OR T0.Name = ' ' ) AND T0.Code = @list_of_cols_val_tab_del)
begin
select @error = 10
select @error_message = 'Name is NULL then So, Please enter ZERO Value i.e. 0 in Filed_Name'
End
End
Necessary to Remember 4 Things. That are mentioned below.
1) Register User Define Table (UDT) with using "Object Registration Wizard". For Example : @object_type = 'Z_Roto'
2) When you define selection criteria then it must be compulsory for use Code Field. For Example : Select T0.Code from [@Z_Roto]
3) When you define selection criteria then it must be compulsory for use Code for @list_of_cols_val_tab_del.
4) Use error code as 10 Number
Thanks & Regards,
Nishit Makadia -
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 -
Can I sort a basic User Defined Table
We have some basic user defined tables, not using the sdk in any way, with an object type of no object. By default, these seem to be sorted by Code and/or Name. We have the code and name fields entered as sequential numbers. Since these fields are alphanumeric, the sort isn't pretty for us. Is there a way to sort this table by any of the udf's in the udt, instead of the Code or Name?
If I have 21 sequential entries
It sorts like this...
1 10 11 12 13 14 15 16 17 18 19 2 20 21 3 4 5 6 7 8 9
I would like it to sort like this...
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
This might not seem bad in this example, but when you get into the hundreds and then thousands of records, it is real bad.
Also, when we add a new record, it seems to resort the table, record by record, so you can see the scroll bar scroll through the whole table. This takes a matter of 3-5 seconds now that we are in the 10,000 record range and the record we just entered is somewhere in the middle of the table.
Thanks for any help, answers or ideas.Hi,
I also faced same problem the I started to enter values like 000001,000002,000003 in code. So it will sort automatically and if you want to do in query you can try this query.
select code,name from [@Test] order by CONVERT(int, code)
In udt you cannot directly sort on code column with the figures of 1,2,3.
Thanks
Sachin
Maybe you are looking for
-
Error While Checking In & Storing
Hi Guru's There are some documents which are stored in our legacy system.We are trying to transfer documents from legacy to ECC6.0 through java connector. In java program we have done the coding by calling the function module BAPI_DOCUMENT_CREATE2.W
-
Cisco VPN no longer works - on 2 machines
Hello all - I had been successfully running Cisco VPN 4.9.01 (0030) to connect to my work computer from 2 Macs at home after freshly installing Leopard on both of them, but now I cannot connect from either Mac. I also tried installing 4.9.01 (0080) b
-
Blue-Screen in PHOTOSHOP 7.0 ??
I know everyone on here are for questions, answers, and inquires about Adobe Premiere CS5 or newer, but since so many of you are so highly skilled using that program I was wondering if any of you were also knowledgeable about Adobe Photoshop 7.0. I
-
Shopping cart in status awaiting for approval
HI , Scenario is case 1 SC is created and ordered, but status is having awaiting for approval. when we did dummy changes in SC and ordered, then we got approved stattus. my problem why in first case work flow is not started . Appr
-
4.6C Database instance installation for Oracle 10.2.0.2 64 bit
Trying to Install 4.6C Database instance with R3SETUP for Oracle 10g database. The Oracle binaries for Oracle 10.2.0.2 64 bit are already installed. When i run SETUP.BAT for installing Database instance i get the following error. *Error: DBCOMMONDBEN