on 2008 Sep 24 8:45 AM
Very simple one,
When I add a new sales quote I want the Total Value edit box to be copied to my Expected Value edit box, as the data is not added to the table yet I thought it would all be available as stings in the edit boxes, hence the following:
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD And pVal.FormType = 149 And pVal.Before_Action = True Then
oApp.Forms.Item("149").Items.Item("oEdit4").String = oApp.Forms.Item("149").Items.Item("29").String
End If
Please excuse any stupidity, its a steep learning curve......
Thanks,
Dave.
Request clarification before answering.
I guess that should work fine.. are u getting any errors..??
Vasu Natari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD And pVal.FormType = 149 And pVal.BeforeAction = True Then
Dim oform2 As SAPbouiCOM.Form
oform2 = oApp.Forms.GetForm("149", 1)
oApp.Forms.Item(oform2).Items.Item("oEdit4").String = oApp.Forms.Item(oform2).Items.Item("29").String
End If
Bit of everything involved now.....
And still nothing, I apreciate the help though!!!
Hi,
a correct sample:
.
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD And pVal.FormType = 149 And pVal.BeforeAction = True Then
Dim oform2 As SAPbouiCOM.Form
oform2 = oApp.Forms.ActiveForm
oform2.Items.Item("oEdit4").String = oform2.Items.Item("29").String
end if
you're accessing the oform2 object wrong
lg David
Ah yes the paniced test, If i back up the code a little:
Private Sub oApp_ItemEvent(ByVal FormUID As String, ByRef pVal As SAPbouiCOM.ItemEvent, ByRef BubbleEvent As Boolean) Handles oApp.ItemEvent
Try
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD And pVal.FormType = 149 And pVal.BeforeAction = True Then
Dim oform2 As SAPbouiCOM.Form
oform2 = oApp.Forms.ActiveForm
oform2.Items.Item("oEdit4").String = oform2.Items.Item("29").String
End If
Catch ex As Exception
oApp.MessageBox(ex.ToString)
End Try
End Sub
This is the extent of the subroutine, and I still get nothing.
My main problem is that due to time constaints I'm panicing and copying rather than thinking about it.....
David,
i think you are catching wrong event altogether,
try this.
If BusinessObjectInfo.FormTypeEx = "149" And BusinessObjectInfo.BeforeAction = True And BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD Then
Try
Dim oform2 As SAPbouiCOM.Form
oform2 = oApp.Forms.GetForm("149", 1)
'MsgBox(oform2.Items.Item("29").Specific.value)
oform2.Items.Item("oEdit4").Specific.value = oform2.Items.Item("29").Specific.value
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
and this is under FormDataEvent. NOT Itemevent.
Binita
Edited by: Binita Joshi on Sep 24, 2008 11:20 AM
Private Sub oApplication_FormDataEvent(ByRef BusinessObjectInfo As SAPbouiCOM.BusinessObjectInfo, _
ByRef BubbleEvent As Boolean) Handles oApp.FormDataEvent
If BusinessObjectInfo.FormTypeEx = "149" And BusinessObjectInfo.BeforeAction = True And BusinessObjectInfo.EventType = SAPbouiCOM.BoEventTypes.et_FORM_DATA_ADD Then
Try
Dim oform2 As SAPbouiCOM.Form
oform2 = oApp.Forms.GetForm("149", 1)
MsgBox(oform2.Items.Item("29").Specific.value)
oform2.Items.Item("oEdit4").Specific.value = oform2.Items.Item("29").Specific.value
Catch ex As Exception
MsgBox(ex.Message)
End Try
End If
End Sub
ahhhhhhhhh, genious, that msg box is firing, just getting bad value message now, but i can work through that.....
Thankyou very much!
Hi,
Try pVal.BeforeAction = True instead of pVal.Before_Action = True
Hope it helps,
Vasu Natari.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David
in your ItemEvent Handler you should have a variable called FormUID or at least pVal.FormUID
so access it with:
oApp.Forms.Item(FormUID).Items.Item("oEdit4").String = oApp.Forms.Item(FormUID).Items.Item("29").String
lg David
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi David,
I have tried you suggestion so with the Form_Data_Add event handler on FormUID rather than FormType, Now when I run the program SAP makes a quick exit from my PC.....
I undertstand that FORMUID make alot of sense but FORMTYPE was in all my examples and formtype works with the FORMLOAD event handler.
Theres alot of things that don't make sense and alot of the object definitions are "Undefined"
User | Count |
---|---|
96 | |
39 | |
8 | |
5 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.