Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

ALV Reports ?

Former Member
0 Likes
366

<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

1 REPLY 1
Read only

Former Member
0 Likes
341

Got the solution