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 calculation

Former Member
0 Likes
657

hi guru,

i have 2 vaues one is onspec total = 543 . 00

grand total = 1098.00

how i caculate percentage means i want (543 / 1098)*100

help me in alv ....

thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
612

hi subhasis.....

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'.

Regards..

Sudarsan

3 REPLIES 3
Read only

Former Member
0 Likes
612

For the percentage u need to use a numeric variable where to store the value:

PERC = NUM / SUM * 100.

Use:Function Module - CALCULATE_PERCENTAGE calculates the Percentage

Reward points if it is useful..

Read only

Former Member
0 Likes
612

Hi,

DATA : v_subtotal TYPE I,

v_grntotal TYPE I,

v_percen TYPE I.

onspec total = 543 . 00

grand total = 1098.00

v_percen = ( v_subtotal / v_grntotal ) *100.

WRITE : v_percen.

Read only

Former Member
0 Likes
613

hi subhasis.....

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'.

Regards..

Sudarsan