on 03-01-2005 5:03 PM
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 dont want my users to enter this manually.
thanks a lot for your help,
Regards,
Alex
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
<b>a simple formatted search is enough.</b>
I am not sure whether formatted search is going to be good for that as the idea is to generate new ID once form is open in ADD mode.
<b>
Instead of the Form UID, have you looked at form-type property (Use TypeEx in version 2004/6.7)</b>
Unfortunately our current version is 6.5 and the only choices I have are Form ID (changes every time I open a new instance of the form), Item Num,Row,Col, Menu UID (not relevant for form)
<b> 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</b>
Thanks I will try this one.
Does anyone uses C#? I find a lot of information for VB but not C#.
thanks to all
I use C#.... Its a hard world among all these VB programmers
The code-structure given to you of cause also work in C#
if(pVal.FormType = 150 && pVal.Eventtype=BoItemEventTypes.et_FORM_LOAD && pVal.before_action) {
//Do something
}
I recomend you make some helper-methods on the fly so development time in time can be reduced
> I use C#.... Its a hard world among all these VB
> programmers
I'd be glad not to work with VB6. But I'm an employee, VB6 is the decision (probably because there are a lot of samples for it;) for developing SBO-SDK-stuff.
And after all: Sometimes I wonder how good the VB6-Debugger actually is, regardless of his age...
<b>I use C#.... Its a hard world among all these VB programmers :-)</b>
I'll stick with you than
<b>I'm in the process of making the same as you need to do(Idea stage), but I will post something if I manage to do it</b>
My vision is to create a new-empty item master form whenever user hits ADD Menu button (or Ctr+A) using DI API and than open it in EDIT mode. This how we eliminate errors of using same ID in mulituser enviroment. If user decides to abandon without entering any data by using Cancel button, we just delete this record via DI API. In my situation its more convenient to generate IDs automatically.
What do you think?
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)...
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
99 | |
11 | |
11 | |
6 | |
6 | |
4 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.