UDO dbdatasource understanding
We found following dbdatasources in a system form (service calls):
<?xml version="1.0" encoding="UTF-16"?>
<Application>
<forms>
<action type="add">
<form appformnumber="60110" FormType="60110" type="0" BorderStyle="0" uid="Siow9" title="Serviceabruf" visible="1" default_button="" pane="1" color="0" left="0" top="0" width="618" height="411" client_width="610" client_height="377" AutoManaged="1" SupportedModes="15" ObjectType="191" mode="3">
<datasources>
<dbdatasources>
<action type="add">
<datasource tablename="OSLT" />
<datasource tablename="OITM" />
<datasource tablename="ASCL" />
<datasource tablename="OCLG" />
<datasource tablename="OSRI" />
</action>
For example OITM is not used in any databind tag. What's the use of this datasource if it's not referenced anywhere in the forms XML?
Hi Philipp,
The datasources might be registered to be used in the form's logic later on. For instance OITM will be used to retrieve and display the Item data required by the Expenses Tab in the Service call form.
Similar Messages
-
Problem to update UDO-recordsets using a matrix with DBDataSource
Hello,
I've got a problem with updating recordsets in an UDO-Table using DBDataSource.SetValue().
Special szenario: I use a matrix bounded with DBDataSources. Adding new records and loading them via DBDataSource.Query() with conditions works fine. The UDO object type is "Document" without lines.
In the simple way now I load just one record and after this I was trying to set an "message" to an simple, editable edittext-column via calling:
oDBDataSource.SetValue("U_Message", 0, "Hello world");
oMatrix.LoadFromDataSource();
Now it's visible in the matrix.
But when I call update via clicking the update-button, B1 do say, everything was ok (green status-message). Reloading this recordset you can see: it was not stored in the database
Even not after:
oMatrix.FlushToDataSource();
As a workaround I do write the "message" via using Cell.Specific.
Can anybody help me?
I'am using SBO 2005 A SP 01 PL 39
Edited by: Christian Bührig on Mar 18, 2008 4:48 PMlook at
New Row in Matrix is a Duplicate and Cannot update Object with new Row
the next way is do it with recordset and directly insert to table.
hope it helps
Petr -
SAP B1 UDO: Bind CFL to the same form UDO
Hi,
I have created an UDO which is bound to a master data user defined table. Now, I have created a form for that master data, where in a matrix, I need to add some of the entries from the same master table, sort of like a tree structure. I have created a CFL which I have bounded to the object type of "MyUDO". The code on after choose from list is given below.
try
Matrix oMatrix_upsell = (Matrix)form.Items.Item("mtx_upsell").Specific;
DBDataSource oDBDataSource = (DBDataSource)form.DataSources.DBDataSources.Item("@PRODUPSELLS");
DataTable oDataTable = null;
oDataTable = oCFLEvent.SelectedObjects;
if (form.Mode == BoFormMode.fm_ADD_MODE | form.Mode == BoFormMode.fm_OK_MODE | form.Mode == BoFormMode.fm_UPDATE_MODE)
if (pVal.Row == oMatrix_upsell.RowCount)
oDBDataSource.SetValue("LineId", oDBDataSource.Size - 1, null);
oDBDataSource.SetValue("U_SKU", oDBDataSource.Size - 1, null);
//oDBDataSource.SetValue("U_CatId", oDBDataSource.Size - 1, null);
oDBDataSource.InsertRecord(oDBDataSource.Size - 1);
string Query = null;
Query = "select Name, U_Web_Id from [@WITM] where U_SKU =N'" + System.Convert.ToString(oDataTable.GetValue("U_SKU", 0)) + "'";
Recordset RSet = (Recordset)B1Connections.diCompany.GetBusinessObject(BoObjectTypes.BoRecordset);
RSet.DoQuery(Query);
oDBDataSource.SetValue("U_SKU", pVal.Row - 1, System.Convert.ToString(oDataTable.GetValue("U_SKU", 0)));
oDBDataSource.SetValue("U_Name", pVal.Row - 1, RSet.Fields.Item("Name").Value.ToString().Trim());
oDBDataSource.SetValue("U_WebId", pVal.Row - 1, RSet.Fields.Item("U_Web_Id").Value.ToString().Trim());
oMatrix_upsell.LoadFromDataSource();
oDBDataSource = null;
catch (Exception ex)
B1Connections.theAppl.SetStatusBarMessage(ex.ToString(), BoMessageTime.bmt_Medium, true);
The problem is that, when I select an item in the matrix, the data of the other fields in the form gets loaded for the selected object from the CFL. Is there a way to create a cfl and bind it to the same table on which the form is operating?Hi Philip,
in SFP When you develop a form you have the interface mapped/assigned to it right.
So here you have the source fields on the left hand side (the output parameters of your interface) and the form context on the right hand side.
So lets say your interface gives you several data where employee list (EMP_LIST) is a internal table.
so now if you drag and drop this EMP_LIST from left to right.
when you do it again it will have the name EMP_LIST_1 and so on.
Now if you go to layout tab you will see the form design area, here if you go to data view on the left hand side, you can see all the fields available for your form. since you have the EMP_LIST of 3 instances you will see all 3 of them.
So now on the form as required have the 3 tables in different pages or so as you like, do the data binding to the 3 different data instances.
since the actual actual source of the 3 lists is still the same the data presented in thhese tables is also same nothing different.
you can have your script to individual tables for presentation nothing changes (all is well).
Now when it comes to matter of support on your developments, when a new developer carries your work, he can see the context and understand that its the same. no need to investigate any scripts or such.
Hope this makes you clear,
Cheers,
Sai -
How to create one form for two Udo object
Hy ,
I have two Object Udo (header and line)
How we created a form to manage these two files (UDO)
ThanksThank you janos
it works, I put the code to other developers for information
Shared Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_application.ItemEvent
If ((FormUID = "SIR001_") And (pVal.ItemUID = "add") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) And (pVal.Before_Action = False)) Then
Dim oDS As SAPbouiCOM.DBDataSource
oDS = SBO_application.Forms.Item(FormUID).DataSources.DBDataSources.Item("@SIR_LOTL")
oDS.InsertRecord(oDS.Size)
oDS.Offset = oDS.Size - 1
oform = SBO_application.Forms.Item(FormUID)
oMatrix = oform.Items.Item("mtx_0").Specific
oMatrix.AddRow(1)
End If
If ((FormUID = "SIR001_") And (pVal.ItemUID = "del") And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_CLICK) And (pVal.Before_Action = False)) Then
oform = SBO_application.Forms.Item(FormUID)
oMatrix = oform.Items.Item("mtx_0").Specific
For index As Integer = oMatrix.RowCount To 1 Step -1
If oMatrix.IsRowSelected(index) = True Then
oMatrix.DeleteRow(index)
oform.Mode = SAPbouiCOM.BoFormMode.fm_UPDATE_MODE
End If
Next
End If
End Sub -
How to bind data for a UDO table..on to MATRIX
hi
i have created a Master Data Table(Video) and also created UDO object...
i designed a form with 2 controls as text boxes and a matrix with some coloums.........
the functioality of the form is ..when i enter some values in those controls...it should get data from DB table and should be displayed in matrix on my form. based on condition what i have entered on form controls...
i have done the same scenario successfully when i'm dealing with other controls like textboxes...by binding data to the controls from DB..
But i dont know how to deal this scenario where i'm populating data to matrix from DBi have used DataTables as u said...but still i'm getting an Exception called " Public MEmber 'Data Table" on type IMatrix not found"
this is following code i have written in my program...
plz give me the solution.....and code...
Try
oitem = oform.Items.Item("7")
omatrix = oitem.Specific
ocolumns = omatrix.Columns
oform.DataSources.DataTables.Add("[@VIDS]")
' odbdatasource = oform.DataSources.DBDataSources.Add("[@VIDS]")
omatrix.DataTable = oform.DataSources.DataTables.Item("[@VIDS]")
'// Ready Matrix to populate data
omatrix.Clear()
omatrix.AutoResizeColumns()
'// Querying the DB Data source
odbdatasource.Query()
'// setting the user data source data
omatrix.LoadFromDataSource()
ocolumn = ocolumns.Item("V_5")
ocolumn.DataBind.SetBound(True, "[@VIDS]", "Code")
ocolumn = ocolumns.Item("V_4")
ocolumn.DataBind.SetBound(True, "[@VIDS]", "Name")
ocolumn = ocolumns.Item("V_3")
ocolumn.DataBind.SetBound(True, "[@VIDS]", "U_CardCode")
ocolumn = ocolumns.Item("V_2")
ocolumn.DataBind.SetBound(True, "[@VIDS]", "U_ShelfNumber")
ocolumn = ocolumns.Item("V_1")
ocolumn.DataBind.SetBound(True, "[@VIDS]", "U_SPACENumber")
ocolumn = ocolumns.Item("V_0")
ocolumn.DataBind.SetBound(True, "[@VIDS]", "U_RentedAvailable")
Catch ex As Exception
SBO_Application.MessageBox(ErrorToString)
End Try -
UDO: Add and Remove rows to/from Matrix.
Hi all,
Yes, I know there are lots of topics about adding and removing rows but I was having trouble with these and I need some expert's opinion.
I'm working with a Document type UDO, with 1 header table (ADAT_ONR) and 1 child table (ADAT_NR1 - MatrixUID = "mtx_NR").
I add the first row when the user chooses the business partner.
If oMatrix.RowCount = 0 Then
oMatrix.AddRow()
oMatrix.AutoResizeColumns()
oMatrix.Columns.Item("V_LineId").Cells.Item(1).Specific.Value = 1
End If
Then, the user has to press the AddRow button to add new rows, and the user can only add 1 new blank row. Later I'll change the row adding behavior to mimic B1s.
If pVal.BeforeAction = False Then
Select Case pVal.ItemUID
Case "AddRow"
'ItemHandler_Click = AddRow(oCompany, oApplication, oForm, oForm.Items.Item("mtx_NR").Specific.RowCount())
oMatrix = oForm.Items.Item("mtx_NR").Specific
If oMatrix.RowCount > 0 Then
If Trim(oMatrix.Columns.Item("V_PltCode").Cells.Item(oMatrix.RowCount).Specific.Value) = "" Then
oApplication.StatusBar.SetText(TranslateStr(oApplication, MustChoosePallet), BoMessageTime.bmt_Short)
Exit Function
End If
End If
ItemHandler_Click = NewLine(oCompany, oApplication, oForm)
Exit Function
Private Function NewLine(ByRef oCompany As SAPbobsCOM.Company, ByRef oApplication As SAPbouiCOM.Application, _
ByRef oForm As SAPbouiCOM.Form) As Boolean
NewLine = False
Try
oMatrix = oForm.Items.Item("mtx_NR").Specific
Dim Index As Integer = oMatrix.RowCount
With oForm.DataSources.DBDataSources.Item("@ADAT_NR1")
.Clear()
End With
oMatrix.AddRow()
oMatrix.Columns.Item("V_LineId").Cells.Item(Index + 1).Specific.Value = (Index + 1).ToString
oMatrix.FlushToDataSource()
oMatrix.LoadFromDataSource()
oForm.Refresh()
NewLine = True
Catch ex As Exception
oApplication.MessageBox("NewLine(): " & oCompany.GetLastErrorCode.ToString & ", " & ex.Message)
End Try
End Function
When I Add or Update the data, I clear the last blank row, if it exists.
'// In the Click Event
If pVal.BeforeAction = True Then
Select Case pVal.ItemUID
Case "1"
If oForm.Mode <> BoFormMode.fm_FIND_MODE Then
oMatrix = oForm.Items.Item("mtx_NR").Specific
oMatrix.FlushToDataSource()
oMatrix.LoadFromDataSource()
If Trim(oMatrix.Columns.Item("V_PltCode").Cells.Item(oMatrix.RowCount).Specific.Value) = "" Then
oForm.DataSources.DBDataSources.Item("@ADAT_NR1").RemoveRecord(oMatrix.RowCount - 1)
oMatrix.DeleteRow(oMatrix.RowCount)
'oMatrix.FlushToDataSource()
End If
End If
End Select
My question is, Is there an easier way to Add and Delete Rows??
BTW, I still have a problem so solve. With this code, when the user deletes a row the row numbering is incorrect. Example: if I have to rows in a matrix and I delete row nº1, row nº2 will hold the same number...
Any Ideas?
Thanks in advanced,
Vítor VieiraHi Victor,
there is a Form Data event which you ca use in that try to write the code for adding a row after updating and delete a row while inserting and add a row while traversing.
sample code.
Sub FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, ByRef BubbleEvent As Boolean)
Try
Select Case BusinessObjectInfo.EventType
Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD, SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE
If BusinessObjectInfo.BeforeAction = True Then
objForm = objMain.objApplication.Forms.Item(BusinessObjectInfo.FormUID)
oDBs_Head = objForm.DataSources.DBDataSources.Item("@Header")
oDBs_Detail= objForm.DataSources.DBDataSources.Item("@Line")
objMatrix = objForm.Items.Item("83").Specific
If objMatrix.VisualRowCount <> 0 Then
objMatrix.DeleteRow(objMatrix.VisualRowCount)
objMatrix.FlushToDataSource()
End If
If BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD Then
End If
ElseIf BusinessObjectInfo.ActionSuccess = True Then
objForm = objMain.objApplication.Forms.Item(BusinessObjectInfo.FormUID)
If BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_UPDATE Then
objMatrix = objForm.Items.Item("83").Specific
objMatrix.AddRow()
SetNewLineCharge(objForm.UniqueID, objMatrix.VisualRowCount)
objMatrix.FlushToDataSource()
End If
End If
Case SAPbouiCOM.BoEventTypes.et_FORM_DATA_LOAD
If BusinessObjectInfo.ActionSuccess = True Then
oDBs_Head = objForm.DataSources.DBDataSources.Item("@Header")
oDBs_Detail = objForm.DataSources.DBDataSources.Item("@Line")
objMatrix = objForm.Items.Item("83").Specific
objMatrix.AddRow()
SetNewLineCharge(objForm.UniqueID, objMatrix.VisualRowCount)
objMatrix.FlushToDataSource()
End If
End Select
End Sub
Hope this helps,
OM Prakash -
Control sort order of UDO Child
Hey All,
Can anyone tell me how I can control the display order of a document UDO lines matrix? We have document lines created that have a date in the data and the client would like the data to display with the newest entries on top.
Anyone know how I can do this?I can see one possibility, but I have never tried it on a UDO screen. Basically I am thinking you might be able to use a variation on a technique I described previously for adding sorting into a DBDatasource based screen
Re: Sort data in matrix using DBDataSources
Theoretically this might work for your UDO although you would also need to handle the fact that the UDO itself will be attempting to auto-populate the matrix whereas in my previous posting the matrix population was always under user control. (Either matrix.clear or set bubbleevent = false might handle this additional complexity)
I think you could probably end up with something like the following
- Intercept MATRIX_LOAD event
- ??matrix.Clear??
- **Populate Array from dbdatasource & Quicksort it**
- for counter = 0 to (DBDataSource.Size - 1)
- Set offset on DBDataSource to **offset from Array**
- Matrix.Addrow
- next
- ??BubbleEvent = false??
I have never tried it so it might not work out when it comes to updating, but on the plus side it should be pretty quick to add into an existing screen to test.
One final thought - For a <b>really</b> quick test to see if it is likely to work before going to the trouble of introducing the array & proper sorting routine, simply loop through the dbdatasource from last record down to first record and see if everything still works with the rows displayed in reverse order.
eg.
- Intercept MATRIX_LOAD event
- ??matrix.Clear??
- for (DBDataSource.Size - 1) to Counter Step -1
- Set offset on DBDataSource to counter
- Matrix.Addrow
- next
- ??BubbleEvent = false??
Hope it works out,
John. -
Auto-Managed forms and DbDataSource.Offset
I have defined a custom form that navigates a list of UDO's.
However, when I navigate the objects using the 1st/prev/next/last button, the bound fields do change as expected, but DBDatasource.Offset still is set to 0!
Is there a way to correctly reset Offset while navigating?
If this doesn't work, how do I retrieve the correct values?Not sure what you mean:
If I am not totally wrong the Offset is "0"-based + form / DBDataSource is moved to just 1 UDO record (1st/next/...).
So nothing is wrong with that.
The .Offset property of DBDataSource is the "index" of the record in the result set which is built up of the records retrieved in the DB according to the condition applied (here only the data for the particular record to be displayed are loaded - i.e. the condition is unique like DocEntry = 4).
.Offset is <b>not</b> pointing to the record in the DB.
What do you mean by "how do I retrieve the correct values"???
You can use GetValue to get the key of the record and do whatever you like... -
Hi,
I have a grid with a DT linked to it. I need to add columns to this DT with DBDatasourse is set in each column. So that, using UDO I can save the data to the Line table.
Please add some sample code for this to be done
Thank YouHi Vibin,
DataTable and DBDataSource are 2 diffferent datasources.
You cannot bind one to the other.
You can, though, bind them to a matrix.
This is how you bind DBDataSource to matrix :
oMtx.Columns.Item(1).DataBind.Bind("UDOTableUID","Column Name")
Or you can bind them directly in screen painter/B1Studio.
Regards
Edy -
Dynamic condition in UDO Matrix's Column
Hi all,
I have a user form with a matrix. The matrix's first column has a CFL linked to another UDO MasterData Code (lets call it UDOCode).
And on this matrix, the same UDOCode cannot be chosen more then once.
So, I've been trying to code a dynamic CFL that filters the UDOCode's already chosen in the Column.
Based on this thread I've achived this code:
Select Case pVal.ItemUID
Case "mtx_ACORDO" '// The Matrix
oConds = New SAPbouiCOM.Conditions
With oForm.DataSources.DBDataSources.Item("@ADAT_ACORDOS1") '// The Matrix's DBDataSource
If .Size = 1 Then
oCond = oConds.Add
oCond.Alias = "Code"
oCond.Operation = BoConditionOperation.co_NOT_NULL
Else
For i As Integer = 0 To .Size - 1
oCond = oConds.Add()
oCond.BracketOpenNum = 1
oCond.Alias = "Code"
oCond.Operation = BoConditionOperation.co_NOT_EQUAL
oCond.CondVal = .GetValue("U_EspPrcCd", i)
oCond.BracketCloseNum = 1
If i > 0 And i < .Size - 1 Then
oCond.Relationship = BoConditionRelationship.cr_OR
End If
Next
End If
End With
End Select
If Not oConds Is Nothing Then oCFL.SetConditions(oConds)
In the matrix's first row I have no problem. All the values are there. But on the second row, no values are display in the DataTable.
If I change the conditions from .Size -1 to .Size - 2, I get the correct values on the first and second rows, but on the third, again, no values are being display in the DataTable...
Can anyone help me?
Regads,
Vítor Vieira
Edited by: Rui Pereira on Dec 23, 2008 4:17 PMHi, Erwine Sukardy
Maybe it will be helpful if you have a specific task.
All of items on a Form have it's own DBDataSources.
For example, to get a table name and field name, that are Datasources to the ItemCode field in a Matrix in a Purchase Order document, you can use this code:
SAPbouiCOM.Matrix tblSNs;
SAPbouiCOM.Column oColumnItems;
tblSNs = (SAPbouiCOM.Matrix)oPurDNForm.Items.Item("38").Specific;
oColumnItems = (SAPbouiCOM.Column)tblSNs.Columns.Item("1");
string tableName = oColumnItems.DataBind.TableName;
string fieldName = oColumnItems.DataBind.Alias;
HTH! -
Problem with ChooseFromList on UDO
Hi, I have a UDO form that works well except for one small issue. I have an EditText that is tied to a field in the UDO table for the B1 Item Code. This field saves, loads and navigates fine, but when adding a new UDO record, I need to have the user pop up a ChooseFromList to see a list of the B1 items. The only problem is that this edit text is already bound to the UDO table/field and therefore the Choosefrom list isn't able to automatically populate the edit text like it normally would when the field is bound to a user datasource.
What is the preferred way to have a UDO field bound to an edit text box on the UDO to also work with a ChoosefromList?
I just wanted to ask before I spend time programming a work-around to code the choosefromlist value into the edit text myself.
Thanks!Hi Curtis,
Have you tried to create a CFL and asign it to your edit text (linked to a DB Datasource)? I have tried it and it works fine, it works for UDS and also for DBDS.
'Add EditText to the form for User Object
oItem = oForm.Items.Add("EdTxtUO", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem.Left = 105
oItem.Top = 50
oItem.Width = 100
oEdit = oItem.Specific
'Link DBDS to EditText
'oEdit.DataBind.SetBound(True, "", "ET_UDS_UO")
Dim etDDSuo As SAPbouiCOM.DBDataSource
etDDSuo = oForm.DataSources.DBDataSources.Add("@T_MD")
oEdit.DataBind.SetBound(True, "@T_MD", "Code")
' Add ChooseFromList for EditText to the form
oCFLCPuo = SB1_App.CreateObject(SAPbouiCOM.BoCreatableObjectType.cot_ChooseFromListCreationParams)
oCFLCPuo.ObjectType = "TT_MD"
oCFLCPuo.UniqueID = "UserObjectCFL"
oCFLuo = oForm.ChooseFromLists.Add(oCFLCPuo)
'Link CFL to EditText
oEdit.ChooseFromListUID = "UserObjectCFL"
oEdit.ChooseFromListAlias = "Code"
Regards
Trinidad. -
Hi @all!
There was often the question, if a DBDataSource could be ORDERed BY sth. Although it would be nice if somebody could disprove that: It's not possible.
Up to this my experience was that the "items" in a DBDataSource always ordered by the Code-Column. That's what my code in some situations relys on. For example if a B1-form browses by a DBDataSource then the order is not always user friendly based on a column with data the user knows.
But today I was surprised: "Suddenly" a DBDataSource-browsing form is browsing correctly by a DB-Column which the user is interested in (instead of the code-column) !
The reason for this is a unique UserKey, which I've created by SDK (UserKeysMD). The form seems to browse by the columns of the key.
But the common reason seems to be that it's standard SQL-behaviour because doing a simple query (without ORDER BY) in SQL-Management Studio also sorts the results by the unique key.
But there's one important question left:
Which key wins and why? There's also the unique index for Code on that table....
Cheers,
RolandHello @Petr & @all ,
last night I came to the conclusion, that I must re-implement the browsing for the 6 existing forms with own code:
Stepping through a recordset with the data of the Ex-BrowseBy EditTxt with defined ORDER
Then loading the form with DBDataSource which is restricted by conditions to exactly ONE dataset on each arrow-step. I hope/think it works - I will inform you.
And here are some things to sort out with David {german - sorry}:
Hallo David,
ich habe hier kein UDO verwendet weil...
...die Forms viele spez. Funktionen haben die dadurch nicht (oder nur komplizierter) möglich wären.
...hauptsächlich aber weil die betroffenen Tabellen auch von einer Schnittstelle zur Betr.-Datenerfassung "gespeist" werden (also nur über DI)
BrowseBy funktioniert ja auch ohne UDO über ein EditTxt welches an eine column in der tabelle DBDataBinded ist und für das "BrowseBy" aktiviert ist.
Dies ist für die Tabelle/Formular mit den Hauptobjekten auch ok: es wird automatisch durch alle Hauptobjekte geBrowsed und nach Code wäre zumindest chronologisch alles richtig gewesen (auch nicht schön von dieser Vorgabe abhängig zu sein - hat sich ja jetzt aber erledigt, da die Indexe alles undefiniert würfeln)
Die Sache wird aber noch etwas komplizierter, da die Hauptobjekte drei mal in Unterobjekte aufgeteilt sind, für die es jeweils auch Formulare gibt. Und diese Formulare sollen nur innerhalb eines Teils der zugehörigen Untertabelle browsen. In der Untertabelle sind aber alle Unterobjekte aller Hauptobjekte enthalten.
Also habe ich für die Unterobjekt-Form die DBDataSource nach der geBrowsed wird mit Conditions eingeschränkt. Schon hier mußten die Pfeile mit eigener Funktion belegt werden (B1 automatik reicht da nicht)
Beim browsen in den Unterobjekten ist durch die indexe natürlich nun auch alles durcheinander.
Das ganze fiel auch nicht sofort ins Auge weil "meistens" Code und eigentliche ObjektSchlüssel durch "chronologische" Eingabe (bzw. import) die gleiche Reihenfolge haben.
Nur ein Versuch das "mal so eben" zu erklären...
Viele Grüße,
Roland -
Can't fill in a date field in matrix and UDO
Hi
I have created 2 usertables (docuemnt and documentlines) and I created an UDO of it and create a user def form.
In the documentline table (data in the matrix), there are 2 date fields. I fill the dates in de dbdatasource of the matrix but in the database it remain a null value.
following code line seems not to work
oDBPIT_AUTSTOCK_DET_1.SetValue("U_DOCDATE", Row, docdate)
After this line:
oDBPIT_AUTSTOCK_DET_1.GetValue("U_DOCDATE", Row)
returns an empty string.
I did several tries: Let the docdate as DATE, or as string, even
sboBOB.Format_DateToString
seems not to work.
How can I solve this problem, Has anyone a clue?
EddyHello
In order to learn how to fill UDO tables please refer to the following link:
<https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/oss_notes/sdn_oss_sbo_sd/~form/handler>
Please note that the TableName.txt file should include all fields and not only (code, name and your user fields) as described in the document.
The fields should be separated with tab.
In the data lines you donu2019t need to put values in all the fields.
Please refer to the attached text file as a sample.
Best regards,
Miki -
Link button in grid column to UDO
Hi,
I read through the posts regarding linking to user-defined objects, but I found it very confusing. Some posts say that it is not possible to create a link button to a UDO; others say you need to use the extended-object property.
Does anyone have code that I could use to designate a grid column as a link to a UDO?
The code I'm using is:
oGrid.Columns.Item(1).Type = SAPbouiCOM.BoGridColumnType.gct_EditText
txtColumn = oGrid.Columns.Item(1)
txtColumn.Width = 83
txtColumn.LinkedObjectType = ???
I need to fill in the "???".
If I designate an SAP B1 object type it works.
Thanks,
MikeRasmus,
Thanks for taking the time to provide a detailed explanation. I think though that SAP needs to solve these kinds of problems. It is my understanding that the main design goal of Business One is to provide an infrastructure that would reliably enable customization around it. There is no such thing as accounting software that does not need some kind of adaptation to make it work for specific kinds of business models. So a design that makes customization easier makes a great deal of sense.
If it is necessary to improvise in order to do what you need, then this design goal has not been met. It also means that Business One is not what is managing the process because you are effectively going around it. This in my view is actually worse than if Business One made these links work. By forcing us to go around it, we effectively loose the data protection that Business One should be providing. This is my take on it anyway.
We solved the problem by opening the appropriate form with the appropriate data in it by using the double-click event. The reason we have to do it this way is because the SDK will not even display the link button in a grid if its target is a UDO. This brings up another reason for the SDK to be more cooperative with these efforts. SAP has provided a detailed document describing the need to not deviate from Business Ones look and feel. Perhaps SAP needs also to provide an SDK that more reliably and easily enables that caveat.
If Business One had been designed from the ground up using SOA, its original design goal would be a lot easier to meet. Maybe this is the real problem.
Thanks,
Mike -
Hi,
I have been through all the Matrix Samples and read many threads here but I just dont get a few things with the Matrix.
I have created an add on that adds a new folder to the Business Partners Form,
I can have built a matrix in this form and created bound columns bound to my UDO Table @xxxx
I have an event that fires when a business partner is chosen and the folder is only shown when a Customer is selected.
I can even get the matrix to fill with data related to the specific customer only when the customer is selected - using conditions on the DBDataSource.
This is all great but the 2 problems I have are :
I have created a button called Add Row that Adds a Row to Matrix - this button turns into an Update button when the row is added in the Matrix.
Problem 1 : When the row is added in the Matrix it takes the data from the last row of the data and duplicates it in the new row - you can change this data of course however I would like a blank row inserted instead.
Problem 2 : When I update I do a Matrix.FlushToDataSource - then I requery but it has not saved the new entry ?
How do I get the new entry to save into the database.
Any Help would be appreciated.
ThanksThanks - I sent the Screen shot - here is the event code
If ((pVal.FormType = 134 And pVal.EventType <> SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD) And (pVal.Before_Action = True)) Then
oForm = SBO_Application.Forms.GetFormByTypeAndCount(pVal.FormType, pVal.FormTypeCount)
If ((pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD) And (pVal.Before_Action = True)) Then
oNewItem = oForm.Items.Add("BOMFolder", SAPbouiCOM.BoFormItemTypes.it_FOLDER)
oItem = oForm.Items.Item("9")
oNewItem.Top = oItem.Top
oNewItem.Height = oItem.Height
oNewItem.Width = oItem.Width
oNewItem.Left = oItem.Left + oItem.Width
oFolderItem = oNewItem.Specific
oFolderItem.Caption = "Lynxs BOM"
oFolderItem.GroupWith("9")
SetupBOMMatrix()
oForm.PaneLevel = 1
End If
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST Then
If pVal.ItemUID = "mat" Or pVal.ItemUID = "colitem" Then
Try
Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
oCFLEvento = pVal
Dim sCFL_ID As String
sCFL_ID = oCFLEvento.ChooseFromListUID
Dim oForm1 As SAPbouiCOM.Form
oForm1 = SBO_Application.Forms.Item(FormUID)
Dim oCFL As SAPbouiCOM.ChooseFromList
oCFL = oForm1.ChooseFromLists.Item(sCFL_ID)
If oCFLEvento.BeforeAction = False Then
Dim oDataTable As SAPbouiCOM.DataTable
oDataTable = oCFLEvento.SelectedObjects
Dim val As String
Dim nam As String
Try
val = oDataTable.GetValue(0, 0)
nam = oDataTable.GetValue(1, 0)
Catch ex As Exception
val = "none"
nam = "none"
End Try
Try
Call UpdateCells(oForm1, pVal.Row, val, nam)
Catch
MsgBox("Couldnt Set Data Tables")
End Try
End If
Catch
MsgBox("Error in Item Event - CFL : " & Err.Description)
End Try
End If
End If
If pVal.ItemUID = "btnAddRow" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.Before_Action = True Then
' SOMETHING IS AMISS HERE
Dim ob As SAPbouiCOM.Button = oForm.Items.Item("btnAddRow").Specific
Dim oe As SAPbouiCOM.EditText = oForm.Items.Item("5").Specific
oMatrix = oForm.Items.Item("mat").Specific
If MatrixMode = "Nothing" Then
oMatrix.AddRow()
Dim i As Integer
i = oMatrix.RowCount
Dim oc As SAPbouiCOM.Column
Dim ocell As SAPbouiCOM.Cell
Dim oed As SAPbouiCOM.EditText
oc = oMatrix.Columns.Item("colArea")
oed = oc.Cells.Item(i).Specific
oed.String = ""
oc = oMatrix.Columns.Item("colItem")
oed = oc.Cells.Item(i).Specific
oed.String = ""
oc = oMatrix.Columns.Item("colItemtxt")
oed = oc.Cells.Item(i).Specific
oed.String = ""
oc = oMatrix.Columns.Item("colFitted")
oed = oc.Cells.Item(i).Specific
oed.Value = 0
oc = oMatrix.Columns.Item("colCritica")
oed = oc.Cells.Item(i).Specific
oed.Value = 0
oc = oMatrix.Columns.Item("colSpares")
oed = oc.Cells.Item(i).Specific
oed.Value = 0
MatrixMode = "Add"
ob.Caption = "Update Row"
Else
oMatrix.FlushToDataSource()
Dim oConditions As SAPbouiCOM.Conditions
Dim ocondition As SAPbouiCOM.Condition
oConditions = New SAPbouiCOM.Conditions
ocondition = oConditions.Add
ocondition.BracketOpenNum = 1
ocondition.Alias = "U_CARDCODE"
ocondition.Operation = SAPbouiCOM.BoConditionOperation.co_EQUAL
ocondition.CondVal = oe.Value.ToString
ocondition.BracketCloseNum = 1
oDBDatasource.Query(oConditions)
oMatrix.LoadFromDataSource()
MatrixMode = "Nothing"
ob.Caption = "Add Row"
End If
End If
If pVal.ItemUID = "BOMFolder" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_ITEM_PRESSED And pVal.Before_Action = True Then
'// when the new folder is clicked change the form's pane level
'// by doing so your items will apear on the new folder
'// assuming they were placed correctly and their pane level
'// was also set accordingly
oForm.PaneLevel = 11
End If
End If
Maybe you are looking for
-
How to install first forest and active directory on the windows server 2012 R2 core?
hi to all i installed a windows server 2012 R2 Core edition on the server platform and i want install first forest and Domain on this server core by cmdlet...but i cannot install it. i search in the technet and other sites and blogs on the internet a
-
Error: Installing EM Grid 10.1.0.3 and Oracle 10.2
Hi folks, I've been looking through the pre-installation notes for EM Grid. Wondering if I missed the JDBC requirements. Maybe thick JDBC? How can we check this on Linux? I get an error while installing EM Grid on Windows. I'm using an existing Oracl
-
In itunes - apps, how do I delete an iphone app I'm no longer using?
App has been deleted from phone, but still shows in itunes. I don't want to see it in itunes either. clicking the app and pressing delete key does nothing menu Edit - Delete is grayed out I'm using the latest version of itunes, on a windows 7 machine
-
I just purchased 3 albums from iTunes. I synched my iPod
I just purchased 3 albums from iTunes. I synched my iPod, and now there are several duplicate songs. I went through my library, deleted the duplicates, and resynched my iPod. Now the songs aren't there *at all* (on my iPod), yet they are in my lib
-
Problems installing OS I have an iMac 21.5 (mid-2010) and I'm trying to install a new hard drive. When I choose the installation disk the Apple logo comes up and it stops there. Then the mouse and keyboard goes dead. I'm trying to install 10.6. A