Grid ComboBox column
Hi all,
I am considering moving from a matrix to a grid
a. How do I assign valid values to a grid combobox column?
b. Does the grid support all matrix features (link button, etc)?
best,
Asher
Hi Chris,
Here is my code:
// Data table:
DataTable dataTable = testForm.DataSources.DataTables.Add("aaa");
dataTable.ExecuteQuery("SELECT * FROM [@AAA]");
// Grid:
Item gridItem = testForm.Items.Add("grd", BoFormItemTypes.it_GRID);
gridItem.Width = 450;
gridItem.Height = 300;
Grid grid = (Grid)gridItem.Specific;
grid.DataTable = dataTable;
// Columns:
GridColumn textColumn = grid.Columns.Item(2);
((EditTextColumn) textColumn).LinkedObjectType = "4";
GridColumn comboColumn = grid.Columns.Item(0);
comboColumn.Type = BoGridColumnType.gct_ComboBox;
((ComboBoxColumn) comboColumn).ValidValues.Add("3", "3");
This code fails on the last line with this exception:
Unable to cast COM object of type 'SAPbouiCOM.GridColumnClass' to interface type 'SAPbouiCOM.ComboBoxColumn'.
Any ideas?
Asher
P.S.
The link works fine. Thanks.
Similar Messages
-
Save /ADD Grid Control Columns Data in database
Hello All,
Can any one suggest me how we add or save or update the grid control columns fields data into databases.
My problem is I have 2 tabs in user defined screen Main and issue tabs . when we click the issue tabs then items data in main tab matrix is filled in issue tab grid for this i create user defind table and register it with my user defined object .and
fill somoe of this table fields using reocord set . Now I want to add these grid data in database .
how we achieve this .Please guide meArvind,
You may want to review the documentation on the Grid Object in the SDK Help documentation as this may help with your question.
Eddy -
I want to make matrix with combobox column, it is not dificulte, but did somebody know is it posible with different values in each cell?
first row ( 0, Zero ), ( 1, One )
second row ( 0, Zero ), (2, Two ), (6, Six)
third row ( 0, Zero), (1, One )
.... ( Value, Description )
I make something but all cell's have the same set of pair (Value, Description )
P.S. Sorry for my englishHi Andy,
I have been playing around with this for a while now and (seeing that Ibai actually already gave you a solution) I'm just gonna post where I am up to now. I have a matrix with two columns on it (c_1 and c_2). c_1 holds the value 1, 2 or 3. Whenever the user clicks on c_2 I repopulate the combo box according to the value selected in c_1. The only problem is that it shows the second last selected row and not the one that is currently selected. I am just posting it here so it can maybe someday put someone onto the right track.
If pVal.FormTypeEx = "MainForm" Then
If pVal.ItemUID = "m_List" Then 'Matrix
If pVal.ColUID = "c_2" Then 'Column 2
If pVal.BeforeAction = False Then
If pVal.EventType = SAPbouiCOM.BoEventTypes.et_GOT_FOCUS Then
Dim oForm As SAPbouiCOM.Form
Dim oEdit As SAPbouiCOM.EditText
Dim oCombo As SAPbouiCOM.ComboBox
Dim oMatrix As SAPbouiCOM.Matrix
Dim oCol As SAPbouiCOM.Column
Dim i As Integer
oForm = oApplication.Forms.ActiveForm
oMatrix = oForm.Items.Item("m_List").Specific
oCol = oMatrix.Columns.Item("c_1")
oEdit = oCol.Cells.Item(pVal.Row).Specific
oCol = oMatrix.Columns.Item("c_2")
oCombo = oCol.Cells.Item(pVal.Row).Specific
For i = oCombo.ValidValues.Count - 1 To 0 Step -1
oCombo.ValidValues.Remove(i, SAPbouiCOM.BoSearchKey.psk_Index)
Next
If oEdit.Value = "1" Then
oCombo.ValidValues.Add("1", "One")
ElseIf oEdit.Value = "2" Then
oCombo.ValidValues.Add("2", "Two")
oCombo.ValidValues.Add("22", "TwoTwo")
ElseIf oEdit.Value = "3" Then
oCombo.ValidValues.Add("3", "Three")
oCombo.ValidValues.Add("33", "ThreeThree")
oCombo.ValidValues.Add("333", "ThreeThreeThree")
End If
End If
End If
End If
End If
End If
Hope it helps,
Adele
PS: Ibai, why do you have a new user name? You are the same Ibai Peña right? -
Combobox column in a user matrix
hi!
I've a user matrix in a user form whith 2 ComboBox columns. I've just filled these whith their values and descriptions. But, when the addon is running, if i select a value in a combo cell, it doesn't appear in the cell!
I explain myself: i load the form, i click on the combo column (1st row), i click on a value from the combo list, the list is closed but the cell is still empty! Why?
Please help me,
thanks
Giuseppethat's ok!
I have to add an UserDataSource!
Now it run well -
How to make the combobox column in grid can be selectable
Hi,
I have a grid in a form and use a SQL query as the data source. Now I want to make a column(a field in a SQL query) to be displayed as combobox and user can select it. I tried to use below code to make the column displayed like a combobox, it seems that the colunn becomes a dropdown box but i can't select it. Also I can't find a way to add valid value and description into this combobox like what I do on a combobox in a form.
oGrid.Columns.Item("Approved").Type = SAPbouiCOM.BoGridColumnType.gct_ComboBox;
SAPbouiCOM.GridColumn col = oGrid.Columns.Item("Approved");
then ???
Any suggestion?
Thanks!
LanHi Lan
Try This For Matrix......
'For Adding Values
oColumn = oColumns.Add("Drink", SAPbouiCOM.BoFormItemTypes.it_COMBO_BOX)
oColumn.TitleObject.Caption = "Drink"
oColumn.Width = 100
'Add Valid Values
oColumn.ValidValues.Add("Cola", "")
oColumn.ValidValues.Add("7up", "")
oColumn.ValidValues.Add("Fanta", "")
oColumn.ValidValues.Add("Orange Juice", "")
oColumn.ValidValues.Add("Water", "")
oColumn.ValidValues.Add("Lemonade", "")
oColumn.ValidValues.Add("Ice Tea", "")
oColumn.ValidValues.Add("Coffee", "")
'For selected Value
Dim ocombo As SAPbouiCOM.ComboBox
Dim oform As SAPbouiCOM.Form
Dim omat As SAPbouiCOM.Matrix
oform = SBO_Application.Forms.Item("MOR1")
omat = oform.Items.Item("mat").Specific
ocombo = omat.Columns.Item("Drink").Cells.Item(1).Specific
ocombo.Select("Fanta", SAPbouiCOM.BoSearchKey.psk_ByValue)
Thanks
Shafi -
Multiple Hotspots in a ALV Grid single column
Hi Experts,
My ALV Grid report output looks like below....
If you observe below output, column 3 has multiple documents each one separated by ' ; '. Now, I would like to assign hotspot on each documents like DOC1, DOC2, DOC3, etc.
Heading#: COL1 | COL2 | COL3 |
Records1: 1 | xxxxx | _DOC1_ ; DOC2 ; *DOC3*
Records2: 2 | xxxxx | _DOC1_ ; DOC5 ;
I know, we can assign hotspot for entire column. but my requirement is multiple hot spots in a single column.
Please help me on this?
Thanks in Advance
RaghuAs I mentioned earlier,
My ALV Grid report output looks like below....
Heading#: FIELD1 | FIELD2 | FIELD3 |
Records1: 1 | xxxxx | DOC1 ; DOC2 ; DOC3
Records2: 2 | xxxxx | DOC1 ; DOC5 ;
If you observe above output, field 3 has multiple documents each one separated by ' ; '.
When I click on DOC1, it supposed to display related picture on the POP-Up Screen. Similarly when I click on DOC2, it supposed to display that document picture on POP-up screen.
Before going to do this, first I need to assign hotspots on each documents like DOC1, DOC2, DOC3, etc.
Please help me. -
ALV GRID Display Column Width problem when filtering
Hello All,
When i displaying ALV Grid Display ,i selected one column and set filter for that.
the problem is column width at display is 12 charecters but in filter it is allowing only 10 charecters to enter which is wrong. i am unable to set filter.please give solution.
Thanks
Sandeep.Ghello i am calling perform, ineed to set OUTPUTLEN according to field length how can i do that.
FORM fill_fieldcat USING p_field TYPE slis_fieldcat_alv-fieldname
p_text TYPE slis_fieldcat_alv-seltext_l
p_flag TYPE c.
wa_fieldcat-fieldname = p_field.
wa_fieldcat-seltext_l = p_text.
wa_fieldcat-no_out = p_flag.
wa_fieldcat-outputlen = 20.
APPEND wa_fieldcat TO i_fieldcat.
CLEAR wa_fieldcat. -
Alv grid background column headings
HI EVERYONE,
I was able to execute the ALV grid report in background .But columns heading is reeating for
each page.
Can't we just just have the Column Headings once for all pages.?For the IS_LAYOUT parameter it is possible to set NO_COLHEAD = 'X'. Then the header is gone. Then you have to create first line in table with texts. But then all fields must be character fields.
Regards
Roy -
ALV Tree/Grid: maximum columns
Hello.
How many columns can have a maximum of ALV Tree/Grid?
Thanks.
P.S. Sorry, self-solved: OO ALV : Maximum number of columns, Daixiong Jiang.Hello Emir
Call the static method <b>cl_gui_cfw=>set_new_okcode</b> with your required ok-code. The short description of this methods says <i>"Be careful: This sets a new Fcode in Eventhandler for PAI",</i> exactly what you want.
Regards
Uwe -
Showing Grid without column headers and Grid lines
Hi all
does anyone knows how can set a grid object to display without grid lines and without column headers?
appreciate the help
YoavHi Yechiel,
When you work with the grid you just have to drag it into your srf and bind it with some table by specifying the table name in its properties.
When the form launches the columns of the grid will be created automatically as per the number of columns in the table.The caption of the column in the grid will be the same as that of the name of the column in the table.The only condition for this is that the table should contain some records, if the table is empty no grid lines and the column header will be displayed .
I hope this meet your requirements.
Below I am sending you the code segments with the help of which you can control the grid progamatically...
//Declaring the grid object
Grid oGrid;
//Initializing the grid object
oGrid=(SAPbouiCOM.Grid)oForm.Items.Item("MBS_Grid").Specific;
//Adding a new data table to the form
oSboApplication.Forms.ActiveForm.DataSources.DataTables.Add("MBS_DataTable");
//Assigning the data table to the grid
oGrid.DataTable = oSboApplication.Forms.ActiveForm.DataSources.DataTables.Item( "MBS_DataTable" );
// This statement will clear the grid
oGrid.DataTable.Rows.Clear();
// In this way you can set the column properties
oGrid.Columns.Item(0).Editable=false;
oGrid.Columns.Item(1).Editable=false;
oGrid.Columns.Item(2).Editable=false;
oGrid.Columns.Item(3).Editable=false;
oGrid.Columns.Item(4).Editable=false;
oGrid.Columns.Item(5).Editable=false;
// In this way you can set the column width
oGrid.Columns.Item( 0 ).Width = 50;
oGrid.Columns.Item( 1 ).Width = 60;
oGrid.Columns.Item( 2 ).Width = 130;
//This is the way you can set a user defined caption on the column header.
query="select U_CTX_MOVCODE as 'Movie Code',U_CTX_MOVNAME as 'Movie Name',U_CTX_SHELF as 'Shelf Number',U_CTX_SPACE as 'Space Number',U_CTX_CARDCODE as 'Customer Code',U_CTX_RENTED as 'Rent Status' from [@CTX_VSTORE] order by Code";
Regards,
Prashant -
Hey,
How to know number of rows and columns in alv grid are used.Hi,
You can count the number of rows , by using describe statemet,
describe table itab lines v_lines.
itab is table used to display in ALV
Thanks & Regards,
Navneeth K. -
Panel Grid Layout: Column Span unexpected behavior.
Whenever in a Panel Grid Layout, when i give a cell to span over multiple columns(2,3,4 or any), the cell is spanned over the entire row only.. Why does this behavior happens? In JDeveloper, the spanning is shown correctly in design tab and preview tab.
Hi Amanda,
I believe I have discovered the cause of the issue you are facing.
The problem is with the "Alert Region" region template and that it does not have any display points specified so indicate the number of grids that can fit in its region body. Without having any display points, the grid layout system attempts to use all columns available to its container. However, because the Alert Region has additional padding within, the columns will not fit and wrap to the next line.
To fix this issue, you will have to modify the "Alert Region" region template, go to "Display Points" and click Add Row. You will need to enter the following fields:
Name: Region Body
Template Substitution: BODY
Grid Support: Checked
Maximum Fixed Grid Columns: -1
This will fix the issue for you. I've logged a bug within our bug system to track this so we can fix it in a future release of APEX.
Best,
Shakeeb -
Grid populating columns in alphabetical order (which I don't want)
Hi,
Am populating a grid from an array defined in my CFC function
in coldfusion.
My flex function is as follows:
public function getOrders(event:ResultEvent):void{
ords = event.result as ArrayCollection;
grd.dataProvider = ords;
The grid is populating nicely without any error. BUT it is
populating in alphabetical order.
That is, if in my query I do:
"select B,D,C,A from tbltest..."
It is populating the grid columns as "A", "B", "C" and "D"
(in alphabetical order).
Any idea, how do I do it to obtain in the order i want , as
"B","D", "C" and "A".
Thx for your precious help.You will need to specify DataGridColumn tags to define the3
column order.
I might be wrong, but I do not think the default order of the
columns is alphabetical. Rather, it is the reverse of the order
which the columns are added to the columns array.
At any rate, the only ways to create reliable column order is
to use DataGridColumns or to build the columns programmatically.
Tracy -
This is probably a really simple question but....
I have been creating my first fluid grid layout. There were nice, helpful pink columns - but not any more. I can't find a way to get them back. Guess I have "hot keyed" something off ... can somebody tell me what!
thanks
EdwardIf you navigate to View - Visual Aids, you can see if Fluid Grid Layout Guides is checked or not.
-
Grid - imput columns, summing
Hello,
I have received a design spec to use a grid. Below are some of the requirements.
1. The first line of the grid should be only output since this is a reference line. The next lines should be available for input, but only some columns, the other columns should contain information copied from the reference line.
2. The header text for the columns that are for input should be colored red.
3. I also need to sum one column, but only the input values, ie. excluding the value in the first line (reference).
Is this possible?
Thank you for your help,
PatrickHi,
1. What you need to do for this is to enable the editing feature cell by cell. The same can be acived by adding a column STYPE TYPE LVC_T_STYL to the internal table. Now, for a row and append a column in this nested internal table setting the style as MC_STYLE_ENABLED / MC_STYLE_DISABLED. This will enable the editing of specific columns of a row.
2. I don't think you have the Header text in a different color.
3. Summing excluding specific rows is not possible.
Regards,
Ravi
Note : Please mark all the helpful answers
Maybe you are looking for
-
Reg: ME21 Purchase Order Creation BDC Codes
Hi All, Ritenow Im working with ME21 purchase order creation, i have to create a upload program for this past twodays im geting hectic with this prog, if i create a prog using me21n transaction it is not running, and in ME21 i cant record in SHDB( it
-
First off, its not the printer. Everything else (from pages to pictures to html etc) prints with no problems. Whenever I print a pdf (either self created or sent to me by someone else) it prints out very blurry. or if there is any sort of watermark
-
Hi friends, I have to add two fields in a customer based report , i know only the description of field name 'Customer comments' and 'contact notes'. in which table i have to search for getting SAP database field. i have searched in customer master da
-
Export video clip from Premiere into an existing Encore project
New to encore.....love the software so far....but not much experience with it yet. Here is my question: How do I go about exporting a video clip from premiere CS3 into an open/existing encore project. When I try to export to encore from the prem. tim
-
Record Working time as a standalone system
Dear all, we have a requirement of recording working times of employees through Portal (ESS) and approve working time. i checked the CATS (Configure ESS for Time Entry) and our requirement is similar to it but in CATS i read " after its approved it