2008 Jul 04 8:27 AM
Hi Experts,
i have issue were in i need to show sum of the total currency. like example...
for Custmer 100 there are vendor number 1,2,3,4,5. so for all this vendor numbers.. the currency should b added automatically and show us the total of that currency .hope u experts have undestood. so how can i add the it and show it in the output....
Corrects answers will be fully rewarded..
Regards
Sunita.
2008 Jul 04 8:34 AM
Hi Sunita,
While Filling Field cat use Do_Sum = "X'.
Like this :
lfs_fieldcat-fieldname = 'KBETR_IV'.
lfs_fieldcat-tabname = 'T_FINAL_DATA'.
lfs_fieldcat-seltext_l = text-iof.
lfs_fieldcat-cfieldname = 'WAERS_I'.
lfs_fieldcat-do_sum = 'X'.
lfs_fieldcat-no_zero = 'X'.
lfs_fieldcat-col_pos = '6'.
APPEND lfs_fieldcat TO t_fieldcat.
CLEAR lfs_fieldcat.
lfs_fieldcat-fieldname = 'WAERS_I'.
lfs_fieldcat-tabname = 'T_FINAL_DATA'.
lfs_fieldcat-seltext_l = text-cur.
lfs_fieldcat-col_pos = '7'.
APPEND lfs_fieldcat TO t_fieldcat.
CLEAR lfs_fieldcat.
Then it Will Automaticaly calculates Sum based on Currency.
If Foun HelpFull Do reward.
Regards.
Eshwar Reddy
Hi Sunita,
While Filling Field cat use Do_Sum = "X'.
Like this :
lfs_fieldcat-fieldname = 'KBETR_IV'.
lfs_fieldcat-tabname = 'T_FINAL_DATA'.
lfs_fieldcat-seltext_l = text-iof.
lfs_fieldcat-cfieldname = 'WAERS_I'.
lfs_fieldcat-do_sum = 'X'.
lfs_fieldcat-no_zero = 'X'.
lfs_fieldcat-col_pos = '6'.
APPEND lfs_fieldcat TO t_fieldcat.
CLEAR lfs_fieldcat.
lfs_fieldcat-fieldname = 'WAERS_I'.
lfs_fieldcat-tabname = 'T_FINAL_DATA'.
lfs_fieldcat-seltext_l = text-cur.
lfs_fieldcat-col_pos = '7'.
APPEND lfs_fieldcat TO t_fieldcat.
CLEAR lfs_fieldcat.
Then it Will Automaticaly calculates Sum based on Currency.
If Foun HelpFull Do reward.
Regards.
Eshwar Reddy
2008 Jul 04 8:29 AM
hi,
Check the following link for sample code.
http://saptechnical.com/Tutorials/ALV/Subtotals/Define.htm
Hope it is useful.
Regards,
Jaya Vani
2008 Jul 04 8:30 AM
hi,
when defining the field category of the amount field in your alv grid, include the currency field of that amount in CFIELDNAME then assign 'X' to DO_SUM.
regards,
Peter
2008 Jul 04 8:32 AM
You can use sort and subtotal facility of ALV grid or else you have to calculate it in your internal table using control break statements.
Have a look at below link:
http://www.saptechnical.com/Tutorials/ALV/Subtotals/Define.htm
I hope it helps.
Thanks,
Vibha
2008 Jul 04 8:33 AM
Hi,
In ALV_GRID also for the in the field cataog structure we can have SUM = 'X'. After this use the collect statement and move to toher table.
Or
After you get the data into final internal table.
Try to loop this internal table.
At new <<fieldname>>.
And we need to use COLLECT statement which automatically adds the contents and move to other internal table.
ENDAT.
Reward if helpful.
Regards
Chandralekha.
2008 Jul 04 8:34 AM
Hi Sunita,
While Filling Field cat use Do_Sum = "X'.
Like this :
lfs_fieldcat-fieldname = 'KBETR_IV'.
lfs_fieldcat-tabname = 'T_FINAL_DATA'.
lfs_fieldcat-seltext_l = text-iof.
lfs_fieldcat-cfieldname = 'WAERS_I'.
lfs_fieldcat-do_sum = 'X'.
lfs_fieldcat-no_zero = 'X'.
lfs_fieldcat-col_pos = '6'.
APPEND lfs_fieldcat TO t_fieldcat.
CLEAR lfs_fieldcat.
lfs_fieldcat-fieldname = 'WAERS_I'.
lfs_fieldcat-tabname = 'T_FINAL_DATA'.
lfs_fieldcat-seltext_l = text-cur.
lfs_fieldcat-col_pos = '7'.
APPEND lfs_fieldcat TO t_fieldcat.
CLEAR lfs_fieldcat.
Then it Will Automaticaly calculates Sum based on Currency.
If Foun HelpFull Do reward.
Regards.
Eshwar Reddy
2008 Jul 04 9:10 AM
hi check this simple example..
REPORT ztest_alv_perc_13317.
TYPE-POOLS: slis.
DATA: it_fieldcat TYPE slis_t_fieldcat_alv,
wa_fieldcat TYPE slis_fieldcat_alv,
it_events TYPE slis_t_event,
wa_events TYPE slis_alv_event,
it_sort TYPE slis_t_sortinfo_alv,
wa_sort TYPE slis_sortinfo_alv,
l_layout TYPE slis_layout_alv.
TYPES: BEGIN OF ty_itab,
field1(10),
qty1 TYPE i,
qty2 TYPE i,
qty3 TYPE i,
dummy TYPE c,
END OF ty_itab.
DATA: itab TYPE STANDARD TABLE OF ty_itab WITH HEADER LINE,
itab1 TYPE ty_itab.
START-OF-SELECTION.
itab-field1 = 'FIRST'.
itab-qty1 = 2.
itab-qty2 = 1.
itab-qty3 = 5.
APPEND itab.
itab-field1 = 'SECOND'.
itab-qty1 = 52.
itab-qty2 = 14.
itab-qty3 = 76.
APPEND itab.
itab-field1 = 'THIRD'.
itab-qty1 = 34.
itab-qty2 = 21.
itab-qty3 = 78.
APPEND itab.
wa_fieldcat-col_pos = 1.
wa_fieldcat-fieldname = 'FIELD1'.
wa_fieldcat-tabname = 'ITAB'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = 2.
wa_fieldcat-fieldname = 'QTY1'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = 3.
wa_fieldcat-fieldname = 'QTY2'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
wa_fieldcat-col_pos = 4.
wa_fieldcat-fieldname = 'QTY3'.
wa_fieldcat-tabname = 'ITAB'.
wa_fieldcat-do_sum = 'X'.
APPEND wa_fieldcat TO it_fieldcat.
l_layout-totals_text = 'total text'.
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = it_fieldcat
is_layout = l_layout
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2
.
IF sy-subrc <> 0.
ENDIF.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |