Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Tab Functionality

HI,

How to write the tab functionality for textbox and from tabfunctionality we choose the itemcode and using this code matrix is fill with the data .How is it possible? All this are done in tab functionality .

replied

Hi Thippa Reddy Musturu.

I will make an example.

We have a EditText Box and with the TAB we choose a ItemCode.

After that we need a button "Fill" to upload data in the matrix according to ItemCode.

So we have 3 items:

- 1) eItemCode: oEditText box object with CFL for ItemCode;

- 2) btnFill: oButton object;

- 3) mtx00: oMatrix object.

Xml code with items properties:

<datasources>
 <dbdatasources>
  <action type="add">
  ...
 </action>
</dbdatasources>
<userdatasources>
 <action type="add">
...
  <!-- For Item Code and Name -->
  <datasource uid="uItemCode" type="9" size="20"/>
  <datasource uid="uItemName" type="9" size="150"/>
...
 </action>
    </userdatasources>
</datasources>


<items>
 <action type="add">
...
    <!-- FIELD: Item Code -->
    <item uid="eItemCode" type="16" tab_order="60"
       left="160" width="100" top="55" height="14" visible="1"
       enabled="1" from_pane="1" to_pane="1" disp_desc="0" right_just="0"
       description="Item Code"
       linkto="" forecolor="-1" backcolor="-1" text_style="0" font_size="-1"
       supp_zeros="0"
      AffectsFormMode="1">
    <AutoManagedAttribute />
      <specific TabOrder="60" ChooseFromListUID="1" ChooseFromListAlias="ItemCode" >
      <databind databound="1" table="" alias="uItemCode" />
      </specific>
    </item>
    <!-- CAPTION: Item Code -->
    <item uid="lItemCode" type="8" left="9" tab_order="0" width="120" top="55"
	height="14" visible="1" enabled="1" from_pane="1" to_pane="1"
	disp_desc="0" right_just="0" description=""
	linkto="eUCLIRIF" forecolor="-1" backcolor="-1" text_style="0"
	font_size="-1" supp_zeros="0" AffectsFormMode="0">
	<AutoManagedAttribute /><specific caption="Item Code" />
	 </item>
    <!-- BUTTON CFL: Item Code -->
    <item uid="bCFL1" type="4" left="262" top="55" width="15" height="15" visible="1"
	enabled="1" tab_order="70" from_pane="1" to_pane="1" disp_desc="0" right_just="0"
	description="Seleziona" linkto="" forecolor="-1" backcolor="-1" text_style="0"
	font_size="-1" supp_zeros="0" AffectsFormMode="1">
	<AutoManagedAttribute>
	    <Attribute id="1" description="editable" modeAdd="1" />
	   </AutoManagedAttribute>
	   <specific image="CHOOSE_ICON" ChooseFromListUID="2" />
    </item>
    <!-- Arrow Link to Items Form (to see details) -->
    <item uid="arr1" type="116" tab_order="35"
	left="142" width="12" top="55" height="11" visible="1" enabled="1"
	from_pane="1" to_pane="1" disp_desc="0" right_just="0" description=""
	linkto="eUCLIRIF" forecolor="-1" backcolor="-1" text_style="0" font_size="-1"
	supp_zeros="0" AffectsFormMode="2">
      <AutoManagedAttribute>
	<Attribute id="arr1" description="editable" modeView="1" />
      </AutoManagedAttribute>
      <specific linkedObject="4" LinkedObjectType="4" />
    </item>

    <!-- FIELD: ItemName -->
    <item uid="eItemName" type="16" left="278" tab_order="80" width="297" top="54" height="14" visible="1"
	enabled="0" from_pane="1" to_pane="1" disp_desc="0" right_just="0" description="Riferimento" linkto=""
	forecolor="-1" backcolor="-1" text_style="0" font_size="-1" supp_zeros="0"
	AffectsFormMode="1">
    <AutoManagedAttribute />
      <specific TabOrder="80"  >
      <databind databound="1" table="" alias="uItemName" />
	    </specific>
    </item>

...
 </action>
</items>
...
<ChooseFromListCollection>
 <action type="add">

  <!-- CFL for ItemCode field -->
  <ChooseFromList UniqueID="1" ObjectType="4" MultiSelection="0" IsSystem="1">
  </ChooseFromList>
  <!-- CFL to choose ItemCode with bCFL1 -->
  <ChooseFromList UniqueID="2" ObjectType="4" MultiSelection="0" IsSystem="1">
  </ChooseFromList>
 </action>
</ChooseFromListCollection>
...

You need to handle ItemEvent for et_CHOOSE_FROM_LIST.

When yopu press tab will be opened CFL window.

    Public Sub ManageItemEvent( _
            ByVal FormUID As String, _
            ByRef pVal As SAPbouiCOM.ItemEvent, _
            ByRef BubbleEvent As Boolean _
    ) 'Handles SBO_Application.ItemEvent

        Dim oForm As SAPbouiCOM.Form
        oForm = SBO_Application.Forms.Item(FormUID)

        Select Case pVal.EventType
          Case BoEventTypes.et_CHOOSE_FROM_LIST
             If Not pVal.BeforeAction Then
                            oForm.Freeze(True)

                            Dim oCFLEvento As SAPbouiCOM.IChooseFromListEvent
                            oCFLEvento = pVal
                            Dim sCFL_ID As String
                            sCFL_ID = oCFLEvento.ChooseFromListUID
                            Dim oCFL As SAPbouiCOM.ChooseFromList
                            oCFL = oForm.ChooseFromLists.Item(sCFL_ID)

                            Dim oDataTable As SAPbouiCOM.DataTable
                            oDataTable = oCFLEvento.SelectedObjects

                            Dim sCode As String = ""
                            Dim sName As String = ""
                            Try
                                sCode = oDataTable.GetValue(0, 0)   ' Code
                                sCode = sCode.Trim
                                sName = oDataTable.GetValue(1, 0)   ' Desc
                                sName = sName.Trim
                            Catch ex As Exception
                                sCode = ""
                                sName = ""
                                Dim s As String = ex.Message
                            End Try
                            ' Aggiungo Code e Name per colonna
                            If Not sCode.Equals("") Then
                                Try
                                    ' Codice univoco sul primo campo, solo in add_mode
                                    If oForm.Mode = BoFormMode.fm_ADD_MODE Then
                                        If pVal.ItemUID.Equals("eItemCode") Or pVal.ItemUID.Equals("bCFL1") Then
                                            oForm.DataSources.UserDataSources.Item("uItemCode").Value = sName
                                            oForm.DataSources.UserDataSources.Item("uItemName").Value = sName
                                        End If
                                    End If
                                Catch ex As Exception
                                    Dim s As String = ex.Message
                                Finally
                                    oForm.Freeze(False)
                                End Try
                      End If
             End If
...

Try this

Hope my notes can help you.

Best Regards

Sierdna S.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question