2005 Dec 12 5:42 PM
Hello everybody!
Here's a new problem that's bugging me: imagine an ALV with 1000 rows. On each row, there's a checkbox i use to select some rows to process a function. When i click on one checkbox of the 300th row (for example) the ALV refreshes and sends me back to the top of the ALV. What can i do to prevent this behavior ?
Thanks.
Hello everybody!
Here's a new problem that's bugging me: imagine an ALV with 1000 rows. On each row, there's a checkbox i use to select some rows to process a function. When i click on one checkbox of the 300th row (for example) the ALV refreshes and sends me back to the top of the ALV. What can i do to prevent this behavior ?
Thanks.
2005 Dec 12 5:49 PM
How come , are you doing any refresh ....
if it is possible try to show the code..
vijay
2005 Dec 12 6:00 PM
The structure i use on the ALV has a field for the checkbox, like this:
TYPES: BEGIN OF ud_struct,
<b>sel TYPE c</b>,
objid_emp LIKE zmss_org_status-objid_org,
stext_emp LIKE zmss_org_relat-stext,
objid_dir LIKE zmss_org_status-objid_org,
stext_dir LIKE zmss_org_relat-stext,
objid_org LIKE zmss_org_status-objid_org,
stext_org LIKE zmss_org_relat-stext,
pernr_nv LIKE zmss_org_status-pernr_nv,
pernr_org LIKE zmss_org_status-pernr_org,
rufnm_org LIKE pa0002-rufnm,
rufnm LIKE pa0002-rufnm,
rh_status LIKE zmss_org_status-rh_status,
END OF ud_struct.These are the definitions:
DATA: gt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: gt_outtab TYPE ud_struct OCCURS 0 WITH HEADER LINE,
gt_tmp_outtab TYPE ud_struct OCCURS 0 WITH HEADER LINE.
DATA: g_repid LIKE sy-repid.
DATA: levent TYPE slis_alv_event,
tevent TYPE slis_t_event.And here's the function call to the ALV:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_background_id = 'ZBACKGROUND_BRANCO'
i_callback_program = g_repid
it_events = tevent
i_callback_pf_status_set = 'PFSTATUS'
i_callback_top_of_page = 'TOP_OF_PAGE'
it_fieldcat = gt_fieldcat[]
TABLES
t_outtab = gt_outtab.To provide the selection tool, i have this:
FREE tevent.
levent-name = 'USER_COMMAND'.
levent-form = 'HOTSPOT_SEL'.
APPEND levent TO tevent.The problem is after pressing a checkbox in the middle of a large table, the ALV goes back to the top. That is very anoying. Imagine you want to select the 300th row of the ALV. After doing that, with this behavior that i have right now, i need to scroll back to the 300th row again if i want to see that line again.
2005 Dec 12 6:03 PM
Hi Nuno,
I got the problem,, if you can provide me fieldcat definitions then i will confirm it..
regards
vijay
2005 Dec 12 6:05 PM
with out passing events try that...
just to test..
regards
vijay
2005 Dec 12 6:15 PM
Hi Vijay,
Without passing events? I didn't understood you...
In my hotspot Selection Form i do this:
IF p_ucomm = '&IC1' AND ls_selfield-fieldname = 'SEL'.
ls_selfield-value = ' '.
ls_selfield-refresh = 'X'.
READ TABLE gt_outtab INDEX ls_selfield-tabindex INTO llist.
IF llist-sel = ' '.
llist-sel = 'X'.
ELSE.
llist-sel = ' '.
ENDIF.
MODIFY gt_outtab INDEX ls_selfield-tabindex FROM llist.
ENDIF.
And my field cat is defined like this:
FORM fieldcat_init
USING rt_fieldcat TYPE slis_t_fieldcat_alv.
DATA: ls_fieldcat TYPE slis_fieldcat_alv.
DATA: pos TYPE i VALUE 1.
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'SEL'.
ls_fieldcat-reptext_ddic = 'Seleccionar'.
ls_fieldcat-hotspot = 'X'.
ls_fieldcat-checkbox = 'X'.
APPEND ls_fieldcat TO rt_fieldcat.
(...)
2005 Dec 12 6:20 PM
CLEAR ls_fieldcat.
ls_fieldcat-fieldname = 'SEL'.
ls_fieldcat-reptext_ddic = 'Seleccionar'.
<b> ls_fieldcat-hotspot = 'X'.</b>
ls_fieldcat-checkbox = 'X'.
APPEND ls_fieldcat TO rt_fieldcat.
i got your problem,, see you are providing hotspot and
in the event you are refreshing..
<b> ls_selfield-value = ' '.
ls_selfield-refresh = 'X'.</b>
so when you select the check box it self it will trigger(hot spot event)
and refreshing the screen...
hope you got it..
try to comment refresh .
and see....
<b>ls_selfield-refresh = 'X'.</b>
vijay
2005 Dec 12 6:21 PM
if you understood what i am saying your problem solved almost...
try commenting this
<b>*ls_selfield-refresh = 'X'.</b>
please reward for helpful answers
vijay
2005 Dec 12 6:30 PM
Vijay,
If i comment the 'refresh', my alv will not display the checkbox as marked anymore.
I need it to display on screen that that row is selected.
2005 Dec 12 6:36 PM
there are ways to do it.., and capture ..
if you don't believe me then just to test that comment the refresh and see, or do one thing call the refresh at the end after performing every thing....
that will serve you..
2005 Dec 12 6:43 PM
I tried. And i also tried what you suggested now (refreshing at the end). The first suggestion doesn't mark my checkbox. The second stays the same as it was (the ALV pops back to the top).
2005 Dec 12 6:44 PM
IF p_ucomm = '&IC1' AND ls_selfield-fieldname = 'SEL'.
<b> ls_selfield-value = ' '.
ls_selfield-refresh = 'X'.</b>
READ TABLE gt_outtab INDEX ls_selfield-tabindex INTO llist.
IF llist-sel = ' '.
llist-sel = 'X'.
ELSE.
llist-sel = ' '.
ENDIF.
MODIFY gt_outtab INDEX ls_selfield-tabindex FROM llist.
ENDIF.this is where the problem .. where are you making the
<b> ls_selfield-value = ' '.
</b>
and refrsh after the below statement...
<b> MODIFY gt_outtab INDEX ls_selfield-tabindex FROM llist.</b>
2005 Dec 12 7:04 PM
IF SELFIELD-SEL_TAB_FIELD = 'GT_OUTAB-SEL'.
READ TABLE GT_OUTAB INDEX SELFIELD-TABINDEX
INTO LIST.
IF SY-SUBRC = 0.
IF llist-sel = ' '.
llist-sel = 'X'.
ELSE.
llist-sel = ' '.
ENDIF.
ENDIF.
MODIFY gt_outtab INDEX ls_selfield-tabindex FROM llist.
ENDIF.
why are you doing like this....any reason..
IF llist-sel = ' '.
llist-sel = 'X'.
ELSE.
llist-sel = ' '.
ENDIF.vijay
if your problem solves please get back ...
Message was edited by: Vijay Babu Dudla
2005 Dec 12 5:51 PM
are you using Normal List or Grid or Grid Control...
I think some event you are triggering after selecting the Check box....
check it in debug mode what is happening..
regards
vijay
2005 Dec 12 8:01 PM
Hi
You need to set slis_selfield-COL_STABLE = 'X', slis_selfield-ROW_STABLE = 'X' in your user call back routine.
I believe you would need to have the REFRESH = 'X' .
Regards
Kalidas
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |