ALV GRID - how to handle scrollbar click
Hello,
Is it possible to handle scrollbar movment/click
in alv grid control?
Thanks in advance for your help.
Harry
Hello vijay,
I'am implementing a calendar with the alv grid control.
Since I do not want to process all the data at one time
I need to know when the scrollbar reach the upper or lower extremity so that I can populate + other processes the alv grid.
Something very similar to the actual behaviour of "F4_DATE" function module displaying the Calendar control.
Hope you can help me
Thanks
Similar Messages
-
How to handle double click in a table control?
Hi,
Can any one let me how to handle double click event in a table control in dialog programming?
here i need to navigate to another screen when user double click on the table contols (emp number column).
thanks in advance,
PrasadBabu.to define double click in your table controlwhich is similar to 'PICK' function. Enable F2 in PF-status for this
Table Control Question
Check the above thread which was posted recently on SDN, please award points if found helpful -
How to handle double click event in a text control
Hi,
Will u please send me information on handling double click events inside text control and also about locking and unlocking of DB tables for updation.
Regards,
Praba.Hi Prabhavathi,
Here is how you handle double click events in Textedit control.
1)Create a custom control in screen (say TEXT_CONTROL)
2)In main program,
a) Declarations:
data: obj type ref to cl_gui_custiom_control.
text type ref to cl_gui_textedit.
b) Create the instance of custom container
c) Create the instance of textedit control.
3)Now to handle double click events , create a local class as follows.
class shail_event definition.
public section.
methods:
handle_doubleclick for event dblclick of cl_gui_textedit .
endclass.
class shail_event implementation.
method handle_doubleclick .
here do the coding for handling the double click.
endmethod.
endclass.
4) Create an instance of the handler class(ie.ZSHAIL_EVENT).Let it be named hand.
5) Define varibles for event.
DATA: i_events TYPE cntl_simple_events,
wa_events TYPE cntl_simple_event.
SET HANDLER hand->handle_doubleclick for text.
wa_events-eventid = cl_gui_textedit=>event_double_click.
wa_events-appl_event = 'X'. "This is an application event
APPEND wa_events TO i_events.
6)
CALL METHOD texte->set_registered_events
EXPORTING
events = i_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3
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.
These are the basic steps needed for handling events in Textedit control.You can go to SE24 and type CL_GUI_TEXTEDIT to find the associated events of the class.
If you want the program, kindly send your mail-id so that I can mail it to you.
Regards,
Sylendra. -
How to handle double click on alv grid
When I want to double click on a row of the alv grid, I want to give a message or redirecting the user to the row details screen..
I wait for your helps.
Thanks alot.Hello,
Check this report:
FORM ALV_DISPLAY.
*--- ALV List Display
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = G_PROGNAME
I_CALLBACK_USER_COMMAND = G_CALLBACK_USER_COMMAND
IT_FIELDCAT = G_T_FIELDCAT
* IT_EVENTS = IT_EVENTS
TABLES
T_OUTTAB = G_T_OUTTAB
EXCEPTIONS
PROGRAM_ERROR = 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.
ENDFORM. " ALV_DISPLAY
*& Form F_USER_COMMAND_ALV
* text
* --> p1 text
* <-- p2 text
FORM F_ALV_USER_COMMAND USING R_UCOMM LIKE SY-UCOMM
RS_SELFIELD TYPE SLIS_SELFIELD.
CASE R_UCOMM.
WHEN '&IC1'.
*--- Hotspot selektion
CASE RS_SELFIELD-FIELDNAME.
WHEN 'POSID'.
*------ PSP-Element
*-------- Click auf PSP Element -> PSP Element anzeigen (CJ12)
SET PARAMETER ID 'PSP' FIELD SPACE.
SET PARAMETER ID 'PRO' FIELD RS_SELFIELD-VALUE.
CALL TRANSACTION 'CJ12' AND SKIP FIRST SCREEN.
WHEN 'STTXT_INT'.
*------ Systemstatus
G_STTXT_INT = RS_SELFIELD-VALUE.
*-------- G_T_LEGENDE erfüllen
PERFORM F_FILL_G_T_LEGENDE_INT.
G_R_LAYOUT-WINDOW_TITLEBAR = 'Systemstatus'(004).
PERFORM F_STATUS_LEGENDE_POPUP.
WHEN 'STTXT_EXT'.
*------ Anwenderstatus
G_STTXT_EXT = RS_SELFIELD-VALUE.
*-------- G_T_LEGENDE erfüllen
PERFORM F_FILL_G_T_LEGENDE_EXT.
G_R_LAYOUT-WINDOW_TITLEBAR = 'Anwenderstatus'(005).
PERFORM F_STATUS_LEGENDE_POPUP.
ENDCASE.
ENDCASE.
ENDFORM. "F_USER_COMMAND_ALV
IF useful reward.
Vasanth -
ALV Grid: how to save changes made in an editable Grid
Hi,
How to save changes made bu the user in any of the editable cells in a ALV Grid?
Regards,
deb.Hi,
If you are using the FM look at the following example code...
data: LC_GLAY TYPE LVC_S_GLAY.
LC_GLAY-EDT_CLL_CB = 'X'.<<<<<------
gt_layout-zebra = 'X'.
gt_layout-detail_popup = 'X'.
gt_layout-colwidth_optimize = 'X'.
call function 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = i_repid
i_callback_user_command = 'USER_COMMAND1'
it_fieldcat = header
is_layout = gt_layout
i_callback_top_of_page = 'TOP-OF-PAGE1'
i_grid_title = text-h17
it_sort = gt_sort[]
i_default = 'X'
i_save = 'U'
is_variant = gt_variant
it_events = gt_events
I_GRID_SETTINGS = LC_GLAY<<<<<<------
TABLES
t_outtab = itab.
clear itab.
Form USER_COMMAND1
FORM USER_COMMAND1 USING u_ucomm LIKE sy-ucomm
us_selfield TYPE slis_selfield."#EC CALLED
case u_ucomm.
when '&DATA_SAVE'.<<<<<<<<----
This will come after the data was EDITTED and when SAVE was clicked by user in output scren.
Here now in the final internal table(ITAB) you can find the data changed in EDIT mode.
After this you can do manipulation what ever you want.
Thanks.
If this helps you reward with points. -
Double click in alv grid not refreshing until I click elsewhere
Hello,
I'm very new to abap and just managed to partly implement double click in an alv grid.
I also created a button that calls the exact same function as double click (selects the row and fills in the data areas on the page). When I use the button, everything works fine, but when I double click, nothing changes until I click on a tab or other form of input button on the page.
I have followed the process in debugging and can't find the fault anywhere.
My double click is implemented by:
create object lcl_event_receiver.
set handler lcl_event_receiver->double_click
for search_alv_grid.
endif.
CLASS lcl_event_handler DEFINITION.
public section.
methods:
double_click for event double_click
of cl_gui_alv_grid.
ENDCLASS. "lcl_event_handler
CLASS lcl_event_handler IMPLEMENTATION.
* METHOD double_click *
method double_click.
perform select_search_result.
endmethod. "double_click
ENDCLASS.
Any help would be much appreciatedHello,
Try using the template code given below. Let me know if you have any questions.
data : GT_EVENTS TYPE SLIS_T_EVENT.
get event
PERFORM BUILD_EVENT_TOPOFPAGE USING GT_EVENTS[].
display alv data
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = W_xxxxx
IT_FIELDCAT = GT_xxxx
IT_EVENTS = GT_EVENTS[]
TABLES
T_OUTTAB = T_xxxx
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
get event perform
FORM BUILD_EVENT_TOPOFPAGE USING LT_EVENTS TYPE SLIS_T_EVENT.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.
Read double click event using the below statement
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_USER_COMMAND
INTO LS_EVENT.
IF SY-SUBRC = 0.
ENDIF.
ENDFORM. " BUILD_EVENT_TOPOFPAGE
FORM USER_COMMAND USING L_UCOMM LIKE SY-UCOMM
LS_SELFIELD TYPE SLIS_SELFIELD.
CASE L_UCOMM.
WHEN <double click>
Perform do_something.
ENDCASE.
ENDFORM. " USER_COMMAND
Best Regards,
Krishna -
ALV GRID-how to select all the check boxes using push button
Hai All,
I displayed ALV grid & every record contains one check box as first column.
If user clicks on one push button all the check boxes needs to selected.
Could any one tell me how to do this?
Regards,
BhaskarHi Bhaskar,
Try this code :
*" Table declarations...................................................
TABLES :
spfli. " Flight Schedule
*" Data declarations...................................................
Work variables *
DATA :
w_checkbox TYPE c, " Check Box
w_checkbox1 TYPE c, " Check Box
w_lineno LIKE sy-lilli, " Current Line No
w_lines TYPE i. " No. Of Records in Int.Table
Internal table to hold Flight Schedule data *
DATA :
t_spfli LIKE
STANDARD TABLE
OF spfli.
Structure to hold Function Codes *
DATA :
fs_fcode LIKE LINE OF t_fcode.
TOP-OF-PAGE EVENT *
TOP-OF-PAGE.
PERFORM top_of_page.
START-OF-SELECTION EVENT *
START-OF-SELECTION.
PERFORM fetch_spfli_data.
SET PF-STATUS 'YMENU1'.
DESCRIBE TABLE t_spfli LINES w_lines.
fs_fcode = 'EXIT'.
APPEND fs_fcode TO t_fcode.
fs_fcode = 'SELECT'.
APPEND fs_fcode TO t_fcode.
fs_fcode = 'DESELECT'.
APPEND fs_fcode TO t_fcode.
fs_fcode = 'RETRIEVE'.
APPEND fs_fcode TO t_fcode.
AT USER-COMMAND EVENT *
AT USER-COMMAND.
PERFORM user_command.
FORM top_of_page .
WRITE :/50 'Flight Schedule Information'(008).
ULINE.
FORMAT COLOR 1.
WRITE :/10 'Carrier ID'(001),
25 'Connection ID'(002) ,
43 'Airport From'(003),
59 'Airport To'(004),
74 'Departure Time'(007),
93 'Arrival Time'(011),
106 space.
ENDFORM. " FORM TOP_OF_PAGE
FORM fetch_spfli_data .
SELECT carrid " Carrier ID
connid " Connection ID
airpfrom " Airport From
airpto " Airport To
deptime " Departure Time
arrtime " Arrival Time
FROM spfli
INTO CORRESPONDING FIELDS OF
TABLE t_spfli.
IF sy-subrc EQ 0.
PERFORM display_spfli_data.
ENDIF. " IF SY-SUBRC EQ 0
ENDFORM. " FORM FETCH_SPFLI_DATA
FORM display_spfli_data .
SORT t_spfli BY carrid ASCENDING.
LOOP AT t_spfli INTO spfli.
FORMAT COLOR 2.
WRITE :/2 w_checkbox AS CHECKBOX,
spfli-carrid UNDER text-001,
spfli-connid UNDER text-002,
spfli-airpfrom UNDER text-003,
spfli-airpto UNDER text-004,
spfli-deptime UNDER text-007,
spfli-arrtime UNDER text-011.
ENDLOOP. " LOOP AT T_SPFLI...
ENDFORM. " FORM DISPLAY_SPFLI_DATA
FORM user_command .
CASE sy-ucomm.
WHEN 'SELECT'.
w_checkbox1 = 'X'.
DO w_lines TIMES.
w_lineno = sy-index + 3.
READ LINE w_lineno FIELD VALUE w_checkbox.
IF w_checkbox = '*'.
CONTINUE.
ELSE.
MODIFY LINE w_lineno FIELD VALUE w_checkbox FROM w_checkbox1.
ENDIF. " IF W_CHECKBOX = '*'
ENDDO. " DO W_LINES TIMES.
WHEN 'DESELECT'.
w_checkbox1 = ' '.
DO w_lines TIMES.
w_lineno = sy-index + 3.
READ LINE w_lineno.
IF w_checkbox = '*'.
CONTINUE.
ELSE.
MODIFY LINE w_lineno FIELD VALUE w_checkbox FROM w_checkbox1.
ENDIF. " IF W_CHECKBOX = '*'
ENDDO. " DO W_LINES TIMES.
WHEN 'RETRIEVE'.
w_checkbox = ' '.
DO w_lines TIMES.
w_lineno = sy-index + 3.
READ LINE w_lineno FIELD VALUE w_checkbox INTO w_checkbox.
IF w_checkbox = 'X'.
PERFORM fetch_sflight_data.
PERFORM display_sflight_data.
ENDIF. " IF W_CHECKBOX = 'X'
ENDDO. " DO W_LINES TIMES.
ENDCASE. " CASE SY-UCOMM
ENDFORM. " FORM USER_COMMAND
This report gives you the SPFLI Data and places a check box in front of each record. When u click on select all button it will select all the records. And if you click on deselect all it will deselect all the records. When you are trying this maintain the pf-status 'YMENU1' and give the function codes as in the code.
Regards,
Swapna. -
F4 help in ALV grid, how to check the entries?
Hello,
I have created F4 help on the cells in a ALV using OO ABAP. The F4 Help works fine and the user can select the entries from it. BUt in F4 help, the user can manually enter values also.
I want to either disallow the user the enter values manually or validate his entries and ask him to choose from F4 only.
How to achieve this??Use this in Top Include
class local_event_handler definitin deferred.
data handler type ref to local_event_handler
After ALV Grid, register the edit event as shown below after the SET_TABLE_FOR_FIRST_DISPLAY and also set the handler as event handler
if handler is initial.
create object handler.
endif.
set handler handler->handle_data_changed
for main_grid. " Main Grid is your ALV Grid
call method main_grid->register_edit_event
exporting
i_event_id = cl_gui_alv_grid=>mc_evt_modified.
Class Definition / Implementation
class local_event_handler definition.
public section.
methods
handle_data_changed
for event data_changed of cl_gui_alv_grid
importing er_data_changed.
methods
local_event_handler .
endclass. "local_event_handler DEFINITION
class local_event_handler implementation.
method local_event_handler.
" do nothing
endmethod. "llocal_event_handler
method handle_data_changed.
read table er_data_changed->mt_mod_cells into ls_mod_cell index 1.
perform handle_data_changed using er_data_changed.
" ls_mod_cell-row_id contains the row number that changed. More details in er_data_changed
endmethod. "handle_data_changed
endclass. "handle_btn_click -
Using GETGUI command --in ALV grid, how to extract multiple DATA
Using GETGUI command , I am able to get a single value form the ALV grid. Please explain me how I can read multiple data like rows and columns data from the ALV grid.
Please be detailed as I already tried selecting the whole block of ALV grid, but I could not help myself.
Regards
Srinivas.Hi Srinivas,
You will have to use the concept of Regular expressions for this. We will have to loop through each row/coloumn to do what u desire.
The ID of an element on grid will be something like GRIDNAME-<ELEMENT NAME>[ROW NO] [COLUMN NO]
we need to parameterize the row and also the el;ementname changes for each column along with the column number. Please let me know if this much detail is enough. If not i can show u a real time ecatt code snippet on how to play around with grids.
Regards,
Justin -
How to handle Scrollbar's event in the Form Block !
I want to create three Block like
Block : X-axis , Source From View
Block : Y-axis , Source From View
Block : Cell , Source From Stored Procedure.
The relation is (X-axis , Cell) , (Y-axis ,Cell).
Then , if i scroll X-axis or Y-axis Scrollbar , then Cell will change !
Problem : If X-axis Cursor record does not change , the Cell's Data will not refresh.
Can tell me how to handle the scrollbar's event , Thank.Thank you.
The Cell's behavior is a matrix , the relation will execute when X,Y record is changed !
if you move the scrollbar , will chanage block's data , but the cursor record does not change another!.
If i use JaveBean to handle it , possible ?
Using Form 6i . -
ALV Grid( How to calculate percentage) using alv gridfunctional module.
Dear Gurus,
In my report first coulmn and second column are sales and margin but third coulmn is margin%. now at last of report i want to display total sales and total margin and overall margin percentage. I am able to do total of sales and margin by using standard functionality of grid. I need to know to calculate overall percentage. I am not using alv oops method . I am using fucntional modules .
Thanks in advance.
Regards
DaveHi Devendra shrama,
Percentage calculation in ALV
The following method is a bit of a mission but it
seems to be the only way around this at the moment.
Also it only works with an ALV Grid not an ALV List.
You have to take over the total lines manually.
1. In the ALV output tab add extra fields that are the
same as those on which you are sorting and contain the
same values.
2. In the Field Catalog you must add these fields but
they must be hidden i.e. no_out = 'X'.
3. These fields must be included in the Sort Catalog
with subtot = 'X'.
4. In order to handle the final total line in your
layout for the ALV you must set field no_totalline'X' because you are going to be taking this over as
well.
5. Create a form called SUBTOTAL_TEXT or similar
structured as follows:
form subtotal_text using ep_subtot_line like
output_tab
es_subtottxt type
slis_subtot_text.
In this form you will do the percentage calculation
again at total level. The structure ep_subtot_line
will contain a field for each of the fields in your
output_tab i.e. ep_subtot_line-sales,
ep_subtot_line-cost and ep_subtot_line-margin. Put the
margin calculation into ep_subtot_line-margin.
6. In the eventtab that you pass to the ALV_GRID
function module you must create a record with the
field name = 'SUBTOTAL_TEXT' and the field form = the
name of the form you created in step 5 above.
This works OK.
i hope it helps you.Happy solving.
thanks
karthik -
Alv grid: how to set cursor to the next field
Hi Abapers,
When I input the data in first cell and do a tab for coming to next cell to give the input it is coming back to my first cell in the ALV grid.
Any idea's on how do I deal with this.
Many Thanks,
Jagan.Hi Group,
Finally I got the solution for this, here is the stuff we need to do:
***********04/03/2010
*----Get the current cell
CALL METHOD wa_grid->get_current_cell
IMPORTING
es_col_id = li_col
es_row_no = li_rows.
**--Get Scroll Position
CALL METHOD wa_grid->get_scroll_info_via_id
IMPORTING
es_col_info = ls_col
es_row_no = ls_num.
***********04/03/2010
CALL METHOD wa_grid->refresh_table_display.
CLEAR: wa_profile1. ", wa_pro_new.
********04/03/2010
*--Set Scroll Position
CALL METHOD wa_grid->set_scroll_info_via_id
EXPORTING
is_col_info = ls_col
is_row_no = ls_num.
*----Set the cell information
ls_row-index = li_rows-row_id.
CALL METHOD wa_grid->set_current_cell_via_id
EXPORTING
is_row_id = ls_row
is_column_id = li_col
is_row_no = li_rows.
********04/03/2010
Hope this info might be useful to anyone facing the similar issue.
Cheers,
Jagan. -
ALV GRID: How to change Subtotal and Main total values in standard row
Hi Experts,
By using SORT-SUBTOT = 'X' and FIELDCATALOG-DO_SUM = 'X', I will get subtotal and Main total.
My requiremnt is I need be calculate values manually and pass the calculated values to subtotal and maintotal.
is it possible in ALV GRID?
By adding extra row we will do this but I am looking standard subtotal and maintotal row change.
Thanks in advance,
MaheHi,
With function REUSE_ALV_GRID_DISPLAY you cannot do this.
It´s possible if you create a class inherited from cl_gui_alv_grid and rewrite the method set_data_table, you can do this. Like:
CLASS xgrid DEFINITION INHERITING FROM cl_gui_alv_grid.
PROTECTED SECTION.
METHODS: set_data_table REDEFINITION.
ENDCLASS. "xgrid DEFINITION
CLASS xgrid IMPLEMENTATION.
METHOD set_data_table.
* ....MODIFY data_table ...
CALL METHOD super->set_data_table
CHANGING
data_table = data_table.
ENDMETHOD. "set_data_table
ENDCLASS. "xgrid IMPLEMENTATION
DATA: grid TYPE REF TO xgrid.
CREATE OBJECT custom_container EXPORTING container_name = mycontainer.
CREATE OBJECT grid EXPORTING i_parent = custom_container.
CALL METHOD grid1->set_table_for_first_display ...
Best regards,
Leandro Mengue -
ALV grid - how to break a long string into several lines?
I have a ALV grid, where one of the fields contains a textstring that is typically 100 characters long.
Is it possible to break this long string into shorter strings on multiple rows?
Kind of like in Excel, when using row break...Thats not possible in ALV
-
Alv grid - how create transaction ?
Hello,
I copied an existant program with 2 dynpro and an alv grid on the second dynpro.
In the copied program, I create a transaction but when I run it, the first dynpro is showed
and when I call the second dynpro, the program exit and nothing is showed.
(the original program run ok )
Any idea ?
tks.Hi,
Check below mentioned points
Activate all the objects of the Program
check porper pf-status is assiged to the respective screen.
check
CREATE OBJECT cont_dock
EXPORTING
repid = sy-repid
dynnr = 'XXXX' "check this screen no
Maybe you are looking for
-
Error while activating ODS Object (BIC/WAGLCATODS00 &/BIC/AGLCATODS00 )
Hi Gurus, I am getting an error while activating ods object. Error/warning in dict. activator, detailed log --> Detail. Row type /BIC/AGLCATODS00 is not active or does not exist. Table type /BIC/WAGLCATODS00 could not be activated. Table /BIC/AGLCATO
-
Ipod v2.3 not being recognised by itunes
when I plug my ipod in itunes will not recognise it, then it opens up a window called autorun with a torch searching for something. Nothing ever gets found and my device manager recognises it as an ipod device. I have done the 5rs on the support page
-
Very minor problem: Software update keeps wanting to update my HP printer drivers; I don't have an HP printer any more, and I don't want to waste either the time or the space. How do I tell the software update program I'm not interested in this par
-
JDeveloper 11g Using jsp to display images
I am converting a 10.1.3.3 application to 11.1.1.3 It has 2 web modules. One is an ADF administrator module and the other is a public web that displays information including images stored as blobs. This public module has a simple technology scope, on
-
Editing a pre-existing website
We had a website created for us and now I want to edit it myself using Dreamweaver 8. All I can figure out is that I must define it as a Dreamweaver site to use its automatic managing. But how do I define it without creating a whole new website?