Skip to Content
author's profile photo Former Member
Former Member

how to get the form

Hi,

I want to open a form which is in tool->user table->XX. Its uid is 11014. But when I use App.ActivateMenuItem("11014"), I can't get the form, whereas I can open other system forms using this function.

How can I open this form?

Thank you!

chao

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jun 18, 2006 at 12:46 PM

    I am sorry, Andrew. But I am not very clear about your code. I am a C# programmer. I change your code to the following one:

    SAPbouiCOM.Application sa

    sa.ActivateMenuItem(findMenuitem(connect.sboapp, "事务日记帐报表"));

    public string findMenuitem(SAPbouiCOM.Application sa, string menuname)

    {

    int vi = 0;

    bool vfind = false;

    while(!vfind)

    {

    if(sa.Menus.Item(vi).ToString() == menuname)

    {

    vfind = true;

    return sa.Menus.Item(vi).UID;

    }

    else

    {

    vi = vi + 1;

    }

    }

    return null;

    }

    actually, it returns nothing.

    Can you give me more details? I am a fresh here.

    Thank you very much

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jun 12, 2006 at 05:05 AM

    Hi chao,

    It seems quite clear that you are using a form uid 11014.

    You should use the menu uid instead of the form uid.

    Try this and it will work :

            If (pVal.MenuUID = "CADMEN_F1") And (pVal.BeforeAction = False) Then
    
                '//*************************************************************
                '// Create a form to be launched in response to a click on the 
                '// new sub menu item
                '//*************************************************************
    
                Usertableprepare(SBO_Application)
    
                If Not bNEWUSERTABLE Then
                    SBO_Application.ActivateMenuItem(Findmenuitem(SBO_Application, "CADMEN_WORKCENTER - 工作中心檔"))
                End If
    
            End If
    
        Private Function Findmenuitem(ByRef SBO_Application As SAPbouiCOM.Application, ByRef menuname As String) As String
    
            Dim vi As Integer
    
            Dim vfind As Boolean
    
            vfind = False
    
            vi = 51200
    
            While Not vfind
    
                Try
                    oMenuItem = SBO_Application.Menus.Item(CStr(vi)) 'moudles'
    
                    If oMenuItem.String = menuname Then
    
                        vfind = True
    
                    End If
    
                    vi = vi + 1
    
                Catch
    
                    vi = vi + 1
    
                End Try
    
            End While
    
            Findmenuitem = oMenuItem.UID
    
        End Function
    
    

    HTH

    Andrew Chu

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.