Dynamic programming in VB

Posted by Rahul Jain on Stack Overflow See other posts from Stack Overflow or by Rahul Jain
Published on 2010-04-02T12:06:33Z Indexed on 2010/04/02 12:13 UTC
Read the original article Hit count: 514

Filed under:
|

Hello Everybody,

We develop applications for SAP using their SDK. SAP provides a SDK for changing and handling events occuring in the user interface.

For example, with this SDK we can catch a click on a button and do something on the click. This programming can be done either VB or C#.

This can also be used to create new fields on the pre-existing form. We have developed a specific application which allows users to store the definition required for new field in a database table and the fields are created at the run time.

So far, this is good. What we require now is that the user should be able to store the validation code for the field in the database and the same should be executed on the run time.

Following is an example of such an event:

Private Sub SBO_Application_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles SBO_Application.ItemEvent
    Dim oForm As SAPbouiCOM.Form
    If pVal.FormTypeEx = "ACC_QPLAN" Then
        If pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOST_FOCUS And pVal.BeforeAction = False Then
            oProdRec.ItemPressEvent(pVal)
        End If
    End If
End Sub

Public Sub ItemPressEvent(ByRef pVal As SAPbouiCOM.ItemEvent)
    Dim oForm As SAPbouiCOM.Form

    oForm = oSuyash.SBO_Application.Forms.GetForm(pVal.FormTypeEx, pVal.FormTypeCount)
    If pVal.EventType = SAPbouiCOM.BoEventTypes.et_LOST_FOCUS And pVal.BeforeAction = False Then
        If pVal.ItemUID = "AC_TXT5" Then
            Dim CardCode, ItemCode As String

            ItemCode = oForm.Items.Item("AC_TXT2").Specific.Value
            CardCode = oForm.Items.Item("AC_TXT0").Specific.Value

            UpdateQty(oForm, CardCode, ItemCode)
        End If
    End If
End Sub

So, what we need in this case is to store the code given in the ItemPressEvent in a database, and execute this in runtime.

I know this is not straight forward thing. But I presume there must be some ways of getting these kind of things done.

The SDK is made up of COM components.

Thanks & Regards, Rahul Jain

© Stack Overflow or respective owner

Related posts about vb.net

Related posts about dynamic