cancel
Showing results for 
Search instead for 
Did you mean: 

How do I get the Sales Order FormUID from the Sales Order UDF form?

Former Member
0 Kudos

Basically, using the UI-API, I'm capturing the events for the Sales Order UDF form (-139), but I need to interact with the Sales Order form that it's attached to. How do I know the UID of the Sales Order form that goes with the UDF form that is known??

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Bryan..

here you have some links to threads here in the forum

hopeithelps

Matthias

Former Member
0 Kudos

Thanks, Matthias. What I'm gathering from the forums is that even though SAP seems to be connecting the SO form and its UDF form somehow, it doesn't provide this linkage to the API. So it's no procedurally possible to link the SO and UDF forms together. Instead, you have to use events and just "hope" that it's capturing the right one.

I did come up with the solution below, and it's the same as suggested in one of the forums. I've also used this same technique for other similar issues as well, such as figuring out which form was the opener of another form.

Since the main system form is always activated when you click within the UDF, on the "activate" event for the main form, I'm immediately copying a reference to the form in a global variable (LastForm):

If Not pVal.BeforeAction And (pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_ACTIVATE Or pVal.EventType = SAPbouiCOM.BoEventTypes.et_FORM_LOAD) Then

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If FormType > 0 And FormType < 200 Then

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;LastForm = SBO_Application.Forms.Item(FormUID)

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;end if

end if

Since I'm checking for the formtype to be >0, it doesn't track the UDF forms, only the main forms.

Then in the UDF form, I can retrieve its main form with LastForm.

Former Member
0 Kudos

hey sounds good..may one of the ways SAP programmers have to go

Matthias

Answers (3)

Answers (3)

Former Member
0 Kudos

hi Bryan,

u can do it easily by getform() method.

just write the statement

Set oForm = oApplication.Forms.GetForm(139, 1)

now form object oForm is representing the sales order form in ur UDF.

hope u will get idea.

ifsatisfied, rewards points

regards

nirdesh panwar

Former Member
0 Kudos

Nirdesh, I hope you haven't been using this code below. That only retrieves the first SO form that is open. Open 2 at the same time and see what happens.

> hi Bryan,

>

> u can do it easily by getform() method.

> just write the statement

> Set oForm = oApplication.Forms.GetForm(139, 1)

Former Member
0 Kudos

Hi Bryan,

If you want to add UDF in Sales Order using UI API,

oForm=app.Forms.FormType("139",1)

oItem=oForm.Items.Add("Label1",STATIC_TEXT)

oItem.Top=xx

oItem.Width=xx

oItem.Height=xx

oItem.Left=xx

oLabel=oItem.Specific

oLabel.Caption="Sample Text"

Hope this will be help for you and give me reward points,

Regards,

G.Suresh

Former Member
0 Kudos

Bryan,

UID will differ at each time. I think u want to add some fields in the SalesOrder? If so reply me i help u

Regards,

Anitha