ALV BADI event handler, delete icons
The standard ALV Approve Working Times (RCATS_APPROVE_ACTIVITIES) has the BADI
CATS_REPORTING.
1)How could I handle the event on_user_command inside the BADI?
2)How could I also delete an ALV Toolbar icon inside the BADI?
Thank you for the help.
Hi Kiran,
I put the following inside the method IF_EX_CATS_REPORTING~BEFORE_DISPLAY_APPR of the BADI
CALL METHOD IM_ALV_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>mc_evt_enter.
CALL METHOD IM_ALV_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = cl_gui_alv_grid=>mc_evt_modified.
Nevertheless when I run the ALV and press any button the control of the program does not return to me inside the BADI. What else should I do.
Similar Messages
-
Drop Down List in ALV with Event handler
Hi All ,
I have created an ALV grid with a dropdown as one of the columns. This all works fine, except that I want to be able to react to a change in the value of each line's dropdown the next column values should change according to the user selection in the 1st column .
Is this possible?
As an example, I have a table of records with one column as a dropdown called " Replace Function Module " and in 2nd column i have call function of that Replace Function Module , If a change in " Replace Function Module " should change the call function of in the 2nd column .
I am using these objects lvc_t_drop , lvc_s_drop and the method " set_drop_down_table ",
Please Can any 1 tel me how to do this with any event handler ar any other way !Hi,
You need to use event handler for this. Check if the below link gives some direction.
[http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01]
I guess you should create a method inside which you call the FM using the FM name from the selected cell in ALV.
I have not tried it out, but its worth a try.
Hope this helps!
Regards,
Saumya -
Hi all,
Please let me know how to hanldle event handling , making a cell in editable mode ,double click and hotspot creation,colorign a single cell,calling a transatcion when clicked on hotspot in a alv grid display program (not using OO concepts).
Looikng forward for a positive response.
Reagrds,
Mohinder.Hi,
You can create your own custom status and asign it to your
ALV GRID. Here is a sample code to add custom status and handling events.
http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.html
Reward Points if found helpfull..
Cheers,
Chandra Sekhar. -
Reg ALV Hyperlink event handling in WDA
Hi,
I am using one ALV for Invoice in WDA. There in that ALV, column containing VBELN has been defined as Hyperlink. On clicking of VBELN, detail about that should be opened up as PDF.
So far, this is working. But, my problem is, if once VBELN has been selected, next clicking does not pass diff VBELN.
I need to know how can I handle clicking on diff VBELN in my Invoice ALV?
If there is anything like clear or refresh, that need to be invoked in Afteraction or Beforeaction or WdModifyView...?
Or is there a syntax like
wdContext.currentContextElement().setSpace(" ");
for getElement( ) also...?
Thanks.
Kumar Saurav.
Edited by: Kumar Saurav on Feb 5, 2010 8:55 AMHi Arjun,
I followed and implemented this line --
In the DISPLAYPDF method, create a parameter ln_vbeln ref to vbeln.
Now,
Now when you call this method in the ON_CLICK event handler (use the help of code wizard to call the method),
So, why should I call this method in ON_CLICK Event Handler?
In ON_CLICK Method, this is my code that is being generated using Wizard --
LO_EL_VBRKTAB_2->GET_ATTRIBUTE(
EXPORTING
NAME = `VBELN`
IMPORTING
VALUE = LV_VBELN ).
In addition, I am just firing the Plug to call View that has PDF Container - InteractiveForm Element.
And, DISPLAYPDF is a Method defined in ComponentController Method Tab. There, I am employing the logic to fetch the data using Wizard from diff nodes and processing those to give the output from Smartforms as PDF.
There, I've defined ln_vbeln, but, an error comes stating - ln_vbeln cannot be a table, a reference, a string, or contain any of these objects
Here, my question is I've defined my steps. Let me do it in numbers--
1) View for Input defined
2) View to contain output ALV defined
3) View to contain PDF defined
4) Method ON_CLICK defined in second View
5) Method DISPLAYPDF defined in COMPONENTCONTROLLER's Method Tab
Now, suggest me what to do and where?
Thanks.
Kumar Saurav. -
Hi All,
I amd currently developing an ALV tree program to capture the hierarchy of functional location. I managed to display the hierarchy in ALV Tree using cl_gui_column_tree.
Now, i am working on double clicking the functional location and it will bring me to tcode IL03. But, it seems like i cannot capture of the field value clicked. Below are my source code. Can anyone pls help me on this? Thank you very much
*& Form register_events
text
--> p1 text
<-- p2 text
FORM register_events .
Define the events which will be passed to the backend
DATA: lt_events TYPE cntl_simple_events,
l_event TYPE cntl_simple_event.
CALL METHOD gd_tree->get_registered_events
IMPORTING
events = lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
l_event-appl_event = 'X'.
APPEND l_event TO lt_events.
CALL METHOD gd_tree->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc <> 0.
MESSAGE x208(00) WITH 'ERROR'.
ENDIF.
Set Handler
DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
CREATE OBJECT l_event_receiver.
SET HANDLER l_event_receiver->handle_item_double_click FOR gd_tree.
ENDFORM. " register_events
CLASS lcl_tree_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS handle_item_double_click
FOR EVENT item_double_click OF cl_gui_alv_tree
IMPORTING node_key
fieldname.
ENDCLASS. "lcl_tree_event_receiver DEFINITION
CLASS lcl_tree_event_receiver IMPLEMENTATION.
METHOD handle_item_double_click.
DATA: lt_selected_nodes TYPE lvc_nkey,
lt_fieldname TYPE lvc_fname.
Determine which line is selected
CALL METHOD gd_tree->get_selected_item
IMPORTING
e_selected_node = lt_selected_nodes
e_fieldname = lt_fieldname.
CALL METHOD cl_gui_cfw=>flush.
SET PARAMETER ID 'IFL' FIELD lt_fieldname.
SET PARAMETER ID 'ISR' FIELD 'MOB01'.
CALL TRANSACTION 'IL03' AND SKIP FIRST SCREEN.
ENDMETHOD. "handle_item_double_click
ENDCLASS. "lcl_tree_event_receiver IMPLEMENTATIONHello Goh
Based on your coding you are using CL_GUI_ALV_TREE instead of CL_GUI_COLUMN_TREE.
Calling method get_selected_item within your event handler method is unnecessary because these data are already provided by the event interface.
[code]METHOD handle_item_double_click.
DATA: lt_selected_nodes TYPE lvc_nkey,
lt_fieldname TYPE lvc_fname.
*$Comment: unnecessary because these data are already provided
by the event interface (IMPORTING nodekey fieldname).
Determine which line is selected
**CALL METHOD gd_tree->get_selected_item
**IMPORTING
**e_selected_node = lt_selected_nodes
**e_fieldname = lt_fieldname.
ENDMETHOD. "handle_item_double_click[/code]
The following sample is based in report BCALV_TREE_04 but can be simply applied to your application:
[code] METHOD handle_item_double_click.
define local data
DATA:
ls_outtab TYPE sflight.
FIELD-SYMBOLS:
<ld_fld> TYPE ANY.
Call this method to get the values of the selected tree line
CALL METHOD g_alv_tree->get_outtab_line
EXPORTING
i_node_key = node_key
IMPORTING
e_outtab_line = ls_outtab
E_NODE_TEXT =
et_item_layout =
ES_NODE_LAYOUT =
EXCEPTIONS
node_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ASSIGN COMPONENT fieldname OF STRUCTURE ls_outtab TO <ld_fld>.
IF ( <ld_fld> IS ASSIGNED ).
... Call transaction with selected (item) value.
ENDIF.
ENDMETHOD. "handle_item_double_click[/code]
The ASSIGN statement will work if no item of the hierarchy part is selected.
Regards
Uwe -
I have added a custom button on ALV toolbar of my web dynpro view. Now when user click that button, i want to implement the functionality...like onAction...How to do that...where do i need to write the code and how can i capture the button event...
pls suggestHi ,
write following to create button:
DATA: ui_btn1 TYPE REF TO cl_salv_wd_fe_button.
DATA: ui_sepa1 TYPE REF TO cl_salv_wd_fe_separator.
DATA: sepa1 TYPE REF TO cl_salv_wd_function.
DATA: btn1 TYPE REF TO cl_salv_wd_function.
data: lr_disp_button type ref to cl_salv_wd_fe_button.
data: lv_button_text type string.
CREATE OBJECT ui_btn1.
CREATE OBJECT ui_sepa1.
create object lr_disp_button.
/to create new buttons...
lv_button_text = 'Refresh Selection'.
lr_disp_button->set_text( lv_button_text ).
lr_disp_button->SET_IMAGE_SOURCE( 'ICON_DISPLAY' ).
btn1 = l_value->if_salv_wd_function_settings~create_function( id = 'LSBUTTON' ).
btn1->set_editor( lr_disp_button ).
IN methods tab of view declare:
ON_REFRESH Event Handler On refresh function pf ALV ON_FUNCTION INTERFACECONTROLLER ALV
in method ON_REFRESH write below code:
DATA: temp TYPE string.
temp = r_param->id.
IF temp = 'LSBUTTON'.
custom functional;ity
endif.
where :
R_PARAM Importing 1 IF_SALV_WD_TABLE_FUNCTION
This woudl solve ur purpose.
Regards,
Vishal. -
How to get a form field valud in delete PL/SQL Button Event Handler
Hi Friend,
I have a form. when user clicks delete button. we want to remove system dodelete function
and add a delete script
Under delete-top category,
how can I get value of form EVENT_NUMBER field in form at delete PL/SQL Button Event Handler?
DELETE FROM PTEAPP.PTE_EVENTS WHERE eventnumber = EVENT_number
But when I try to save this form and get message as
1721/15 PLS-00201: identifier 'EVENT_NUMBER' must be declared
Thanks for any help!
newuserI did something similar but wasn't using a stored procedure. Couldn't you set a flag variable once you know you're not doing the insert and in the "before displaying the form" section put an IF to check if your flag was set, and if so do an HTP.Print('You are overpaid buddy!');
Then just reset your flag. -
Event handling in alv oops With buttons
Hi Experts
I have some doubt in ALV OOPS using Events. Could any one please tell me the procedure to how to handle events in oops ( Like interactive reports using events ).
Thank you
Satyendra.Hello Satyendra
The following sample report shows you how to handle the event HOTSPOT_CLICK and BUTTON_CLICK.
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: gt_knb1 TYPE STANDARD TABLE OF knb1.
PARAMETERS: p_bukrs TYPE bukrs DEFAULT '2000' OBLIGATORY.
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.
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.
CALL TRANSACTION 'SU01' AND SKIP FIRST SCREEN.
WHEN OTHERS.
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
* 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.
SET PF-STATUS 'STATUS_0100'.
* SET TITLEBAR 'xxx'.
ENDMODULE. " STATUS_0100 OUTPUT
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 .
* 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
ELSE.
ls_fcat-hotspot = abap_true.
ENDIF.
MODIFY gt_fcat FROM ls_fcat.
ENDLOOP.
ENDFORM. " BUILD_FIELDCATALOG_KNB1
Regards
Uwe -
hi experts,
event double click.
when double click on vbeln it should go to va03 transaction . how would i do that in oops alv.hai,
you can go through code below .
*& Report Z_CLARIFY *
REPORT Z_CLARIFY .
DATA: G_GRID TYPE REF TO CL_GUI_ALV_GRID.
DATA: L_VALID TYPE C,
V_FLAG,
V_DATA_CHANGE,
V_ROW TYPE LVC_S_ROW,
V_COLUMN TYPE LVC_S_COL,
V_ROW_NUM TYPE LVC_S_ROID.
DATA: IT_ROW_NO TYPE LVC_T_ROID,
X_ROW_NO TYPE LVC_S_ROID.
DATA:BEGIN OF ITAB OCCURS 0,
VBELN LIKE LIKP-VBELN,
POSNR LIKE LIPS-POSNR,
CELLCOLOR TYPE LVC_T_SCOL, "required for color
DROP(10),
END OF ITAB.
*The Below Definitions Must.....
DATA:
Reference to document
DG_DYNDOC_ID TYPE REF TO CL_DD_DOCUMENT,
Reference to split container
DG_SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
Reference to grid container
DG_PARENT_GRID TYPE REF TO CL_GUI_CONTAINER,
Reference to html container
DG_HTML_CNTRL TYPE REF TO CL_GUI_HTML_VIEWER,
Reference to html container
DG_PARENT_HTML TYPE REF TO CL_GUI_CONTAINER.
"up to here
CLASS lcl_event_handler DEFINITION
CLASS LCL_EVENT_HANDLER DEFINITION .
PUBLIC SECTION .
METHODS:
**Hot spot Handler
HANDLE_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW_ID E_COLUMN_ID ES_ROW_NO,
**Double Click Handler
HANDLE_DOUBLE_CLICK FOR EVENT DOUBLE_CLICK OF CL_GUI_ALV_GRID
IMPORTING E_ROW E_COLUMN ES_ROW_NO,
TOP_OF_PAGE FOR EVENT TOP_OF_PAGE "event handler
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
END_OF_LIST FOR EVENT end_of_list "event handler
OF CL_GUI_ALV_GRID
IMPORTING E_DYNDOC_ID.
ENDCLASS. "lcl_event_handler DEFINITION
CLASS lcl_event_handler IMPLEMENTATION
CLASS LCL_EVENT_HANDLER IMPLEMENTATION.
*Handle Hotspot Click
METHOD HANDLE_HOTSPOT_CLICK .
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW_ID.
V_COLUMN = E_COLUMN_ID.
V_ROW_NUM = ES_ROW_NO.
MESSAGE I000 WITH V_ROW 'clicked'.
CLEAR IT_ROW_NO[].
X_ROW_NO-ROW_ID = V_ROW.
APPEND X_ROW_NO TO IT_ROW_NO .
CALL METHOD G_GRID->SET_SELECTED_ROWS
EXPORTING
IT_ROW_NO = IT_ROW_NO.
ENDMETHOD. "lcl_event_handler
*Handle Double Click
METHOD HANDLE_DOUBLE_CLICK.
CLEAR: V_ROW,V_COLUMN,V_ROW_NUM.
V_ROW = E_ROW.
V_COLUMN = E_COLUMN.
V_ROW_NUM = ES_ROW_NO.
IF E_COLUMN = 'VBELN'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN.
ENDIF.
IF E_COLUMN = 'POSNR'.
SET PARAMETER ID 'VL' FIELD ITAB-VBELN.
CALL TRANSACTION 'VL03N' AND SKIP FIRST SCREEN."
ENDIF.
ENDMETHOD. "handle_double_click
METHOD END_OF_LIST. "implementation
Top-of-page event
PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
ENDMETHOD. "top_of_page
METHOD TOP_OF_PAGE. "implementation
Top-of-page event
PERFORM EVENT_TOP_OF_PAGE USING DG_DYNDOC_ID.
ENDMETHOD. "top_of_page
ENDCLASS. "LCL_EVENT_HANDLER IMPLEMENTATION
*& Global Definitions
DATA: G_CUSTOM_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
"Container1
G_HANDLER TYPE REF TO LCL_EVENT_HANDLER. "handler
DATA: OK_CODE LIKE SY-UCOMM,
SAVE_OK LIKE SY-UCOMM,
G_CONTAINER1 TYPE SCRFNAME VALUE 'TEST',
GS_LAYOUT TYPE LVC_S_LAYO.
data: v_lines type i.
data: v_line(3) type c.
*- Fieldcatalog for First and second Report
DATA: IT_FIELDCAT TYPE LVC_T_FCAT,
X_FIELDCAT TYPE LVC_S_FCAT,
LS_VARI TYPE DISVARIANT.
START-OF_SELECTION
START-OF-SELECTION.
SELECT VBELN
POSNR
FROM LIPS
UP TO 20 ROWS
INTO CORRESPONDING FIELDS OF TABLE ITAB.
describe table itab lines v_lines.
END-OF-SELECTION.
IF NOT ITAB[] IS INITIAL.
CALL SCREEN 100.
ELSE.
MESSAGE I002 WITH 'NO DATA FOR THE SELECTION'(004).
ENDIF.
*& Form CREATE_AND_INIT_ALV
text
FORM CREATE_AND_INIT_ALV .
DATA: LT_EXCLUDE TYPE UI_FUNCTIONS.
"attention.....from here
"split your container here...into two parts
"create the container
CREATE OBJECT G_CUSTOM_CONTAINER
EXPORTING CONTAINER_NAME = 'SCR100_CUST'.
"this is for top of page
Create TOP-Document
CREATE OBJECT DG_DYNDOC_ID
EXPORTING STYLE = 'ALV_GRID'.
Create Splitter for custom_container
CREATE OBJECT DG_SPLITTER
EXPORTING PARENT = G_CUSTOM_CONTAINER
ROWS = 2
COLUMNS = 1.
Split the custom_container to two containers and move the reference
to receiving containers g_parent_html and g_parent_grid
"i am allocating the space for grid and top of page
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_HTML.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_GRID.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 2
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_HTML.
CALL METHOD DG_SPLITTER->GET_CONTAINER
EXPORTING
ROW = 1
COLUMN = 1
RECEIVING
CONTAINER = DG_PARENT_GRID.
"you can set the height of it
Set height for g_parent_html
CALL METHOD DG_SPLITTER->SET_ROW_HEIGHT
EXPORTING
ID = 1
HEIGHT = 5.
"from here as usual..you need to specify parent as splitter part
"which we alloted for grid
CREATE OBJECT G_GRID
EXPORTING I_PARENT = DG_PARENT_GRID.
Set a titlebar for the grid control
CLEAR GS_LAYOUT.
GS_LAYOUT-GRID_TITLE = TEXT-003.
GS_LAYOUT-ZEBRA = SPACE.
GS_LAYOUT-CWIDTH_OPT = 'X'.
GS_LAYOUT-NO_ROWMARK = 'X'.
GS_LAYOUT-CTAB_FNAME = 'CELLCOLOR'.
CALL METHOD G_GRID->REGISTER_EDIT_EVENT
EXPORTING
I_EVENT_ID = CL_GUI_ALV_GRID=>MC_EVT_ENTER.
CREATE OBJECT G_HANDLER.
SET HANDLER G_HANDLER->HANDLE_DOUBLE_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->HANDLE_HOTSPOT_CLICK FOR G_GRID.
SET HANDLER G_HANDLER->END_OF_LIST FOR G_GRID.
SET HANDLER G_HANDLER->TOP_OF_PAGE FOR G_GRID.
DATA: LS_CELLCOLOR TYPE LVC_S_SCOL. "required for color
DATA: L_INDEX TYPE SY-TABIX.
"Here i am changing the color of line 1,5,10...
"so you can change the color of font conditionally
LOOP AT ITAB.
L_INDEX = SY-TABIX.
IF L_INDEX = 1 OR L_INDEX = 5 OR L_INDEX = 10.
LS_CELLCOLOR-FNAME = 'VBELN'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
LS_CELLCOLOR-FNAME = 'POSNR'.
LS_CELLCOLOR-COLOR-COL = '6'.
LS_CELLCOLOR-COLOR-INT = '0'.
LS_CELLCOLOR-COLOR-INV = '1'.
APPEND LS_CELLCOLOR TO ITAB-CELLCOLOR.
MODIFY ITAB INDEX L_INDEX TRANSPORTING CELLCOLOR.
ENDIF.
ENDLOOP.
setting focus for created grid control
CALL METHOD CL_GUI_CONTROL=>SET_FOCUS
EXPORTING
CONTROL = G_GRID.
Build fieldcat and set editable for date and reason code
edit enabled. Assign a handle for the dropdown listbox.
PERFORM BUILD_FIELDCAT.
PERFORM SET_DRDN_TABLE.
Optionally restrict generic functions to 'change only'.
(The user shall not be able to add new lines).
PERFORM EXCLUDE_TB_FUNCTIONS CHANGING LT_EXCLUDE.
**Vaiant to save the layout
LS_VARI-REPORT = SY-REPID.
LS_VARI-HANDLE = SPACE.
LS_VARI-LOG_GROUP = SPACE.
LS_VARI-USERNAME = SPACE.
LS_VARI-VARIANT = SPACE.
LS_VARI-TEXT = SPACE.
LS_VARI-DEPENDVARS = SPACE.
**Calling the Method for ALV output
CALL METHOD G_GRID->SET_TABLE_FOR_FIRST_DISPLAY
EXPORTING
IT_TOOLBAR_EXCLUDING = LT_EXCLUDE
IS_VARIANT = LS_VARI
IS_LAYOUT = GS_LAYOUT
I_SAVE = 'A'
CHANGING
IT_FIELDCATALOG = IT_FIELDCAT
IT_OUTTAB = ITAB[].
"do these..{
Initializing document
CALL METHOD DG_DYNDOC_ID->INITIALIZE_DOCUMENT.
Processing events
CALL METHOD G_GRID->LIST_PROCESSING_EVENTS
EXPORTING
I_EVENT_NAME = 'TOP_OF_PAGE'
I_DYNDOC_ID = DG_DYNDOC_ID.
"end }
Set editable cells to ready for input initially
CALL METHOD G_GRID->SET_READY_FOR_INPUT
EXPORTING
I_READY_FOR_INPUT = 1.
ENDFORM. "CREATE_AND_INIT_ALV
*& Form EXCLUDE_TB_FUNCTIONS
text
-->PT_EXCLUDE text
FORM EXCLUDE_TB_FUNCTIONS CHANGING PT_EXCLUDE TYPE UI_FUNCTIONS.
Only allow to change data not to create new entries (exclude
generic functions).
DATA LS_EXCLUDE TYPE UI_FUNC.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_DELETE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_APPEND_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_INSERT_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_MOVE_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_COPY.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_CUT.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_PASTE_NEW_ROW.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
LS_EXCLUDE = CL_GUI_ALV_GRID=>MC_FC_LOC_UNDO.
APPEND LS_EXCLUDE TO PT_EXCLUDE.
ENDFORM. " EXCLUDE_TB_FUNCTIONS
*& Form build_fieldcat
Fieldcatalog
FORM BUILD_FIELDCAT .
DATA: L_POS TYPE I.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Delivery'(024).
X_FIELDCAT-FIELDNAME = 'VBELN'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-NO_ZERO = 'X'.
X_FIELDCAT-OUTPUTLEN = '10'.
X_FIELDCAT-HOTSPOT = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Item'(025).
X_FIELDCAT-FIELDNAME = 'POSNR'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
L_POS = L_POS + 1.
X_FIELDCAT-SCRTEXT_M = 'Drop'(025).
X_FIELDCAT-FIELDNAME = 'DROP'.
X_FIELDCAT-TABNAME = 'IT_FINAL'.
X_FIELDCAT-COL_POS = L_POS.
X_FIELDCAT-OUTPUTLEN = '5'.
X_FIELDCAT-EDIT = 'X'.
X_FIELDCAT-DRDN_HNDL = '1'.
X_FIELDCAT-DRDN_ALIAS = 'X'.
APPEND X_FIELDCAT TO IT_FIELDCAT.
CLEAR X_FIELDCAT.
ENDFORM. " build_fieldcat
*& Module STATUS_0100 OUTPUT
text
MODULE STATUS_0100 OUTPUT.
SET PF-STATUS 'MAIN100'.
SET TITLEBAR 'MAIN100'.
IF G_CUSTOM_CONTAINER IS INITIAL.
**Initializing the grid and calling the fm to Display the O/P
PERFORM CREATE_AND_INIT_ALV.
ENDIF.
ENDMODULE. " STATUS_0100 OUTPUT
*& Module USER_COMMAND_0100 INPUT
text
MODULE USER_COMMAND_0100 INPUT.
CASE SY-UCOMM.
WHEN 'BACK'.
LEAVE TO SCREEN 0.
ENDCASE.
ENDMODULE. " USER_COMMAND_0100 INPUT
there are many such examples
goto->se38->type bcalv* and press f4, u can see many examples.
Reward points if helpful.
Thanks and regards
Swetha Singh. -
Hi All,
I am using <b>CL_GUI_ALV_GRID</b> to create an ALV grid.This screen is called from a first screen.I am also using a custom defined button in the ALV tool bar for inserting a row into the ALV.I am handling the button click in the event <b>USER_COMMAND</b> of <b>CL_GUI_ALV_GRID</b>.When the ALV screen is called for the first time and when i click on the INSERT button it is inserting a row into the ALV and is working fine.But the problem is after i insert a row in the ALV and when I go back to the first screen and call the ALV screen again and when I try to insert a row in the ALV it is inserting 2 rows.ie from 2 clicks i m getting 3 rows.I went into the debuggng mode and could see that the method <b>handle_button</b> (written locally) is called 2 times the second time,3 times the third time..Have anybody faced this problem before..or could give any suggestions on this..
regards
Sandeephi
good
i think you have to check with that particular method handle_button and its function ,
check out when the final result printing in the alv output for the second time as you mentioned why it is calling the same field data again and again,during runtime you can check that using /h at your command promt.
thanks
mrutyun^ -
Event handling to the drop down list in the WEB DYNPRO ALV.
Hi Experts,
I posted same thing in the UI programing in the morning
For better Visiblity(as i didnt get any replies) of my issue i am posting the same thing in the ABAP General as well.
In my dynpro ALV i have 5 fields. in that 2ed field has the drop down list.
if i select any of from the list, based on the particular selected value, some value should be reflect in the 3rd field of the ALV.
Ex:
dropdown list of 2ed fields inclued like below
AUXILIARY CONTROLLER
AXLE ASSEMBLY, NON-OSCILLATING
ACTUATOR, LINEAR
AIR CONDITIONER
BLADE, EARTHMOVING
if i select ACTUATOR, LINEAR the value ( ACT - first three letters ) should automaticaly reflects in the 3rd field of the ALV like below
Filed 2 Field 3
ACTUATOR, LINEAR ACT
I thnk we have to do the some Event handling for that dropdown.
I checkd in the SCN but i didnt find any solution to my issue.
Any solutions/sample code is appriciated.
Regards!Make sure that the Location Bar is not set to "Nothing": Tools > Options > Privacy > Location Bar: When using the location bar, suggest: History, Bookmarks, History and Bookmarks
See [[Smart Location Bar]] -
Event handling to the drop down list in the web dypro ALV.
Hi Experts,
In my dynpro ALV i have 5 fields. in that 2ed field has the drop down list.
if i select any of from the list, based on the particular selected value, some value should be reflect in the 3rd field of the ALV.
Ex:
dropdown list of 2ed fields inclued like below
AUXILIARY CONTROLLER
AXLE ASSEMBLY, NON-OSCILLATING
ACTUATOR, LINEAR
AIR CONDITIONER
BLADE, EARTHMOVING
if i select ACTUATOR, LINEAR the value ( ACT - first three letters ) should automaticaly reflects in the 3rd field of the ALV like below
Filed 2 Field 3
ACTUATOR, LINEAR ACT
I thnk we have to do the some Event handling for that dropdown.
I checkd in the SCN but i didnt find any solution to my issue.
Any solutions/sample code is appriciated.
For better visiblity( as i didn't get any replies ) I posted same thing in the ABAP Programing
Regards!
Edited by: Prasanth M on Feb 20, 2009 2:54 PMMake sure that the Location Bar is not set to "Nothing": Tools > Options > Privacy > Location Bar: When using the location bar, suggest: History, Bookmarks, History and Bookmarks
See [[Smart Location Bar]] -
ALV: how to handle event for multi (lead) row selection ?
Hi,
I use editable ALV and configure it for multi (lead) selection. Works fine.
But I could not find any event handler for reading the selected lines.
There is only the Event handler ON_LEAD_SELECT: this works only for 1 line
(the lead line). But I could not read multi lines. Who can help?
Thanks in advance, ChristianHi Christian,
did you try a custom button?
Try a call
node->GET_SELECTED_ELEMENTS
I cant remember if ALV sends event when multi-selection is on for each row selection.
ie as each row is selected, do you get control ?
If so, then you should still be able to call node->GET_SELECTED_ELEMENTS .
regards
Phil. -
Cannot delete an event handler
Hello,
Our system has been upgraded from CRM4.0 to CRM2007 and i have managed the collisions successfully.
Now, I am trying in MAS/VS.NET,to delete an event handler in which is invalid but i've got this error message :
"Deletion cannot be performed in a side branch : Either the object is being modified in another change list or the current branch is not owned.
"Exeption:
Deletion cannot be performed in a side branch : Either the object is being modified in another change list or the current branch is not owned.
- Checking out EvtSubscription FastOrderentrytreeWhoAmI1 failed : Branching is not allowed in the current repository; either the object is being modified in another change list or the current branch is not owned"
"Suggestions:
- Give a Branch name if required.
- Restart ARS central server and try again.
- Check whether branching is allowed in the repository."
Our system has been upgraded from CRM4.0 to CRM2007 and i have managed the collisions successfully."
I'm able to create a branch when i tried to change an existing object meaning that the branching is allowed in the repository.
I have also restarted the ARS Central but i still have this problem.
Any suggestions?
Regards,
JohnnyHello
The error message you are getting while deleting the event handler is a valid one. Because it is not possible to delete an object if the object is not owned by that particular ARS reposotory.
For your case, you don't need to delete an event handler. you can just 'Deactivate' the event halder from Document offiline window of code view. It would solve the problem.
Best Regards
Shankar -
Editable ALV: value transport before event handling
Hi everybody,
I'm really going crazy over this one: I'm developing an editable ALV using CL_GUI_ALV_GRID and I'm trying to check the entered data both on pressing enter and on pressing SAVE.
Since I want to use the error log protocol I'm doing all of these check in the data_changed event handling. Now this is where it gets tricky: When a user enters a value and presses the SAVE button without pressing enter first, the following code is executed:
CALL METHOD GOB_D1100_ALV02_GRID->CHECK_CHANGED_DATA
So since I registered the data_changed event, will trigger the event handling BEFORE transporting the value from the GUI to the internal table. The value is only transfered after the data_changed event (where I want to make my checks because of the error protocol) is executed.
How do I get my internal table updated before event handling?
Best wishes,
BenYEHAW! I found a solution to my problem in this thread: editable alv: add custom validation and display "errors" in protocol list
What you need to do is change your internal table yourself accordingly to the changes that you did on the ALV GRID.
You can find the modified rows in table MP_MOD_ROWS of object P_ER_DATA_CHANGED.
Then all you need to do is modify your internal table accordingly. Works like a charm (:
FORM ALV_EVENT_DATA_CHANGED USING P_ER_DATA_CHANGED TYPE REF TO CL_ALV_CHANGED_DATA_PROTOCOL
P_SENDER.
DATA: LTA_MOD_CELLS TYPE LVC_T_MODI.
DATA: LST_MOD_CELLS TYPE LVC_S_MODI.
FIELD-SYMBOLS: <LFS_MOD_ROWS> TYPE TABLE.
LOOP AT P_ER_DATA_CHANGED->MT_MOD_CELLS INTO LST_MOD_CELLS.
ASSIGN P_ER_DATA_CHANGED->MP_MOD_ROWS->* TO <LFS_MOD_ROWS>.
READ TABLE <LFS_MOD_ROWS> ASSIGNING <FS_D1100_ALV02_DATA> INDEX LST_MOD_CELLS-TABIX.
MODIFY GTA_D1100_ALV02_DATA FROM <FS_D1100_ALV02_DATA> INDEX LST_MOD_CELLS-ROW_ID.
ENDLOOP.
Thank you very much for your assitance
Ben
Maybe you are looking for
-
My ATV will no longer stay connected to my home WiFi network. Every single time I want to use it I need to set up WiFi from scratch all over again. I'm considering dumping it as my Roku box has no issues. I'm an Apple loyalist though and want the ATV
-
Scratches on the bottom of my MacBook Pro
My own carelessness has unfortunately resulted in scratches on the bottom edges of my MacBook Pro. There is also a rather unsightly crack that has appeared from the top right hand corner where the charger connects to the middle section on the bottom
-
BPEL install 10.1.2.0 questions
Hi, Env: Sun solaris 10 BPEL install 10.1.2.0 questions ======== a) What is the version of DB I can use? Document is talking about 10.1.0.4.2 Do I have to use this specific version? or Can I just create schema using irca script in 10.2.0.2.0? b) If I
-
Hi, is Oracle 11g enterprise manager, as well as other tools installed on windows avaialable on AIX systems? I'm very new to unix based systems so commands and syntax are going be a problem initially.
-
Hi, I am currently using Adobe Photoshop CS and I am trying to create something that looks like a solar eclipse. See these pictures for examples: http://ocean1025.files.wordpress.com/2009/07/solar-eclipse.jpg http://i124.photobucket.com/albums/p35/po