Link button in data grid
hi
Can anyone tell me why the click action is not working when
the link button is placed in datagrid.
<mx:DataGridColumn dataField="edit" headerText="">
<mx:itemRenderer>
<mx:Component>
<mx:LinkButton label="edit" click = "click1();">
</mx:LinkButton>
</mx:Component>
</mx:itemRenderer>
</mx:DataGridColumn>
even if button is placed in the datagrid it is not working.
When you use the <mx:Component> tag you create a new
scope. Its as if all of the content of the <mx:Component>
were in another file. If you used a separate file for your renderer
you wouldn't expect click() function to be recognized, right?
You can modify your renderer like this to make it work:
<mx:LinkButton label="edit" click =
"outerDocument.click1();">
Another option is to take advantage of the bubbling feature
of the click event. Instead of putting the click handler on the
LinkButton, put it on the DataGrid itself. Any click on the
DataGrid will then trigger the event handler.
The drawback to that is that EVERY click will call the event
handler - either the LinkButton's click on a click on the header.
Your event handler just has to examine the event data to determine
what control originated the event.
In this case, using outerDocument.click() is far easier, but
you might need the bubbling property of the event at some point in
the future.
Similar Messages
-
hi friends,
I am trying to insert a link button in my grid (column1)
I created a user form with a grid.
Now in that grid (first column) i want to insert a link button,which will call a system form(like sales order screen)
i'm pasting piece of code (vb.net)related to my grid
so plz send me code how to get link button in my grid and where i can insert that code
' Add a Grid item to the form
oItem = oForm.Items.Add("MyGrid", SAPbouiCOM.BoFormItemTypes.it_GRID)
' Set the grid dimentions and position
oItem.Left = 20
oItem.Top = 100
oItem.Width = 520
oItem.Height = 300
' Set the grid data
oGrid = oItem.Specific
oForm.DataSources.DataTables.Add("MyDataTable")
oForm.DataSources.DataTables.Item(0).ExecuteQuery("select DocNum from [@SALCO_H]")
oGrid.DataTable = oForm.DataSources.DataTables.Item("MyDataTable")
' Set columns size
oGrid.Columns.Item(0).Width = 50
'oGrid.Columns.Item(1).Width = 60
'oGrid.Columns.Item(2).Width = 130
' Get the added form object by using the form's UID
oForm = SBO_Application.Forms.Item("frmGrid")
Thanks & Regards
SARANThenks for u r reply , i gone through that link it is helpful for me but still i have a problem,
now i'm getting linkbutton but it is not performing any function,though i gave the code for that link button and related screen id like <b>2</b> for business partner or like <b>bplist</b>
and <b>one more problem</b> i was facing with grid is
i created a grid in my user screen and i want to get the <b>form settings</b> for that grid(if i click <b>(tools--->form settings)</b>.then it display form settings screen for perticular userscreen.
is it possible to get form settings for a screen having grid
Thanks & regards
SARAN -
Linked button in a Grid (SBO 2005)
Hy,
Is it possible to add a linked button in a grid? I saw some posts for linked buttons in a matrix but this doesn't work for me.
The code that I use to fill the grid is:
Item GOrder = form.Items.Item("GOrder");
Grid gOrder = ((Grid)(GOrder.Specific));
int intCountDatatable = 0;
try
form.DataSources.DataTables.Item("TOrder").ExecuteQuery(strSQL);
catch
return;
gOrder.DataTable = form.DataSources.DataTables.Item("TOrder");
If you (all) need more info, just let me know. Hope you can help...
JoeriHey Joeri!
My guess it isn't possible; if you look through the UI-API, you'll see that there isn't a BoLinkedObject property, and no possibility to set a column to a linkedbutton type...
Good luck,
Rowdy
PS: Waar was je afgelopen donderdag op de SAP Partner Dag? Behoorlijk interessante/leerzame sessie smiddags met betrekking tot de SDK... -
How to add linked button in grid?
Hi,
Does anyone know how to add linked button in a grid? I can't find it but i saw someone ask similar question but seems none of them works.
Thanks a lot!
P.S. For some reason, i can't use matrix because the data is from a SQL query.
LanHi,
as far as I know it is not possible, since this adjustment is made for the whole column. I have created a grid and I open the shown document by double clicking the row header. In the grid I can see if it is sales or purchase and so I use a workaround by opening the specific system form (e.g. sales invoice) in find mode and search the document by document number (also shown in the grid).
Sample:
oSBOapp.ActivateMenuItem("2053"); //sales invoice
oForm = oSBOapp.Forms.ActiveForm;
oForm.Mode = SAPbouiCOM.BoFormMode.fm_FIND_MODE;
oEdit = (SAPbouiCOM.EditText)oForm.Items.Item("8").Specific;
oEdit.Value = Convert.ToString(dNum);
oForm.Items.Item("1").Click(SAPbouiCOM.BoCellClickType.ct_Regular);
By the click event, you get the specific row number. Hope it helps...
Regards
Sebastian -
Link button in grid column to UDO
Hi,
I read through the posts regarding linking to user-defined objects, but I found it very confusing. Some posts say that it is not possible to create a link button to a UDO; others say you need to use the extended-object property.
Does anyone have code that I could use to designate a grid column as a link to a UDO?
The code I'm using is:
oGrid.Columns.Item(1).Type = SAPbouiCOM.BoGridColumnType.gct_EditText
txtColumn = oGrid.Columns.Item(1)
txtColumn.Width = 83
txtColumn.LinkedObjectType = ???
I need to fill in the "???".
If I designate an SAP B1 object type it works.
Thanks,
MikeRasmus,
Thanks for taking the time to provide a detailed explanation. I think though that SAP needs to solve these kinds of problems. It is my understanding that the main design goal of Business One is to provide an infrastructure that would reliably enable customization around it. There is no such thing as accounting software that does not need some kind of adaptation to make it work for specific kinds of business models. So a design that makes customization easier makes a great deal of sense.
If it is necessary to improvise in order to do what you need, then this design goal has not been met. It also means that Business One is not what is managing the process because you are effectively going around it. This in my view is actually worse than if Business One made these links work. By forcing us to go around it, we effectively loose the data protection that Business One should be providing. This is my take on it anyway.
We solved the problem by opening the appropriate form with the appropriate data in it by using the double-click event. The reason we have to do it this way is because the SDK will not even display the link button in a grid if its target is a UDO. This brings up another reason for the SDK to be more cooperative with these efforts. SAP has provided a detailed document describing the need to not deviate from Business Ones look and feel. Perhaps SAP needs also to provide an SDK that more reliably and easily enables that caveat.
If Business One had been designed from the ground up using SOA, its original design goal would be a lot easier to meet. Maybe this is the real problem.
Thanks,
Mike -
Link Button In Grid or Matrix ?
Hello,
I'm trying to populate a grid with data from a SQL query, using a datatable datasource, but I don't know how to specify which fields are to have drill-down(link buttons). After looking at this thread :
Linked button in a Grid (SBO 2005)
I'm left wondering how the Business One Report Generator can generate a grid with link buttons attached to the appropriate fields, when it is only given a SQL query.
I'm thinking I might have to use a matrix, but how can i populate the matrix when if i don't know what the SQL query will be in advance?, also can I achieve the grouping using a matrix that the grid automatically does ?Hello Welch,
Both Matrix and Grid can work with LinkButton. And regarding Grid, first of all, you need to define the gridcolumn type as gct_EditText, then in EditTextColumn Object, there is a property named LinkedObjectType, please set the property as in Matrix column.
' First define the column as EditText type
oCol = oGrid.Columns.Item("Col1")
oCol.LinkedObjectType = 4
Hope this helps,
Nick -
Link button to User Defined Object in Grid
Hi,
I'm using SAP B1 8.81 with B1DE.
I have added a grid which is populated from a DataTable to a form.
One of the columns in the grid contains the DocEntry of a User Defined Object.
How can I display a link button on the grid ?
Regards,
BenHello Ben,
You need to set the column object type.
Dim oGrid As SAPbouiCOM.Grid = oForm.Items.Item("MyGrid").Specific
oGrid.Columns.Item("DocEntry").Type = BoGridColumnType.gct_EditText
Dim oEditCol As SAPbouiCOM.EditTextColumn = oGrid.Columns.Item("DocEntry")
oEditCol.LinkedObjectType = "2" 'The SDK documentation says you should use the value 0, but in previous versions it didn't work, so I recommend you user a value other than -1 or 0
You then need to catch the et_MATRIX_LINK_PRESSED event and other your user form...
From the SDK Help File regarding the BoLinkedObjectType enum
lf_None -1 No target object
lf_UserDefinedObject 0 User-defined object
lf_GLAccounts 1 G/L account object
lf_BusinessPartner 2 Business Partner object
lf_Items 4 Item object
lf_SalesEmployee 53 Sales employee object
Regards,
Vítor Vieira -
hi,
is ther a way to implement a link button im my Grid Column and bind it to an existing UDO ?
I'm using SBO 2007A SP00 PL37.
the following code, shows the link button and links to an item
oGrid.Columns.Item(0).Type = SAPbouiCOM.BoGridColumnType.gct_EditText
oCol = oGrid.Columns.Item(0)
oCol.LinkedObjectType = 4
i tried to link to my udo by the following but without success:
oGrid.Columns.Item(0).Type = SAPbouiCOM.BoGridColumnType.gct_EditText
oCol = oGrid.Columns.Item(0)
oCol.LinkedObjectType = "UDO_VM_CONTRACT"
I'm looking for a way of direct linking. Now i try to do the following workaround, but maybe there is a better way to solve this problem:
Case SAPbouiCOM.BoEventTypes.et_MATRIX_LINK_PRESSED
If pVal.BeforeAction = False Then
BubbleEvent = False
moSboApplication.ActivateMenuItem("VmContract")
End If
best regards
Markus
Edited by: Markus Rewak on Jul 10, 2008 11:11 PM
Edited by: Markus Rewak on Jul 10, 2008 11:12 PMHi Madhu,
the udo object type is not working. To get the drill down functionality you have to use the item-object (4) and catch the matrix link pressed event and search the udo by your own logic.
' Add a link button to a column
oGrid.Columns.Item(0).Type = SAPbouiCOM.BoGridColumnType.gct_EditText
oCol = oGrid.Columns.Item(0)
oCol.LinkedObjectType = 4
Case SAPbouiCOM.BoEventTypes.et_MATRIX_LINK_PRESSED
If pVal.ColUID = "Vnr" And pVal.BeforeAction = True Then
BubbleEvent = False
Dim sLink As String
Dim oGrid As SAPbouiCOM.Grid
oGrid = oForm.Items.Item("Gcont").Specific
oGrid.DataTable = oForm.DataSources.DataTables.Item("DTcont")
sLink = oGrid.DataTable.GetValue(0, pVal.Row)
moSboApplication.ActivateMenuItem("VMarkus")
moSboApplication.Forms.ActiveForm.Mode = SAPbouiCOM.BoFormMode.fm_FIND_MODE
moSboApplication.Forms.ActiveForm.ActiveItem = "txtdocnum"
moSboApplication.Forms.ActiveForm.Items.Item("txtdocnum").Specific.value = sLink
moSboApplication.Forms.ActiveForm.Items.Item("1").Click(SAPbouiCOM.BoCellClickType.ct_Regular)
End If
End Select
This works very well.
have fun
Markus -
Hi everybody:
Just I'd like to know if I can have a link button in a grid object, such as it exists in the matrix object, an how i can get it.
Thanks in formward
Regards.
Misael Reséndiz.Misael,
If you use the Search feature in this forum on "link button on grid", you should find many helpful posts such as this one ...
Link button in Grid
Eddy -
Hi there,
I am a beginner in Visual Basic Express 2010. I have a Point of Sale program that uses DataGridView to display records from an external microsoft access
database using the fillby query.
It works, but it repopulates the same row each time, but i want to be able to display multiple records at the same time, a new row should be filled for
each click of the fillby button.
also I want to be able to delete any records if the customer suddenly decides to not buy an item after it has already been entered.
so actually 2 questions here:
1. how to populate a new row for each click of the fillby button
2. how to delete records from data grid view after an item has been entered
Thanks
VishwasHello,
The FillBy method loads data according to what the results are from the SELECT statement, so if there is one row then you get one row in the DataGridView, have two rows then two rows show up.
Some examples
Form load populates our dataset with all data as it was defined with a plain SELECT statement. Button1 loads via a query I created after the fact to filter on a column, the next button adds a new row to the existing data. When adding a new row it is appended
to the current data displayed and the primary key is a negative value but the new key is shown after pressing the save button on the BindingNavigator or there are other ways to get the new key by manually adding the row to the backend table bypassing the Adapter.
The following article with code shows this but does not address adapters.
Conceptually speaking the code in the second code block shows how to get the new key
Public Class Form1
Private Sub StudentsBindingNavigatorSaveItem_Click(
sender As Object, e As EventArgs) Handles StudentsBindingNavigatorSaveItem.Click
Me.Validate()
Me.StudentsBindingSource.EndEdit()
Me.TableAdapterManager.UpdateAll(Me.MyDataSet)
End Sub
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
'TODO: This line of code loads data into the 'MyDataSet.Students' table. You can move, or remove it, as needed.
Me.StudentsTableAdapter.Fill(Me.MyDataSet.Students)
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Me.StudentsTableAdapter.FillBy(Me.MyDataSet.Students, ComboBox1.Text)
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Me.MyDataSet.Students.AddStudentsRow("Jane", "Adams", "Female")
End Sub
End Class
Get new key taken from
this article.
Public Function AddNewRow(ByVal sender As Customer, ByRef Identfier As Integer) As Boolean
Dim Success As Boolean = True
Try
Using cn As New OleDb.OleDbConnection With {.ConnectionString = Builder.ConnectionString}
Using cmd As New OleDb.OleDbCommand With {.Connection = cn}
cmd.CommandText = InsertStatement
cmd.Parameters.AddWithValue("@CompanyName", sender.CompanyName)
cmd.Parameters.AddWithValue("@ContactName", sender.ContactName)
cmd.Parameters.AddWithValue("@ContactTitle", sender.ContactTitle)
cn.Open()
cmd.ExecuteNonQuery()
cmd.CommandText = "Select @@Identity"
Identfier = CInt(cmd.ExecuteScalar)
End Using
End Using
Catch ex As Exception
Success = False
End Try
Return Success
End Function
In closing I have not given you a solution but hopefully given you some stuff/logic to assist with this issue, if not perhaps I missed what you want conceptually speaking.
Additional resources
http://msdn.microsoft.com/en-us/library/fxsa23t6.aspx
Please remember to mark the replies as answers if they help and unmark them if they provide no help, this will help others who are looking for solutions to the same or similar problem. -
Hai To All,
Iam creating reports for my module. For that iam using grid to display the fields. Now my issue is i want to place the link button(Orange arrow) for specific fields.
For Example,
For Supplier Code iam placing the following code so that i can able to get view the link button and if i click i can able to open the Business Partner.
Grid.Columns.Item(0).Type = SAPbouiCOM.BoGridColumnType.gct_EditText
Dim oCol As SAPbouiCOM.GridColumn
oCol = Grid.Columns.Item(0)
oCol.LinkedObjectType = 2
Similar to that i want to create link button for my user defined screen that is my screen.I registered as UDO as "PI_UDO"
Grid.Columns.Item(0).Type = SAPbouiCOM.BoGridColumnType.gct_EditText
Dim oCol As SAPbouiCOM.GridColumn
oCol = Grid.Columns.Item(0)
oCol.LinkedObjectType = "PI_UDO"
If i give "PI_UDO" as my linked object it is not accepting.No error display also....
If i use none option for linked button,
Grid.Columns.Item(0).Type = SAPbouiCOM.BoGridColumnType.gct_EditText
Dim oCol As SAPbouiCOM.GridColumn
oCol = Grid.Columns.Item(0)
oCol.LinkedObjectType = -1
I cant able to view the link button......
Weather we can able to create link button for our screen???
In Forum someone told that we can....But some told as cannot??
What is the solution for this???
Its an urgent requirement can anyone help me.......
Regards,
Anitha
Edited by: ani nazir on Jul 30, 2008 11:06 AMThanks Petr,
If i use like that i can able to open the screen but there is an error
"No Matching Records found in Business Partner"
In Matrix Item Link press event i made bubbleevent=false
Regards,
Anitha -
SP01 PL03: Click on Grid Link button, add-on disconnected error occured
Hi Frank,
I upgrade my add-on to SP01, there is an error when click Link button which in a UDT bound grid, the error shows 'System Message' with three option buttons, [Restart Add-on],[Log off the current company] and [Continue working without this Add-on], this error does not occur on SAP 2005 PL7,PL8, PL9 & PL10, but occurred on SP01 and SP01 PL03.
The grid Link button link to master like BP, G/L Accout and Item.
Hope there is a workaround way.
Thanks.What version / PL was your Add-On compiled with before?
Was it done with 2005A SP00 PL?? ?
Anyway, I am happy to hear that it works now...
regards,
Frank -
Adding a button in an Advanced Data Grid that calls a AS function
I'm having a bit of trouble with this... maybe I'm missing something elementary.
I have a data grid that populates. I'd like to make the first column that currently displays the an ID display a button that executes a function that acts on the passed ID.
I can get the button to display, but when I click it, I get an error:
ReferenceError: Error #1069: Property userlistDeleteUserFunc not found on Main and there is no default value.
at userGrid/__lblData_click()[C:\Users\Mike\\src\userGrid.mxml:7]
So the grid looks like this:
Main.mxml:
<script tags...>
private function userlistDeleteUserFunc(id:Number):void{
Alert.show(id.toString());
</script tags>
<mx:AdvancedDataGrid x="10" y="12" id="userlistgrid" width="808" height="348" dataProvider="{userlistdata}" selectionMode="multipleCells" editable="true" enabled="true" sortableColumns="true">
<mx:columns>
<mx:AdvancedDataGridColumn width="90" dataField="id" headerText=" " editable="false" />
<mx:AdvancedDataGridColumn headerText="Username" dataField="username" editable="false"/>
<mx:AdvancedDataGridColumn headerText="Last Name" dataField="last" editable="true"/>
<mx:AdvancedDataGridColumn headerText="First Name" dataField="first" editable="true"/>
<mx:AdvancedDataGridColumn headerText="Email Address" dataField="email" editable="true"/>
<mx:AdvancedDataGridColumn headerText="Phone" dataField="phone" editable="true"/>
</mx:columns>
<mx:rendererProviders>
<mx:AdvancedDataGridRendererProvider dataField="id" renderer="userGrid" columnIndex="0" />
</mx:rendererProviders>
</mx:AdvancedDataGrid>
And the renderer:
userGrid.mxml
<?xml version="1.0" encoding="utf-8"?>
<s:MXAdvancedDataGridItemRenderer xmlns:fx="http://ns.adobe.com/mxml/2009"
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:mx="library://ns.adobe.com/flex/mx"
focusEnabled="true">
<s:Label text="{data.id}"/>
<s:Button id="lblData" top="0" left="0" right="0" bottom="0" label="Delete" click="{parentApplication.userlistDeleteUserFunc(data.id)}" />
</s:MXAdvancedDataGridItemRenderer>Please help me !!!! I have been stuck up with this issue for the past two days and I need to atleast figure out if this is possible or not in the first place.
-
Is it possible to have a linked button (drill down) in a gird object?
Hi,
Can you put this code too:
SAPbouiCOM.EditTextColumn oEditCol;
oEditCol = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item("Column Name")));
oEditCol.LinkedObjectType = "X";
For example, in C# :
SAPbouiCOM.EditTextColumn oEditCol;
oEditCol = ((SAPbouiCOM.EditTextColumn)(oGrid.Columns.Item(0)));
oEditCol.LinkedObjectType = "2"; -
Buttons in ALV Grid cell need focus to be clicked :-(
Hi,
I have an ALV Grid with single cells displayed as buttons (dependend on the data in the corresponding row). Unfortunatelly the button-cells need focus to be clicked. So you need two clicks: one to get the focus to the desired cell and one to really click the button.
Any ideas how to make this work with one single click ? (Setting a hotspot does not work, cause hotspots have the same problem.)
Regards,
TobiHello Tobias
The proposal by Naimesh is valid for CL_GUI_ALV_GRID, too. You may have a look at sample report ZUS_SDN_ALVGRID_EVENTS_HOTSPOT. Put the focus on any non-button cell and next click on any customer button.
*& Report ZUS_SDN_ALVGRID_EVENTS_HOTSPOT
*& Thread: Buttons in ALV Grid cell need focus to be clicked :-(
*& <a class="jive_macro jive_macro_thread" href="" __jive_macro_name="thread" modifiedtitle="true" __default_attr="1009251"></a>
REPORT zus_sdn_alvgrid_events_hotspot.
DATA:
gd_okcode TYPE ui_func,
gt_fcat TYPE lvc_t_fcat,
go_docking TYPE REF TO cl_gui_docking_container,
go_grid1 TYPE REF TO cl_gui_alv_grid.
DATA:
go_table TYPE REF TO cl_salv_table,
go_grid_adapter TYPE REF TO cl_salv_grid_adapter.
DATA:
gt_knb1 TYPE STANDARD TABLE OF knb1.
PARAMETERS:
p_bukrs TYPE bukrs DEFAULT '2000' OBLIGATORY.
* CLASS lcl_eventhandler DEFINITION
CLASS lcl_eventhandler DEFINITION.
PUBLIC SECTION.
CLASS-METHODS:
handle_hotspot_click FOR EVENT hotspot_click OF cl_gui_alv_grid
IMPORTING
e_row_id
e_column_id
es_row_no
sender, " grid instance that raised the event
handle_button_click FOR EVENT button_click OF cl_gui_alv_grid
IMPORTING
es_col_id
es_row_no
sender.
ENDCLASS. "lcl_eventhandler DEFINITION
* CLASS lcl_eventhandler IMPLEMENTATION
CLASS lcl_eventhandler IMPLEMENTATION.
METHOD handle_hotspot_click.
* define local data
DATA:
ls_knb1 TYPE knb1,
ls_col_id TYPE lvc_s_col.
READ TABLE gt_knb1 INTO ls_knb1 INDEX e_row_id-index.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
CASE e_column_id-fieldname.
WHEN 'KUNNR'.
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
WHEN 'ERNAM'.
* SET PARAMETER ID 'USR' FIELD ls_knb1-ernam.
* NOTE: no parameter id available, yet simply show the priciple
CALL TRANSACTION 'SU01' AND SKIP FIRST SCREEN.
WHEN OTHERS.
* do nothing
ENDCASE.
* Set active cell to field BUKRS otherwise the focus is still on
* field KUNNR which will always raise event HOTSPOT_CLICK
ls_col_id-fieldname = 'BUKRS'.
CALL METHOD go_grid1->set_current_cell_via_id
EXPORTING
is_row_id = e_row_id
is_column_id = ls_col_id.
ENDMETHOD. "handle_hotspot_click
METHOD handle_button_click.
* define local data
DATA:
ls_knb1 TYPE knb1.
READ TABLE gt_knb1 INTO ls_knb1 INDEX es_row_no-row_id.
CHECK ( ls_knb1-kunnr IS NOT INITIAL ).
SET PARAMETER ID 'KUN' FIELD ls_knb1-kunnr.
SET PARAMETER ID 'BUK' FIELD ls_knb1-bukrs.
CALL TRANSACTION 'XD03' AND SKIP FIRST SCREEN.
ENDMETHOD. "handle_button_click
ENDCLASS. "lcl_eventhandler IMPLEMENTATION
START-OF-SELECTION.
SELECT * FROM knb1 INTO TABLE gt_knb1
WHERE bukrs = p_bukrs.
** TRY.
** CALL METHOD cl_salv_table=>factory
*** EXPORTING
*** LIST_DISPLAY = IF_SALV_C_BOOL_SAP=>FALSE
*** R_CONTAINER =
*** CONTAINER_NAME =
** IMPORTING
** r_salv_table = go_table
** CHANGING
** t_table = gt_knb1.
** CATCH cx_salv_msg .
** ENDTRY.
** go_table->display( ).
** go_table->get_metadata( ).
** EXIT.
* Create docking container
CREATE OBJECT go_docking
EXPORTING
parent = cl_gui_container=>screen0
ratio = 90
EXCEPTIONS
OTHERS = 6.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Create ALV grid
CREATE OBJECT go_grid1
EXPORTING
i_parent = go_docking
EXCEPTIONS
OTHERS = 5.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Set event handler
SET HANDLER:
lcl_eventhandler=>handle_hotspot_click FOR go_grid1,
lcl_eventhandler=>handle_button_click FOR go_grid1.
* Build fieldcatalog and set hotspot for field KUNNR
PERFORM build_fieldcatalog_knb1.
* Display data
CALL METHOD go_grid1->set_table_for_first_display
CHANGING
it_outtab = gt_knb1
it_fieldcatalog = gt_fcat
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* Link the docking container to the target dynpro
CALL METHOD go_docking->link
EXPORTING
repid = syst-repid
dynnr = '0100'
* CONTAINER =
EXCEPTIONS
OTHERS = 4.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
* ok-code field = GD_OKCODE
CALL SCREEN '0100'.
END-OF-SELECTION.
*& Module STATUS_0100 OUTPUT
* text
MODULE status_0100 OUTPUT.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
* text
MODULE user_command_0100 INPUT.
CASE gd_okcode.
WHEN 'BACK' OR
'END' OR
'CANC'.
SET SCREEN 0. LEAVE SCREEN.
WHEN OTHERS.
ENDCASE.
CLEAR: gd_okcode.
ENDMODULE. " USER_COMMAND_0100 INPUT
*& Form BUILD_FIELDCATALOG_KNB1
* text
* --> p1 text
* <-- p2 text
FORM build_fieldcatalog_knb1 .
* define local data
DATA:
ls_fcat TYPE lvc_s_fcat.
CALL FUNCTION 'LVC_FIELDCATALOG_MERGE'
EXPORTING
* I_BUFFER_ACTIVE =
i_structure_name = 'KNB1'
* I_CLIENT_NEVER_DISPLAY = 'X'
* I_BYPASSING_BUFFER =
* I_INTERNAL_TABNAME =
CHANGING
ct_fieldcat = gt_fcat
EXCEPTIONS
inconsistent_interface = 1
program_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
* WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
LOOP AT gt_fcat INTO ls_fcat
WHERE ( fieldname = 'KUNNR' OR
fieldname = 'ERNAM' OR
fieldname = 'BUKRS' ).
IF ( ls_fcat-fieldname = 'BUKRS' ).
ls_fcat-style = cl_gui_alv_grid=>mc_style_button.
" column appears as button
ELSEIF ( ls_fcat-fieldname = 'KUNNR' ).
ls_fcat-style = cl_gui_alv_grid=>mc_style_button.
ls_fcat-hotspot = abap_true.
ELSE.
ls_fcat-hotspot = abap_true.
ENDIF.
MODIFY gt_fcat FROM ls_fcat.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
Regards
Uwe
Maybe you are looking for
-
The blank pop up began as I tried to access "special characters" from the finder menu. I restarted, turned off and restarted and it did not work. It interferes with any application because I cannot work fast. Every new step takes a few seconds longer
-
When I click on pictures on eBay and Facebook...it will not show pictures/enlargements...just blanks....will work with IE. NOT ff
-
I am having trouble with my contacts list. Have copied all contacts from SIM to phone and vice versa, but approximately 100 of my contacts are missing from list (Yes, I have phone and SIM memory selected.) The contacts must be somewhere though, as wh
-
Apple just upgraded the processor for new iPad
I've just noticed that apple has upgraded the processor for the new ipad( not ipad mini)! Now I feel like an idiot buying the new ipad when it came out...
-
Hi, I recently started using Flex and read through the, very extensive and well written documentation. I read about the event propagation mechanism and was rather stunned that only Objects that have a parent-child relationship take part in event prop