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

getting the Form ID in UI API

Hi everyone,

I will appreciate if you can help me with the following:

1)

What is the correct way of getting the Form ID in UI API? Every time I open new Item Master Data Form the event monitor shows new ID number (i.e. F_42, F_44, etc..). How to catch event which occurs when a new <b>Item Master Data Form is open in “Add” mode</b>.

2)

Does anyone knows how to implement “auto increment” for Item Number field (Item Master Data Form), in other words, every time user enters a new record we perform max(Code) and increment it by 1. I don’t want my users to enter this manually.

thanks a lot for your help,

Regards,

Alex

Add a comment
10|10000 characters needed characters exceeded

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2005 at 01:19 AM

    For 2), a simple formatted search is enough. Try to search the forum or the SAP community and you will find the answer.

    Basically what you should do:

    DECLARE @MAX AS INTEGER

    SET @MAX=(SELECT MAX(CardCode)+1 FROM OCRD WHERE CardType='C')

    SELECT @MAX

    I did not try this auery but I think it will help you to understand the concept.

    Cheers,

    Vincent

    Add a comment
    10|10000 characters needed characters exceeded

    • What I have planned to do works in the same way as SAP does.

      When you switch to add mode I will read the largest code and display code++ (In mulituser system all persons in the the process of adding an item will get this number).

      When add is pressed I will start a transaction, make the check for largest code once more. if the code from this result I will use this, and inform the user that his item was added, but with a different number that was displayed (Like SAP do it with documents)...

  • Posted on Mar 02, 2005 at 07:07 AM

    1) Instead of the Form UID, have you looked at form-type property (Use TypeEx in version 2004/6.7). Use this if you need to catch an event on every form of the same type. ... The add-mode can be checked for by the forms Mode property

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Mar 02, 2005 at 08:18 AM
        Dim objForm As SAPbouiCOM.Form
        
        /* 6.5, Deprecated in 6.7 */
        If pVal.FormType = 150 Then
            If pVal.EventType = et_FORM_LOAD And Not pVal.BeforeAction Then
                /* Here's your Item Master Data Form, opened in ADD-Mode */
                Set objForm = SBO_Application.Forms(pVal.FormUID)
            End If
        End If
        
        /* 6.7 */
        If pVal.FormTypeEx = "150" Then
            If pVal.EventType = et_FORM_LOAD And Not pVal.BeforeAction Then
                /* Here's your Item Master Data Form, opened in ADD-Mode */
                Set objForm = SBO_Application.Forms(pVal.FormUID)
            End If
        End If
    
    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.