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

logic inside internal table

former_member185116
Active Participant
0 Likes
504

hello all,

i have a requirement like this,

there are two select statements like below

select * from IFLO appending corresponding fields of table it_itab_33kv

where begru eq '006F' and fltyp eq '6'.

select * from IFLO appending corresponding fields of table it_itab_33kv

where begru eq '004F' and fltyp eq '4'.

i wanted to do some thing like this in my ALV report

serno      cost center     cost center name    no:of 33kv substations       no:of 11kv feeders


1              0402120401       xxxxx                         2                                          1

2              0402120301       xxxxx                         1                                          3

3              0402120201       xxxxx                         3                                          2

cost center wise i need to aggregate this,

how do i write my logic in internal table....

suggest me some ways....

thankq

2 REPLIES 2
Read only

former_member206650
Active Participant
0 Likes
471

Hi,

in the final alv grid u want to display  first u sort the cost center and if you want to add the 33 kv and 11 kv feeder.use the code

data: l_grid type ref to cl_salv_table,
       lr_functions type ref to cl_salv_functions_list.
CONSTANTS: gc_true  TYPE sap_bool VALUE 'X'.

sortlt_final ascending costcenter.

loop at lt_final into wa_final.

collect wa_final into lt_final.

endloop.

CALL METHOD cl_salv_table=>factory
   IMPORTING
     r_salv_table = l_grid
   CHANGING
     t_table      = lt_final.

lr_functions = l_grid->get_functions( ).
lr_functions->set_all( gc_true ).

l_grid->display( ).

hope it helps...do reward so

Read only

Former Member
0 Likes
471

Hi Vinay ,

Do you want to aggregate the last two columns depending upon the Cost center?

Then you can make use of AT NEW and AT END OF keywords to achieve it.

With that , you will come up with an internal table consisting of Cost center and aggregated values of required columns.

Is that your requirement?

Regards,

Barkha