Skip to Content
author's profile photo Former Member
Former Member

Problem binding a matrix in the Sales Order Form

Hi everybody!

I am working in an Add-On. What I do is modify the sales order form in runtime. I catch the event when the form is loading and then I add a new folder with some fields and a matrix.

I've got a matrix in this form with the employees that participate in an order and when I go through all the orders by using the next and previous record buttons I have to rebind it to show the participants in a specific order. The code for the event is the following:

If (pVal.ItemUID = "57") And pVal.Before_Action = False And pVal.EventType = et_ITEM_PRESSED Then


BubbleEvent = False

End If

After bind the grid, BO shows a System message indicating that the form has been changed and asking me if I want to save the changes to the order. Looks like, whenever the bind function finds rows to add to the matrix it changes the mode of the form by adding rows to the matrix. How can I prevent that when I'm in view mode?

This is the code for the binding function

Sub BindParticipantGrid()

Dim myForm As SAPbouiCOM.Form

Dim oMatrix As SAPbouiCOM.Matrix

Dim rs As sapbobsCOM.Recordset

Dim strSQL, OrdreNr As String

Dim oText As SAPbouiCOM.EditText

Set myForm = SBOApplication.Forms.GetFormByTypeAndCount(139, 1)

Set oText = myForm.Items("8").Specific

If oText.Value <> "" Then

OrdreNr = oText.Value


OrdreNr = "0"

End If

Set oMatrix = myForm.Items("matrix").Specific


Set rs = myCompany.GetBusinessObject(sapbobsCOM.BoObjectTypes.BoRecordset)

strSQL = "SELECT [@HL_PART].Code as Code, [@HL_PART].U_DocNum as DocNum, [@HL_PART].U_EmpId as EmpId, [@HL_PART].U_EmpName as EmpName, [@HL_PART].U_Message as Message, [@HL_PART].U_MessRead as MessRead, [@HL_PART].U_MainPart as MainPart, [@HL_PART].U_StartDt as StartDt, [@HL_PART].U_StartHr as StartHr, [@HL_PART].U_FinishDt as FinishDt, [@HL_PART].U_FinishHr as FinishHr, [@HL_PART].U_Finished as Finished FROM [@HL_PART] WHERE [@HL_PART].U_DocNum = " & OrdreNr

rs.DoQuery strSQL

While Not rs.EOF

myForm.DataSources.UserDataSources.Item("EmpId").Value = rs.fields("EmpId").Value

myForm.DataSources.UserDataSources.Item("EmpName").Value = rs.fields("EmpName").Value

myForm.DataSources.UserDataSources.Item("Message").Value = rs.fields("Message").Value

myForm.DataSources.UserDataSources.Item("MessRead").Value = rs.fields("MessRead").Value

myForm.DataSources.UserDataSources.Item("MainPart").Value = rs.fields("MainPart").Value

myForm.DataSources.UserDataSources.Item("StartDt").Value = rs.fields("StartDt").Value

myForm.DataSources.UserDataSources.Item("StartHr").Value = rs.fields("StartHr").Value

myForm.DataSources.UserDataSources.Item("FinishDt").Value = rs.fields("FinishDt").Value

myForm.DataSources.UserDataSources.Item("FinishHr").Value = rs.fields("FinishHr").Value

myForm.DataSources.UserDataSources.Item("Finished").Value = rs.fields("Finished").Value




oMatrix.SelectionMode = ms_Auto

End Sub

I will apreciate all king of help

Thanks in advance.

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Nov 26, 2004 at 11:01 AM

    You have a property of the form which allows you to change the mode

    myForm.Mode = fm_ADD_MODE

    myForm.Mode = fm_EDIT_MODE

    myForm.Mode = fm_VIEWMODE_MODE


    You may change it after you modify you matrix data to fm_VIEWMODE_MODE and I guess you won't have the system question again.


    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.