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: 

Dividing two columns subtotals & place the result in another column in ALV report.

isurug
Discoverer
0 Kudos
921

Dear Experts,

I am developing a SAP ALV report and I have to get two fields sub total based on the customer code. After that I have to divide two columns and paste the result in another column. I have no idea to how to divide two columns and paste the result in another column. Please help me sort out that matter.

Thanks for any solution to that matter.

6 REPLIES 6

xiswanto
Active Participant
0 Kudos
829

I have to get two fields sub total based on the customer code
-> well either you use the alv subtotal feature or you remove the duplicate row of customer code and sum each customer code before calling the ALV

After that I have to divide two columns and paste the result in another column.

-> divide columns? I also have no idea what you are trying to achieve, dividing two column into four? Also, what is this 'result', subtotal of two number columns?

Perhaps showing the example of your current and expected result might help people get a clearer picture of your requirement.

isurug
Discoverer
0 Kudos
829

Dear Siswanto Tan,

I got amount and debtor days subtotal sort by customer code. Therefore, multiple subtotals will show. I want to divide amount column subtotal by debtor days column subtotal and paste the result in another column.

Sandra_Rossi
Active Contributor
0 Kudos
829

I don't see the column "debtor days" in your ALV.

Please show your actual ALV and your expected ALV (including all columns).

Simple Excel example is sufficient, just paste the screenshot.

RaymondGiuseppi
Active Contributor
0 Kudos
829

Basically you need to handle some 'at display' class event such as AFTER_REFRESH that allows to use methods such as CL_GUI_ALV_GRID-GET_SUBTOTALS to read standard calculated subtotals, recalculate and update 'specific' subtotal fields such as percentage or non standard average and then display those with a call REFRESH_TABLE_DISPLAY (Set an attribute to prevent infinite loop)

There should be some solution for CL_SALV_TABLE (but I didn't do it, nobody...)

isurug
Discoverer
0 Kudos
829

Dear Sandra Rossi,

Please refer the attached photo.

Sandra_Rossi
Active Contributor
0 Kudos
829

I thought it would clarify my understanding that the result column is a division of AMOUNT by DEBTOR DAYS, but it did not.

Sorry to ask more questions:

  • I guess the yellow lines are the subtotals by customer code, but why do we have 550,000.00 and 7,905 for customer 75000089?
  • What should be the value for "result"? (at least for customer 75000089)