cancel
Showing results for 
Search instead for 
Did you mean: 

Please Help. CFL.

Former Member
0 Kudos

Hi,

can you help me on how to use ChooseFromList for UDO.

or do you have sample Code?

Please Help me.

Thanks...

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

This is the source code for a Tab CFL and Button CFL for a EditText box...

In XML...

Define a Button CFL and Tab CFL


<ChooseFromListCollection>
<action type="add">
<ChooseFromList UniqueID="-1" ObjectType="-1" MultiSelection="0" IsSystem="1"/>
<ChooseFromList UniqueID="BtnCFL" ObjectType="2" MultiSelection="0" IsSystem="0"/>
<ChooseFromList UniqueID="TabCFL" ObjectType="2" MultiSelection="0" IsSystem="0"/>
</action>
</ChooseFromListCollection>

This is for BtnCFL XML..


<item uid="btn" type="4" left="205" tab_order="0" width="15" top="102" height="14" visible="1" enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0" AffectsFormMode="1">
<AutoManagedAttribute/>
<specific image="CHOOSE_ICON" ChooseFromListUID="BtnCFL"/>
</item>

This is for TabCFL XML..


<item uid="txtUid" type="16" left="124" tab_order="0" width="80" top="101" height="14" visible="1" enabled="1" from_pane="0" to_pane="0" disp_desc="0" right_just="0" description="" linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0" AffectsFormMode="1">
<AutoManagedAttribute/>
<specific TabOrder="0" ChooseFromListUID="TabCFL" ChooseFromListAlias="CardCode">
<databind databound="1" table="@TABLENAME" alias="U_aaa"/>
</specific>
</item>

Give this code in ur item event..


Case SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST
If pVal.BeforeAction = False Then
Dim cflevent As SAPbouiCOM.ChooseFromListEvent = pVal
Dim cfl As SAPbouiCOM.ChooseFromList
Dim a As String = cflevent.ChooseFromListUID
cfl = Conv_Form.ChooseFromLists.Item(a)
Dim dt As SAPbouiCOM.DataTable = cflevent.SelectedObjects
If Not (dt Is Nothing) Then
If cfl.UniqueID = "BtnCFL" Then
db.SetValue("U_aaa", db.Offset, dt.GetValue("CardCode", 0))
End If
If cfl.UniqueID = "TabCFL" Then
db.SetValue("U_aaa", db.Offset, dt.GetValue("CardCode", 0))
End If

Former Member
0 Kudos

THANKS..

how bout on Csharp code? thanks....

Former Member
0 Kudos

I am not having idea in C#....Some other shd help u....

former_member201110
Active Contributor
0 Kudos

Hi,

Here's a sample of C# code to trap the choose from list event and return the selected value to the edittext:


private void SBO_Application_ItemEvent(string FormUID, ref SAPbouiCOM.ItemEvent pVal, out bool BubbleEvent) 
{ 
	BubbleEvent = true;

    if ( pVal.EventType == SAPbouiCOM.BoEventTypes.et_CHOOSE_FROM_LIST ) 
    { 
        SAPbouiCOM.IChooseFromListEvent oCFLEvento = null; 
        oCFLEvento = (SAPbouiCOM.IChooseFromListEvent)pVal; 
        string sCFL_ID = null; 
        sCFL_ID = oCFLEvento.ChooseFromListUID; 
        SAPbouiCOM.Form oForm = null; 
        oForm = SBO_Application.Forms.Item(FormUID); 
        SAPbouiCOM.ChooseFromList oCFL = null; 
        oCFL = oForm.ChooseFromLists.Item(sCFL_ID);

        if (oCFLEvento.BeforeAction == false) 
        { 
            SAPbouiCOM.DataTable oDataTable = null; 
            oDataTable = oCFLEvento.SelectedObjects; 
            string val = null; 
            try { 
                val = System.Convert.ToString(oDataTable.GetValue(0, 0)); 
            } 
            catch ( Exception ex ) 
            { 
                
            } 
            if (pVal.ItemUID == "EditTxt" |  pVal.ItemUID == "Button") 
            { 
                oForm.DataSources.UserDataSources.Item( "EditDS" ).ValueEx = val; 
            } 
        } 
    } 
    
    if ( ( FormUID == "CFL1" ) & ( pVal.EventType == SAPbouiCOM.BoEventTypes.et_FORM_UNLOAD ) ) { 
        System.Windows.Forms.Application.Exit(); 
    }  
} 

The sample above assumes the ChooseFromList has an alias of CFL1 and is attached to an edittext id 'EditTxt' and a button id 'Button'. It is coded for SBO 2005A SP1 or earlier where the choosefromlist button was a separate control. In SBO 2007A, the button is built in to the edittext so your should change the line


if (pVal.ItemUID == "EditTxt" |  pVal.ItemUID == "Button") 

to


if (pVal.ItemUID == "EditTxt")

Kind Regards,

Owen

Former Member
0 Kudos

Thanks.

how bout on VB?

please please help. how am i going to add from ChooseFromList for UDO?