2005 Dec 13 12:58 PM
Hi ,
I am working with ALV, i am displaying my ztable data in ALV ,wat is required is i should add total of a field and should be displayed at the top of the all records displayed.
Could any one plz guide me in this issue.
Regards.
2005 Dec 13 1:04 PM
Hi Aima,
In layout <b>gs_layout-totals_before_items = 'X'.</b>
this will help you..
try to close your earlier threads and reward for helpful answers...
vijay
2005 Dec 13 1:04 PM
Hi Aima,
In layout <b>gs_layout-totals_before_items = 'X'.</b>
this will help you..
try to close your earlier threads and reward for helpful answers...
vijay
2005 Dec 13 1:18 PM
Hi Vijay,
Thankx but how would i give the sum,
do i need to add it in my program or do i need to use any standard method get_subtotals
Regards.
2005 Dec 13 1:33 PM
first you need to Build sort tables
assume i have sales order, item
based on sales order change i want to give total.
for that you need to give sort table....
and
*-Sales Document #
L_SPOS = L_SPOS + 1.
IT_SORT_DATA-SPOS = L_SPOS.
IT_SORT_DATA-FIELDNAME = 'VBELN'.
IT_SORT_DATA-TABNAME = 'IT_DISPLAY'.
IT_SORT_DATA-UP = 'X'.
IT_SORT_DATA-SUBTOT = 'X'.
IT_SORT_DATA-GROUP = 'X'.
APPEND IT_SORT_DATA.
CLEAR IT_SORT_DATA.
for getting subttoal text you need to create an event with form SUBTOTAL_TEXT.
form subttoal_text.
write:/text..//.
endform.
hope you are able to follow me..
vijay
2005 Dec 13 1:53 PM
Hi Vijay,
Unfortunately i am not!
wat i have here is Data is displayed on ALV ,and now user is doing a sum for a field and now he wants it be done automatically.
i have tried the option of
<b> GS_LAYOUT-TOTALS_BEF = 'X'.</b>
it works for me.
but for displaying the total, how can ?
i have tried the FM LVC_TOTALS_GET
i had a look at<b> CALL METHOD <ref. var. to CL_GUI_ALV_GRID > ->get_subtotals</b>
but not yes succeded
Plz help me out ?
2005 Dec 13 2:06 PM
Hi,
is not possible to give a default added value on the top of ALV grid.
Could any one confirm me !
2005 Dec 13 2:08 PM
Hi aima,
Automatically means you have to do some reasearch ...
i will find out, yesterday's alv problem is over or not..
and try to close the threads
by giving appropriate points..
vijay
2005 Dec 13 2:50 PM
Hi ,
Is there any SAPprogram that reflects my requirement, i have been working around this but did not grap much.
Could any one throw some light at this issue !
it would be really great help.
Regards.
2005 Dec 13 2:54 PM
Go to SE80 and Choos Package and Give SLIS
you can find lot of examples.....
But i don't think they will match your requirement..
Wait for some more responses..
regards
vijay
2005 Dec 13 4:29 PM
Hi All,
I am still working but not yet fruitfull ,Does any one have any idea plz kindly suggest .
Regards.
2005 Dec 13 4:42 PM
Hi,
The best thing i can suggest is do a loop at the internal table & get the total in a variable.Now display the variable at the header.
Example:
FORM EVENTTAB_BUILD CHANGING LT_EVENTS TYPE SLIS_T_EVENT.
CONSTANTS:
GC_FORMNAME_TOP_OF_PAGE TYPE SLIS_FORMNAME VALUE 'TOP_OF_PAGE'.
DATA: LS_EVENT TYPE SLIS_ALV_EVENT.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
I_LIST_TYPE = 0
IMPORTING
ET_EVENTS = LT_EVENTS.
READ TABLE LT_EVENTS WITH KEY NAME = SLIS_EV_TOP_OF_PAGE
INTO LS_EVENT.
IF SY-SUBRC = 0.
MOVE GC_FORMNAME_TOP_OF_PAGE TO LS_EVENT-FORM.
APPEND LS_EVENT TO LT_EVENTS.
ENDIF.
ENDFORM.
**************
FORM COMMENT_BUILD CHANGING GT_TOP_OF_PAGE TYPE SLIS_T_LISTHEADER.
DATA: GS_LINE TYPE SLIS_LISTHEADER.
CLEAR GS_LINE.
GS_LINE-TYP = 'H'.
GS_LINE-INFO = "write ur total variable here.
APPEND GS_LINE TO GT_TOP_OF_PAGE.
ENDFORM.
***************
FORM CALL_ALV.
Pass the it_events with gt_events[].
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_CALLBACK_PF_STATUS_SET = 'FRM_PF_STATUS'
is_layout = Gs_layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = Gt_fieldcat
it_sort = Gt_sort
IT_EVENTS = <b>GT_EVENTS[]</b>
TABLES
t_outtab = ITAB1."Your Internal table
ENDFORM.
Write the performs at the end of selection event.
END-OF-SELECTION.
PERFORM BUILD. "Build your ALV here
PERFORM EVENTTAB_BUILD CHANGING GT_EVENTS.
PERFORM COMMENT_BUILD CHANGING GT_LIST_TOP_OF_PAGE.
PERFORM CALL_ALV.
2005 Dec 14 12:34 PM
Hi ,
Does'nt sounds so difficult!
only thing u have to do when filling the field catalog u should add this option GS_FLDCAT-DO_SUM = 'X'.
it ill automatically give u the sum for the corresponding field.
if u have solved problem ,Reward points tat ill surely give a motivation to all members to help!
Close the thread.
Regards.
2005 Dec 14 2:27 PM
Hi Azee,
I have tried with GS_FLDCAT-DO_SUM = 'X'
it worked , Thankx a lot.
Surely u ill be rewarded.
Regards.