Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Running Total Gives Incorrect Results ?...................

Dear all,

I'm new to this forums and i have a problem with my report.

Senario:-

i have created a report with two groups which will display Employee detail (Epf month wise) and Total will display in each page footer in each page.

next i have two requirements that is

:user will enter the no of records perpage

(eg:if user enter 5 then 5 recors will display in each page)

:i want to put all page totals in report footer in a sub report

that display each page total

(eg:

pageNo:

01 xxxx xxxx xxx xxx

02 xxxx xxxx xxx xxx

Both of above requirements are done by me.

Following Sections are supressed in my report

GH1,D,GF2,GF1

Thre are Two Problems

1.i have used Running Totals to get sum page wise

but the problem is totals are wrong .

accourding to my investigation i found following problems.

i have choosen paper 'A4'.

then i have two groups and supressed resluts.

i will explain senario in detail:

let say user enter records per page =3

then my report will display 3 records per page

(let say this is my first page and 3 records perpage)

recno:

1 1000.00

2. 20.0000.00

3. 500.00

according my page sum it should be 21500.00

but it differ (21000) the problem is

even it display 3 records in same page (actually because we have supressed GH2,D,GF1,GF2) when i un supressed records

the third record in 2nd page not in first page

so as a result i get first page sum as 21000 not 21500

when i use 'A3' it is give correct result but that depend on

the number of records per page entered by user.

How could i get correct result ,Can any one help me

-


Other question is i'm using an array to pass page totals to subreport .

using a loop i will get all the array values to a string and display

it.

the problem is if one field change all other string will chane:

eg:my string

1.00 0.00 50.00 34.000 1000.00

2.00 0.00 2000.000 4500.000

like in 2nd line if any large number comes it align to right

so it will diplay like above(not in proper way)

is there a way to do this with out string or is there a way to

format string (like in c++,java,.net)

Or my design is wrong

Thank You ,

Best Regards,

Former Member
replied

Hi Pradeep,

Are you using Manual Running total or the Running total from the field explorer?

Using the running total from field explorer might give you incorrect results as you have suppressed sections.

You can create three formulas for a manual running total: -

1. On the Insert menu, click Formula Field.

2. Click Formula Fields, and then click New.

3. Create these three formulas:

//@Initialize

//Assigns the RunningTotal variable an initial value of

//zero.

WhilePrintingRecords;

NumberVar RunningTotal;

RunningTotal := 0;

//@Evaluate

//Increments the RunningTotal variable by the

//current value for Orders.Order Amount}.

WhilePrintingRecords;

NumberVar RunningTotal;

RunningTotal := RunningTotal +ToNumber({Orders.Order

Amount});

//@Display

// Prints the cumulative value of the RunningTotal

// variable.

WhilePrintingRecords;

NumberVar RunningTotal;

RunningTotal;

4. Place the formulas on the report:

u2022 Place @Initialize in the report header section. Since the report header

section only occurs once in the report, the variable is initialized only

once.

u2022 Place @Evaluate in the details section. This increments the variable for

each record in the report.

u2022 Place @Display in the section where you would like to see the summary.

Please let us know if this helps.

Regards,

Abhishek Jain.

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question