on 12-14-2005 5:00 AM
hi, everybody
I meet a difficulty in ALV develop, descript the problem as following:
when user double click the subtotal line of ALV, I need to get the content of this subtotal line.
I use REUSE FM for ALV.
when double click ALV, the callback subroutine USER_COMMEND will be called, with a structure SLIS_SELFIELD.
SLIS_SELFIELD inclulde information about the line we double click on ALV. When double click on a subtotal line, SLIS_SELFIELD-SUMINDEX will be a value of subtotal index.
The problem is , though we have got this index, I don't know how to use it. Can I read the subtotal line from a table with this index?
Which table is for the subtotal line?
Or is there any other way to read out the content of subtotal line?
Any suggestion and hint is welcome.
thanks a lot
If you are displaying sub totals, and using REUSE_ALV_GRID_DISPLAY, picking the line can be difficult.
It will be of great help, if you use CL_GUI_ALV_GRID.
, Go to development class SLIS, and you will find examples.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi, add some update progress on this issue.
Actually the Summary Line in ALV can be get in OO ALV.
There is a method named 'GET_SUBTOTALS'
and we can call it like this:
DATA: DREF0 TYPE REF TO DATA.
DATA: DREF1 TYPE REF TO DATA.
DATA: DREF2 TYPE REF TO DATA.
DATA: DREF3 TYPE REF TO DATA.
DATA: DREF4 TYPE REF TO DATA.
DATA: DREF5 TYPE REF TO DATA.
DATA: DREF6 TYPE REF TO DATA.
DATA: DREF7 TYPE REF TO DATA.
DATA: DREF8 TYPE REF TO DATA.
DATA: DREF9 TYPE REF TO DATA.
DATA: TMPGRP TYPE LVC_T_GRPL.
DATA:
GO_GRID TYPE REF TO CL_GUI_ALV_GRID,
CALL METHOD GO_GRID->GET_SUBTOTALS
IMPORTING
EP_COLLECT00 = DREF0
EP_COLLECT01 = DREF1
EP_COLLECT02 = DREF2
EP_COLLECT03 = DREF3
EP_COLLECT04 = DREF4
EP_COLLECT05 = DREF5
EP_COLLECT06 = DREF6
EP_COLLECT07 = DREF7
EP_COLLECT08 = DREF8
EP_COLLECT09 = DREF9
ET_GROUPLEVELS = TMPGRP.
These series of DREF0X tables will be restore the Summary Line of the ALV.
We know that the Summarize in ALV has hierachies, there table will be store as hierachies.
For example, if we has Sum Key as Key1, Key2
The DREF1 will be stored with Key1 summarize result, and DREF2 will be key1&key2 summarize result.
Something like this.
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi, I searched in the ALV code of sap.
Actually, I think maybe there is a fact, that:
through FM 'REUSE_ALV_GRID_DISPLAY' can't trigger event 'SUBTOTAL_TEXT'.
How I can say that? because I found some code in OO ALV, and 'REUSE_ALV_GRID_DISPLAY'.
As we know, in 'REUSE_ALV_GRID_DISPLAY', SAP using OO ALV to achieve all the effect its support to caller.
So if you want to find if it can be achieve in ALV or not,
we must try to find if it can be done in OO ALV.
in CL_GUI_ALV_GRID, there is the event 'SUBTOTAL_TEXT'.
As a event, I try to search the code to raise this event.
Here is it:
METHOD LIST_PROCESSING_EVENTS .
DATA: L_EVENT_DATA TYPE REF TO CL_ALV_EVENT_DATA.
CASE I_EVENT_NAME.
WHEN 'TOP_OF_LIST'.
.......
WHEN 'TOP_OF_PAGE'.
.......
WHEN 'SUBTOTAL_TEXT'.
CREATE OBJECT L_EVENT_DATA.
GET REFERENCE OF C_SUBTOTTXT INTO L_EVENT_DATA->M_DATA.
RAISE EVENT SUBTOTAL_TEXT
EXPORTING ES_SUBTOTTXT_INFO = IS_SUBTOTTXT_INFO
E_EVENT_DATA = L_EVENT_DATA
EP_SUBTOT_LINE = IP_SUBTOT_LINE.
.....
above is the code to trigger this event in ALV class.
LIST_PROCESSING_EVENTS is a public method, can be called by outside.
So we can get to know that if you want to trigger this event, we need to call LIST_PROCESSING_EVENTS outside.
Then how about FM ALV?
If FM ALV also realize it, it should call method LIST_PROCESSING_EVENTS with I_EVENT_NAME = 'SUBTOTAL_TEXT'.
But if we search in the 'REUSE_ALV_GRID_DISPLAY', it made me very disppoint, here is the search out result:
call method gt_grid-grid->list_processing_events
exporting i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = gt_grid-top.
call method gt_grid-grid->list_processing_events
exporting i_event_name = 'END_OF_PAGE'.
call method gt_grid-grid->list_processing_events
exporting i_event_name = 'END_OF_LIST'
i_dyndoc_id = gt_grid-bottom.
call method gt_grid-grid->list_processing_events
exporting i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = gt_grid-top.
call method gt_grid-grid->list_processing_events
exporting
i_event_name = 'END_OF_LIST'
i_dyndoc_id = gt_grid-bottom.
call method gt_grid-grid->list_processing_events
exporting i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = gt_grid-top.
call method gt_grid-grid->list_processing_events
exporting i_event_name = 'END_OF_LIST'
i_dyndoc_id = gt_grid-bottom.
call method gt_grid-grid->list_processing_events
exporting i_event_name = 'TOP_OF_PAGE'
i_dyndoc_id = gt_grid-top.
call method gt_grid-grid->list_processing_events
exporting i_event_name = 'END_OF_LIST'
i_dyndoc_id = gt_grid-bottom.
We can find all the event in list_processing_events trigger here, <b>only except 'SUBTOTAL_TEXT'!</b>
So no matter how to import parameter into 'REUSE_ALV_GRID_DISPLAY', this event won't be trigger inside of CL_GUI_ALV_GRID.
It's a big drawback, and maybe also a definite difference between FM ALV and OO ALV.
I think my requirement can't be achieve by FM 'REUSE_ALV_GRID_DISPLAY'.
All above is the research result and judgement of mine.
If it's not right, hope anyone can remind me and show me the correct way.
Thanks a lot
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi, thanks for you Amit.
Your solution is ok for ALV LIST, but it has no effect in ALV GRID.
Can anyone give me a success sample for slis_ev_subtotal_text event?
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
hi, Amit Mittal
your solution can't be used in ALV.
It's only available in the interactive report.
I think maybe the event SLIS_EV_SUBTOTAL_TEXT is useful to achieve my target.
Can anyone give me a sample code?
thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi again,
1. I have tried it at my end.
It works fantastic.
2. Even in ALV,
we can use/know SY-LISEL
when a user selects any line.
3. After All & finally,
the data in ALV List
is displayed on the screen
using
WRITE Statement ONLY.
(and no other technique)
4. If u are comfortable parsing the string
of subtotal,
u can definitely go for SY-LISEL.
I Hope it helps.
Regards,
amit m.
Hi zhenglin,
1. One way is use the contents of
SY-LISEL (in the subroutine of USER_COMMAND)
This variable will contain
the conents of the line which was
double clicked / selected.
(But the contents will be absolutely
in character / text format)
U will have to EXTRACT the figures
from ur own logic.
2. The contents would be somewhat like this :
2 | 6100003 | Testing Charges | 51,000.00 | 0.00 |
3. U can also use selfield
to determine whether it is a subtotoal
or grandtotal.
Hope it helps.
Regards,
amit m.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Check out <b>SLIS_LINEINFO</b>, Using this you can read the content of line which you are slected and based on that you can show your subtotals...
I believe this will help you...
regards
vijay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Zhenglin,
I don't think you will get the right line from the ITAB if you are going to use the index that you have got. The subtotal line is not a part of your internal table.
However, as far as my knowledge goes I don't think you will be able to get the data of the subtotal line as its calculated dynamically.
Regards,
Ravi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.