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

percentage using alv grid

Former Member
0 Likes
1,085

Hi,

I have 3 columns. I am able to get their subtotals.

Now there is a 4th column which shows percentage of first five columns.

Now last record shows all the subtotals..

last record of column 1 shows the subtotal of all the records in column 1.

last record of column 2 shows the subtotal of all the records in column 2.

last record of column 3 shows the subtotal of all the records in column 3.

Now last record of column 4 should show the the percentage of first 3 columns.

How to do this!!

<REMOVED BY MODERATOR>

Regards

Edited by: Alvaro Tejada Galindo on Feb 6, 2008 2:18 PM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,038

Could you show me an example with numbers of what you need? Maybe I can help you.

Hi,

I have 3 columns. I am able to get their subtotals.

Now there is a 4th column which shows percentage of first five columns.

Now last record shows all the subtotals..

last record of column 1 shows the subtotal of all the records in column 1.

last record of column 2 shows the subtotal of all the records in column 2.

last record of column 3 shows the subtotal of all the records in column 3.

Now last record of column 4 should show the the percentage of first 3 columns.

How to do this!!

<REMOVED BY MODERATOR>

Regards

Edited by: Alvaro Tejada Galindo on Feb 6, 2008 2:18 PM

7 REPLIES 7
Read only

Former Member
0 Likes
1,039

Could you show me an example with numbers of what you need? Maybe I can help you.

Read only

0 Likes
1,038

This message was moderated.

Read only

0 Likes
1,038

I could but maybe someone else has the same doubt and if it's published here it will be more helpful. Just post a table with some numbers to clear your point and it will be easier for us to understand you.

Regards,

Pablo

Read only

0 Likes
1,038

i was trying to paste a small excel sheet, but was not able to do so. That is why i asked for your email so that i van attach it there.

Please tell how to post table with this.

I also try to explain it here with example.

Row 1: values 4 5 6 7 percentage of 4 columns

Row 2: values 1 2 3 4 percentage of 4 columns

Row 3: values 2 3 4 5 percentage of 4 columns

Row 4 contains subtotals

7 10 13 16 here i need percentage of subtotals of first 4 columns . Problem here is subtotals are coming automatically usinf ALV. How to get percentage here?

I hope i am able to explain my problem.

Read only

0 Likes
1,038

Ok, I think I understood now. You need to store the porcentage of column X where the subtotal of column X is appearing.

If you are using CL_GUI_ALV_GRID there's a method that returns a field symbol to the subtotals, it is called GET_SUBTOTALS. Since it uses field symbols, you may change the subtotals. Once you have them, you can add them and calculate the porcentage of each one. Then you can replace the values in the field symbol. Here is a sample code of how to call and change the subtotals, maybe you should call the method GET_SUBTOTALS and debug it to better understand it.

CALL METHOD go_alv_serv->get_subtotals
    IMPORTING
      ep_collect00 = lv_total.

  ASSIGN lv_total->* TO <fs_total_serv>.

  READ TABLE <fs_total_serv> INDEX 1 INTO ls_zsmmpur003.
  ls_zsmmpur003-zporcent = 100.
  MODIFY <fs_total_serv> FROM ls_zsmmpur003
         INDEX 1 TRANSPORTING zporcent.

* Refresco la grilla para reflejar los cambios
  CALL METHOD go_alv_serv->refresh_table_display
    EXPORTING
      i_soft_refresh = 'X'.

I hope it helps, reward points if found useful!

Regards,

Pablo

Read only

0 Likes
1,038

Hi Pablo,

Thanks a ton for your reply. You have understood my query correctly.

I am using FM REUSE_ALV_GRID_DISPLAY. Can you please some inputs how to do this using above FM technique.

Regards

Read only

0 Likes
1,038

I don't think you can do it with the FM....sorry. Try using that class, it's very simple!