cancel
Showing results for 
Search instead for 
Did you mean: 

Determine MM tab by NAME rather than tab NUMBER?

0 Kudos

For anyone out there that has done work to automate material master data entry, you run up to the issue with the views potentially being different from material to material dependent upon how the material was initially created.  One material may have been created without the Forecasting tab activated, whereas other have been activated.  The tab can be selected like this:

session.findById("wnd[0]/usr/tabsTABSPR1/tabpSP22").select

However, that selection criteria may be incorrect dependent upon load characteristics.  That selection may be the Work Scheduling Tab, Warehouse view, etc.

Does anyone know of a good way to either make a tab/view selection via script while within the material master or make a default selection from the "select views" button based upon tab text name rather than the tab number?

Note:  Our company does not allow for access within the tables.  I'm restricted away from SE16, SE16N, SE17 and similar based on home office policy.

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_brutigam2
Active Participant
0 Kudos

Hi Ehren,

you can try the following:


Public Sub SelectTab(ByVal Suchtab As String)

        With SapSession

            For i = 1 To 50 'Sorry but there is no Count-Property

                If i <= 9 Then

                    TabIndex = "0" & CStr(i)

                Else

                    TabIndex = CStr(i)

                End If

                On Error Resume Next

                Debug.Print "tabpSP" & TabIndex & "|" & .FindById("wnd[0]/usr/tabsTABSPR1/tabpSP" & TabIndex & "").Text

                If Err.Number = 0 Then

                If Trim(.FindById("wnd[0]/usr/tabsTABSPR1/tabpSP" & TabIndex & "").Text) = Suchtab Then

                    .FindById("wnd[0]/usr/tabsTABSPR1/tabpSP" & TabIndex & "").Select

                Exit For

                End If

                Err.Clear

                End If

            On Error GoTo 0

            Next i

        End With

End Sub