2007 Jun 05 7:06 AM
<b>Hi All,
I am trying to print the values in my internal table using ALV, using ABAP classes and objects. Here i am able to get the total succesfully. but i need to get subtotals also, like based on the carrid in table sflight i need subtotal of price for every carrid like 'LH' , 'SQ'.
here is my code:</b>
REPORT znav_report.
DATA: alv TYPE REF TO cl_salv_table,
value1 TYPE REF TO cl_salv_aggregations,
value2 TYPE REF TO cl_salv_aggregation.
DATA: BEGIN OF itab_flight OCCURS 0,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
price LIKE sflight-price,
paymentsum LIKE sflight-paymentsum,
currency LIKE sflight-currency,
END OF itab_flight.
SELECT carrid
connid
fldate
price
paymentsum
currency
FROM sflight INTO TABLE itab_flight
WHERE carrid = 'LH' OR carrid = 'SQ'.
cl_salv_table=>factory( IMPORTING r_salv_table = alv
CHANGING t_table = itab_flight[] ).
CALL METHOD alv->get_aggregations
RECEIVING
value = value1.
CALL METHOD value1->add_aggregation
EXPORTING
columnname = 'PAYMENTSUM'
aggregation = if_salv_c_aggregation=>total
RECEIVING
value = value2.
alv->display( ).
<b>here how to get subtotals for every different carrid.</b>
regards,
Navneeth.K
<b>Hi All,
I am trying to print the values in my internal table using ALV, using ABAP classes and objects. Here i am able to get the total succesfully. but i need to get subtotals also, like based on the carrid in table sflight i need subtotal of price for every carrid like 'LH' , 'SQ'.
here is my code:</b>
REPORT znav_report.
DATA: alv TYPE REF TO cl_salv_table,
value1 TYPE REF TO cl_salv_aggregations,
value2 TYPE REF TO cl_salv_aggregation.
DATA: BEGIN OF itab_flight OCCURS 0,
carrid LIKE sflight-carrid,
connid LIKE sflight-connid,
fldate LIKE sflight-fldate,
price LIKE sflight-price,
paymentsum LIKE sflight-paymentsum,
currency LIKE sflight-currency,
END OF itab_flight.
SELECT carrid
connid
fldate
price
paymentsum
currency
FROM sflight INTO TABLE itab_flight
WHERE carrid = 'LH' OR carrid = 'SQ'.
cl_salv_table=>factory( IMPORTING r_salv_table = alv
CHANGING t_table = itab_flight[] ).
CALL METHOD alv->get_aggregations
RECEIVING
value = value1.
CALL METHOD value1->add_aggregation
EXPORTING
columnname = 'PAYMENTSUM'
aggregation = if_salv_c_aggregation=>total
RECEIVING
value = value2.
alv->display( ).
<b>here how to get subtotals for every different carrid.</b>
regards,
Navneeth.K
2007 Jun 13 6:43 AM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |