on 09-19-2008 4:25 PM
I am adding item lines in the sales quote system form, using part data from an external source after the user clicks a button (a new panel I added) using the Lines class in SAPbobsCOM.Documents. It's working, but the items don't show in the matrix (ie grid) until you close and re-open the form or navigate to another record and back. I tried calling the update() & refresh) on the form as the SDK says, but it's not working. I found the Refreash is depricated and Update just repaints the form. How do I refresh the data the sales quote matrix? (This a matrix already on the system form not one I added, so I cannot call LoadFromDataSource, etc on the matrix). Also, since the user needs to fill in the customer (and document date gets filled in automaticly) filled in the form to fille in the CardCode and DocDueDate on the SAPbobsCOM.Documents obect, when I tried using the naigate to another record and back workaround I found here (ActivateMenuItem("1289") , etc) I get a prompt that data will be deleted (of course since the user needs to fill in the customer). Can I suppress or get rid of this prompt? Is there a way to reload the data in system form like the refresh used to do? Do a need to move this code to my own form and just load the sales quote form when I'm done 'cause there's no way to refeash the item matrix on the sales quote form? Help!
Basically, refreshing a system form direcly and w/o promts can't be done.
Edited by: Robert Lempke on Sep 22, 2008 9:26 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Rob,
Since you are using a combination of DI API and System Form (UI API) to accomplish the task of adding a Sales Quotation, the refresh on system form becomes tricky.
When a document is added via DI API, it is reflected in database only and not in the Form/UI. There is no method available to do a data refresh on the system matrix/form.
You can try simulating a Find click and then query for the Doc number just added (if this fits your scenario).
Other alternative is to create a user form which would allow the user to fill all necessary information; then create a Sales Quotation using DI API;
Now you can load the data for the Sales Quotation in the system form (if needed).
Regards
Aravind
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried the above, I got an error message ...
"Data Source - is not a user-defined object [66000-17]. Form Unique Id: 'F_57', Table Unique Id : 'QUT1'"
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When I try to set editable to true :
oItemMatrix.Columns.Item("1").Editable = True
"Item - The item is not a user-defined item [66000-8]"
like I said this is a system form and a system matrix, so access to the matrix is restricted. It also means I can't use LoadFromDataSource either. That's why I'm using the documents object to insert the sales quote into the database - and it's working, but you have to reopen/navigate to see the lines in the matrix. I want to be able to show the lines w/o forcing tyhe system form to close/reopen/navigate, since the form always prompts "Changes will cause data to be deleted, Continue?" ... [sigh].
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Robert,
Basically here are some thing to review as an example ...
Dim oDBDataSource As SAPbouiCOM.DBDataSource
Dim oMatrix As SAPbouiCOM.Matrix
' getting the data sources bound to the form
oDBDataSource = Form.DataSources.DBDataSources.Item("OUSR")
' getting the matrix on the form
oMatrix = Form.Items.Item("Matrix1").Specific
oMatrix.Clear
' Querying the DB Data source
oDBDataSource.Query
' Adding the data to the matrix
oMatrix.LoadFromDataSource
Here you see the steps you must perform to read data from a database table (here OUSR) and display them in a corresponding row of a matrix.
If you pack this coding in a function where you can pass the handle of the form, you can also reuse this lines.
First of all, you get a handle to the Database data source and a handle to the matrix object on the form.
Using the Query method, you can retrieve data from the corresponding database table. You can specify the where clause for the resulting select statement by using the Conditions collection.
After having queried the data, you display the data on the matrix by calling the AddRow method.
The same procedure holds for user data sources:
You can get a handle to the user data source object with the following statement: oUserDataSource = Form.DataSources.UserDataSources.Item("Remarks")
Before adding the data to a row of the matrix on the form, you must set the value property of the user data source object with the following statement: oUserDataSource.Value = "my user data
HTH,
Eddy
Robert,
With respect to your question ... please see the SAP Business One SDK samples for ...
... \Program Files\SAP\SAP Business One SDK\Samples\COM UI\VB.NET\06.MatrixAndDataSources ...
... as this may help you.
Also see the SAP Business One SDK Help documentation on the Matrix Object and specifically the LoadFromDataSource method.
With respect to existing rows in the matrix and trying to change the ItemCode in the Documents_Lines object ... you are correct that this property is read only.
Eddy
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
"Public member 'Editable' on type 'ICell' not found."
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Robert,
My bad...
oForm.Items.Item("MATRIX").Specific.Columns.Item("U_COLUMN").Editable = True
oForm.Items.Item("MATRIX").Specific.Columns.Item("U_COLUMN").Cells.Item("ROW").Specific.Value
oForm.Items.Item("MATRIX").Specific.Columns.Item("U_COLUMN").Editable = False
It's a member of Column
Regards,
Vítor Vieira
Huh?
Editable is not a member of a Cell object, the only members are Specific and click. (Nor is it a member of Iedittext).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I treid loading the items directly into the matrix, using the that method, but the itemCode and quantity cells are readonly - I get a item is not editable error message.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Robert,
That's not a problem:
oForm.Items.Item("MATRIX").Specific.Columns.Item("U_COLUMN").Cells.Item("ROW").Editable = True
oForm.Items.Item("MATRIX").Specific.Columns.Item("U_COLUMN").Cells.Item("ROW").Specific.Value
oForm.Items.Item("MATRIX").Specific.Columns.Item("U_COLUMN").Cells.Item("ROW").Editable = False
Regards,
Vítor Vieira
Robert,
When working with system matrix's, you must set the value in the cell
oForm.Items.Item("MATRIX").Specific.Columns.Item("U_COLUMN").Cells.Item("ROW").Specific.Value
and not in the DataSource. The reason: like you said, you cannot use LoadFromDataSource in a system matrix.
Regards,
Vítor Vieira
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
101 | |
14 | |
10 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.