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

Find & Add mode change for System forms

A very big prospect requires the following functionality:

- All system (marketing and master data) forms need to default to Find mode when you open the window.

- If the data does not exist, the window automatically changes to Add mode.

- Once the data has been added to the system, the window needs to change back to Find mode automatically.

- When doing a 'find' the user does not want to add a '' to the field when doing a search. For example, if I am in the BP master data window and I want to find 'Sally', the user only wants to input 'Sal' to bring up the choose from list. The user does not want to put 'Sal'.

I am aware that there are limitations with System forms. Is there any way we change achieve the above?

Your help is greatly appreciated!

Regards

Sally Kingston

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 Oct 18, 2005 at 06:49 AM

    Hi Sally,

    Please refer to the following answers for your questions.

    (All the code are based on the form "SalesOrder")

    1. All system (marketing and master data) forms need to default to Find mode when you open the window.

    Generally speaking, you can do formmode changes(to "OK" mode) in the event Form_Load. But it's impossible to change it to "Find" mode for some forms, say "Sales Order". However, we have some work around here -- catch both the Form_Load and Form_Activate event, and change the formmode in Form_Activate. Check out the code below.

        Case et_FORM_LOAD
            Set form = m_oApplication.Forms.Item(FormUid)
            If form.type = 139 And pVal.BeforeAction = True Then
                bSignal = True
            End If
        Case et_FORM_ACTIVATE
            Set form = m_oApplication.Forms.Item(FormUid)
            If form.type = 139 And form.Mode <> fm_FIND_MODE And pVal.BeforeAction = False And bSignal = True Then
                form.Mode = fm_FIND_MODE
                bSignal = False
                form.ActiveItem = 4

    2.If the data does not exist, the window automatically changes to Add mode.

    I suppose the request is from selecting a BP code in "SalesOrder" form. Then what you need to catch is Item_Press event for "Find" button. You need to check if the data exists in database, if not change the form mode. Please check out the sample code below.

    Case et_ITEM_PRESSED
            Set form = m_oApplication.Forms.Item(FormUid)
            If pVal.ItemUID = 1 And form.type = 139 And form.Mode = fm_FIND_MODE And pVal.BeforeAction = False Then
                 'Search in the database, to check the existance of the data
                 form.Mode = fm_ADD_MODE
            End If

    3.Once the data has been added to the system, the window needs to change back to Find mode automatically.

    In this case, you need to catch the Item_Press event for "Add" button. And please pay attention, only change the formmode when ActionSuccess is TRUE. Please refer to the sample code below.

    Case et_ITEM_PRESSED
    If pVal.ItemUID = 1 And form.type = 139 And form.Mode = fm_ADD_MODE And pVal.ActionSuccess = True Then
                form.Mode = fm_FIND_MODE
            End If

    4.When doing a 'find' the user does not want to add a '' to the field when doing a search. For example, if I am in the BP master data window and I want to find 'Sally', the user only wants to input 'Sal' to bring up the choose from list. The user does not want to put 'Sal'.

    What you need to do is to catch the Tab press event and Item press event. Add a "*" to the end of the string, and set BubbleEvent to false. The sample code below is for pressing Tab, please do the same for Item Press.

     Case et_KEY_DOWN
            Set form = m_oApplication.Forms.Item(FormUid)
            If pVal.CharPressed = 9 And pVal.ItemUID = 4 And form.type = 139 And form.Mode = fm_ADD_MODE And pVal.BeforeAction = True Then
                Dim oEditText As SAPbouiCOM.EditText
                BubbleEvent = False
                Set oEditText = form.Items("4").Specific
                oEditText.String = oEditText.String + "*"
                
            End If

    Any more questions, feel free to let me know.

    Thanks,

    Nick He

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 14, 2005 at 06:20 AM

    What about adding handler to those forms

    on pVal.EventType = et_FORM_LOAD

    set the form.mode to fm_FIND_MODE

    and when pressing the Find mode button, check the values by which you're performing search, if the last char in the field is not a *, then add it...

    and to that add-mode ... you may also perform manual search for the BP/whatever in the SQL, and when no data will be returned, automaticaly set form.mode to fm_ADD_MODE

    and when in fm_ADD_MODE, while pressing the Add button, check also for pVal.ActionSuccess = True, and thereafter, set form.mode to fm_FIND_MODE

    Add handlers to all forms where your customer requires it...

    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.