on 10-06-2008 4:05 AM
Hi all,
I have a scenario :
In the module HR -> Employee Master Data, I want to add a text field (That textfield is equal to a new field in OHEM Table)and binding data from OHEM table for that text field.
This code is:
Public Sub ItemEvenHanlderEmployee(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, _
ByRef BubbleEvent As Boolean) Handles oApp.ItemEvent
If "60100" = pVal.FormType And pVal.Before_Action = False Then
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then
Dim oItem As SAPbouiCOM.Item = Nothing
Dim oForm As SAPbouiCOM.Form = oApp.Forms.Item(FormUID)
Dim oItems As SAPbouiCOM.Items = oForm.Items
'oItem = oForm.Items.Add("Ami_Snd", SAPbouiCOM.BoFormItemTypes.it_BUTTON)
oItem = oForm.Items.Add("Emp_No", SAPbouiCOM.BoFormItemTypes.it_EDIT) 'Add(Textfields)
oItem.Top = oItems.Item("1").Top
oItem.Left = oItems.Item("2").Left + oItems.Item("2").Width + 10
oItem.Width = 70
oItem.Height = 14
'Dim sndButton As SAPbouiCOM.Button = oItem.Specific
Dim sndButton1 As SAPbouiCOM.Cell = oItem.Specific 'Add TextFields
' Binding data
Dim oDS As SAPbouiCOM.DBDataSource
oDS = oApp.Forms.Item(FormUID).DataSources.DBDataSources.Item("OHEM")
End If
End If
End Sub
Plz tell me detail steps so I can add a text field and binding data from OHEM.
Many thks !
hi,
oEdit.DataBind.SetBound(True, "OHEM", "UserField")
mention user field as your table field name which starts with U_
regards,
varma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Varma,
thks for help, i completed to add textbox on Employee Master Data
Plz test help me this code, I cant add textbox in Inventory->Item Master Data (I want to add textbox and label nearly ItemNo):
Public Sub AddInventory(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, _
ByRef BubbleEvent As Boolean) Handles oApp.ItemEvent
SetApplication()
Dim oItem As SAPbouiCOM.Item
Dim oItem1 As SAPbouiCOM.Item
Dim oForm As SAPbouiCOM.Form = oApp.Forms.Item(pVal.FormUID)
Dim oStatic As SAPbouiCOM.StaticText
Dim oEdit As SAPbouiCOM.EditText
If pVal.FormType = "150" And pVal.BeforeAction = False And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then
Try
oForm = oApp.Forms.Item(pVal.FormUID)
oItem = oForm.Items.Item("24")
oItem1 = oForm.Items.Add("Desc", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem1.Left = oItem.Left
oItem1.Width = oItem.Width
oItem1.Top = oItem.Top + oItem.Height + 2
oItem1.Height = oItem.Height
oItem1.LinkTo = "24"
oItem1.Visible = True
oEdit = oItem1.Specific
oEdit.DataBind.SetBound(True, "OITM", "U_Desc")
oItem = oForm.Items.Item("25")
oItem1 = oForm.Items.Add("lblDesc", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem1.Left = oItem.Left
oItem1.Width = oItem.Width
oItem1.Top = oItem.Top + oItem.Height + 2
oItem1.Height = oItem.Height
oItem1.LinkTo = "txtDesc"
oItem1.Visible = True
oStatic = oItem1.Specific
oStatic.Caption = "Description"
Catch ex As Exception
oApp.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
End Try
End If
End Sub
Thks !
hi,
use oForm instead of oFormIMD.
where i used as formtype
regards,
varma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Varma,
I try to test program, but it's not add textfiel and label on Employee Master Data
This code:
Public Sub Add_Bind(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, _
ByRef BubbleEvent As Boolean) Handles oApp.ItemEvent
Dim oItem As SAPbouiCOM.Item
Dim oItem1 As SAPbouiCOM.Item
Dim oForm As SAPbouiCOM.Form = oApp.Forms.Item(pVal.FormUID)
Dim oStatic As SAPbouiCOM.StaticText
Dim oEdit As SAPbouiCOM.EditText
If pVal.FormType = "60100" And pVal.BeforeAction = False And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then
Try
oForm = oApp.Forms.Item(pVal.FormUID)
oItem = oForm.Items.Item("33")
oItem1 = oForm.Items.Add("txtEmpNo", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oItem1.Left = oItem.Left
oItem1.Width = oItem.Width
oItem1.Top = oItem.Top + oItem.Height + 5
oItem1.Height = oItem.Height
oItem1.LinkTo = "33"
oItem1.Visible = True
oEdit = oItem1.Specific
oEdit.DataBind.SetBound(True, "OHEM", "UserField")
oItem = oForm.Items.Item("3")
oItem1 = oForm.Items.Add("lblEmpNo", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oItem1.Left = oItem.Left
oItem1.Width = oItem.Width
oItem1.Top = oItem.Top + oItem.Height + 1
oItem1.Height = oItem.Height
oItem1.LinkTo = "txtEmpNo"
oItem1.Visible = True
oStatic = oItem1.Specific
oStatic.Caption = "UserLabel_Name"
Catch ex As Exception
oApp.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
End Try
End If
End Sub
Plz test to help me !
Thks !
hi,
If pVal.FormType = "60100" And pVal.BeforeAction = False And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then
Try
Dim oitem As SAPbouiCOM.Item
Dim oitem1 As SAPbouiCOM.Item
Dim oedit As SAPbouiCOM.EditText
Dim oStatic As SAPbouiCOM.StaticText
Dim oForm As SAPbouiCOM.Form
oForm = SBO_Application.Forms.Item(pVal.FormUID)
oitem = oForm.Items.Item("33")
oitem1 = oForm.Items.Add("yyyyy", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oitem1.Left = oitem.Left
oitem1.Width = oitem.Width
oitem1.Top = oitem.Top + oitem.Height + 1
oitem1.Height = oitem.Height
oitem1.LinkTo = "33"
oitem1.Visible = True
oedit = oitem1.Specific
oedit.DataBind.SetBound(True, "OHEM", "UserField")
oitem = oFormIMD.Items.Item("3")
oitem1 = oFormIMD.Items.Add("xxxxx", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oitem1.Left = oitem.Left
oitem1.Width = oitem.Width
oitem1.Top = oitem.Top + oitem.Height + 1
oitem1.Height = oitem.Height
oitem1.LinkTo = "yyyyy"
oitem1.Visible = True
oStatic = oitem1.Specific
oStatic.Caption = "UserLabel_Name"
Catch ex As Exception
SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
End Try
End If
regards,
varma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
Just create text and label and bind text field to table field thats it every thing sap takes care in adding.
user field name in the OHEM table which you have been created.
i.e,
If pVal.FormType = "60100" And pVal.BeforeAction = False And pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD Then
Try
oFormIMD = SBO_Application.Forms.Item(pVal.FormUID)
oitem = oForm.Items.Item("33")
oitem1 = oForm.Items.Add("yyyyy", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oitem1.Left = oitem.Left
oitem1.Width = oitem.Width
oitem1.Top = oitem.Top + oitem.Height + 1
oitem1.Height = oitem.Height
oitem1.LinkTo = "33"
oitem1.Visible = True
oedit = oitem1.Specific
oedit.DataBind.SetBound(True, "OHEM", "UserField")
oitem = oFormIMD.Items.Item("3")
oitem1 = oFormIMD.Items.Add("xxxxx", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oitem1.Left = oitem.Left
oitem1.Width = oitem.Width
oitem1.Top = oitem.Top + oitem.Height + 1
oitem1.Height = oitem.Height
oitem1.LinkTo = "yyyyy"
oitem1.Visible = True
oStatic = oitem1.Specific
oStatic.Caption = "UserLabel"
Catch ex As Exception
SBO_Application.StatusBar.SetText(ex.Message, SAPbouiCOM.BoMessageTime.bmt_Short, SAPbouiCOM.BoStatusBarMessageType.smt_Error)
End Try
End If
regards,
varma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
in Employee master data form load event you have to include the above code which creates one EditText and statictext(Label).
in Employee master data you can observe '33' is the itemuid of Employee.No EditText and '3' is the itemuid of Employee.No StaticText.
First i am creating user EditText with ItemUID 'yyyyy' below item'33' and static text 'xxxxx' below item'3'
where 'yyyyy' field is binded to the field of table OHEM.
this helps to create user fields in the system form.
if not clear tell me scenario what are all the fields to be in cluded in the form and where(means where do you wnt to locate those fields in that form).
regards,
varma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi,
oitem = oForm.Items.Item("33")
oitem1 = oForm.Items.Add("yyyyy", SAPbouiCOM.BoFormItemTypes.it_EDIT)
oitem1.Left = oitem.Left
oitem1.Width = oitem.Width
oitem1.Top = oitem.Top + oitem.Height + 1
oitem1.Height = oitem.Height
oitem1.LinkTo = "33"
oitem1.Visible = True
oedit = oitem1.Specific
oedit.DataBind.SetBound(True, "OHEM", "UserField")
oitem = oFormIMD.Items.Item("3")
oitem1 = oFormIMD.Items.Add("xxxxx", SAPbouiCOM.BoFormItemTypes.it_STATIC)
oitem1.Left = oitem.Left
oitem1.Width = oitem.Width
oitem1.Top = oitem.Top + oitem.Height + 1
oitem1.Height = oitem.Height
oitem1.LinkTo = "yyyyy"
oitem1.Visible = True
oStatic = oitem1.Specific
oStatic.Caption = "UserLabel"
where 33 is the existing itemUID of employee.No text in the form and yyyyy is user itemUID which you are going to use.
regards,
varma
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
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.