cancel
Showing results for 
Search instead for 
Did you mean: 

Some info about form exists

Former Member
0 Kudos

HI..

i had a matrix..

it has some values  on the first column so

i want to copy all these values into the sales order one of the column.

so i used oform.getformtypecount

used for loop

so first matrix suppose contain 10 rows ..

ten times the sales order form is loading

i don't want to load the onece the form is exist..

so , i had used the below bold color code

this code is working in previous program present not working ..

may i know why..

how can  i know the form is exist or not

if open i dont' want to activate it

how can i solve this one.......................

  Try

   

            If (pVal.BeforeAction = True And pVal.FormUID = "TT" And pVal.EventType = SAPbouiCOM.BoEventTypes.et_COMBO_SELECT) Then

                Dim obcb As SAPbouiCOM.ButtonCombo

                obcb = oform.Items.Item("122").Specific

                Dim ic As String

                'oform = sbo_app.Forms.Item("TT")

                'omatrix = oform.Items.Item("9").Specific

                For i = 1 To omatrix.VisualRowCount

                    oform = sbo_app.Forms.Item("TT")

                    omatrix = oform.Items.Item("9").Specific

                    ic = omatrix.Columns.Item("V_1").Cells.Item(i).Specific.value

                   Dim x As Integer

                    Dim foundG As Boolean = False

                    For x = 0 To sbo_app.Forms.Count - 1

                        If sbo_app.Forms.Item(x).UniqueID = "139" Then

                            foundG = True

                            Exit For

                        End If

                    Next

                    If foundG = True Then

                        sbo_app.Forms.Item("139").Select()

                    Else

                        sbo_app.ActivateMenuItem("2050")

                        oform = sbo_app.Forms.GetFormByTypeAndCount("139", "1")

                    End If

                    Dim orec As SAPbobsCOM.Recordset

                    orec = ocompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.BoRecordset)

                    orec.DoQuery("select   t0.cardcode,t0.cardname from ocrd t0 where t0.cardcode='ap01001'")

                    oform.Items.Item("4").Specific.value = orec.Fields.Item(0).Value

                    oform.Items.Item("54").Specific.value = orec.Fields.Item(1).Value

                    omatrix = oform.Items.Item("38").Specific

                    omatrix.Columns.Item("1").Cells.Item(i).Specific.value = ic

                    omatrix.AddRow(1)

                Next

            End If

                 Catch ex As Exception

            sbo_app.MessageBox(ex.Message)

        End Try

Accepted Solutions (0)

Answers (1)

Answers (1)

Nussi
Active Contributor
0 Kudos

Hi,

it's simply - you are checking if a standard sap form exists - in that case use oForm.TypeEx instead of UniqueId.

If sbo_app.Forms.Item(x).TypeEx = "139" Then

lg David

Former Member
0 Kudos

hi...........

I Changed type x instead of uniid but still all so i am not getting

form not found is comming

Nussi
Active Contributor
0 Kudos

Hi,

yes, because there's a second mistake -> sbo_app.Forms.Item("139").Select()

you are mixing UniquedId and FormType.

save the found unique id in a temp variable.

use the variable to get the form

                     For x = 0 To sbo_app.Forms.Count - 1

                        If sbo_app.Forms.Item(x).TypeEx = "139" Then

                             tempstring = sbo_app.Forms.Item(x).UniqueID;

                            foundG = True

                            Exit For

                        End If

                    Next

                    If foundG = True Then

                         sbo_app.Forms.Item(tempstring).Select()

lg David