cancel
Showing results for 
Search instead for 
Did you mean: 

clearing combobox in UDO header

Former Member
0 Kudos

Hi all,

I'd like to post this strange behaviour happening inside a user defined form for UDO processing.

i have the following code to clear each combobox in the UDO header:

cmbBPCode.get_ValidValues().Add("0", " ");

cmbBPCode.Select(" ", SAPbouiCOM.BoSearchKey.psk_ByDescription);

cmbBPCode.get_ValidValues().Remove(" ", SAPbouiCOM.BoSearchKey.psk_ByDescription);

cmbStatus.get_ValidValues().Add("0", " ");

cmbStatus.Select(" ", SAPbouiCOM.BoSearchKey.psk_ByDescription);

cmbStatus.get_ValidValues().Remove(" ", SAPbouiCOM.BoSearchKey.psk_ByDescription);

SAPbouiCOM.Form oForm = SBO_Application.get_Forms().get_ActiveForm();

SAPbouiCOM.Item oItem = oForm.get_Items().Item("txtCode");

oItem.set_DisplayDesc(true);

oItem = oForm.get_Items().Item("cmbStat");

oItem.set_DisplayDesc(true);

oForm.Refresh();

oForm.Update();

I need to do that beacuse after adding data into UDO tables, the combobox still holds the previous value.

In other words i got all the form fields cleared except for the combobox in the UDO header.

The above code solved the problem but shows the 0 value rather than the blank description in the combobox!

Is it the only way to do that?

Can anyone help me?

BR

Andrea

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

i solved using the following code:

oForm.Close();

DrawForm(); // load the form xml file

Andrea

Nussi
Active Contributor
0 Kudos

Andrea,

that's what i meant.

load the xml file with the changed description

or do you know always close it and reopen ? thats not what i meant

lg David

Edited by: David Nussböck on Sep 10, 2008 2:48 PM

Former Member
0 Kudos

David,

simple close and re-open the form each time i add to UDO tables.

Andrea

Nussi
Active Contributor
0 Kudos

Hi Andrea,

i think i got the problem now

you use

oItem.set_DisplayDesc(true);

after you set the value.

do the following

when you load the UDO from a xml be sure that you set DisplayDesc already in screen painter

or set it when you load the xml in et_Form_load event.

that should do it ... i pray

lg David

Former Member
0 Kudos

David,

In the form xml file the DisplayDesc attribute is set to false as i want.

I'll try to set it to true in the et_Form_load event.

For sure I'll let you know the result.

thx

BR

Andrea

Former Member
0 Kudos

David,

here is my code:

if (pVal.get_EventType() == SAPbouiCOM.BoEventTypes.et_FORM_LOAD && pVal.get_Before_Action() == false)

{

SAPbouiCOM.Form oForm = SBO_Application.get_Forms().Item(FormUID);

SAPbouiCOM.Item oItem = oForm.get_Items().Item("txtCode");

oItem.set_DisplayDesc(true);

oItem = oForm.get_Items().Item("cmbStat");

oItem.set_DisplayDesc(true);

}

but i got the following error:

"Invalid item [66000-3] for Item Unique Id: txtCode

it seems the form is not loaded yet when I catch the event!

Andrea

Nussi
Active Contributor
0 Kudos

Hi Andrea,

your problems get stranger and stranger

the only thing i see is that you don't look for the right ItemUID in your If Statement.

If pval.FormUID == "myFormUID" AND ...

now your code works for every form that opens.

alternative:

please just try shortly to set the DisplayDesc (for one Test) in the XML with Screenpainter.

lg David

Former Member
0 Kudos

David,

Just to inform you I set the DisplayDesc attribute to true in the XML for the items, but nothing changed.

Actually I see the description rather than the code value in the combobox, but after data insert i still see the 0 value rather than the blank description.

Andrea

Nussi
Active Contributor
0 Kudos

that can't be true

i use this already for months and it works perfectly.

any other member here can help Andrea ?

lg David

Former Member
0 Kudos

David,

Maybe I have miss something...

Did you have the same problem for header combobox clearing?

Andrea

former_member209699
Contributor
0 Kudos

Hi,

After adding the data, Set the value for that combo as shown below for that dbdatasouce.

oDBs_Head.SetValue("ComboID", 0, "")

regards:

SANDY

Edited by: | Sandeep Saini | Roorkee | India on Sep 10, 2008 2:11 PM

Edited by: | Sandeep Saini | Roorkee | India on Sep 10, 2008 2:11 PM