Skip to Content
avatar image
Former Member

Copy fields when form is saved

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.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Best Answer
    avatar image
    Former Member
    Sep 24, 2008 at 08:02 AM

    I guess that should work fine.. are u getting any errors..??

    Vasu Natari.

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member
      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!

  • Sep 24, 2008 at 08:08 AM

    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

    Add comment
    10|10000 characters needed characters exceeded

    • Former Member

      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"

  • avatar image
    Former Member
    Sep 24, 2008 at 08:36 AM

    Hi,

    Try pVal.BeforeAction = True instead of pVal.Before_Action = True

    Hope it helps,

    Vasu Natari.

    Add comment
    10|10000 characters needed characters exceeded