Skip to Content

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

Passing array values to a sub report

Hi everyone,

I had a little problem with passing values to a sub report through array.

I have two groups in my main report. And in the second group I want to store the values being printed out in the array and pass them to the sub report.

I created a formula in the main report and placed it in the second group footer.

Then I placed the sub report in the first group footer and created a formula to retrieve the values of the array. But the same value printed on every page.

What am I missing?

Thank you.

Here's the formula I created in the main report:                                             This is the formula in the sub report:

WhilePrintingRecords;                                                                               WhilePrintingRecords;

shared numberVar array values;                                                                shared numberVar i;

shared numberVar i;                                                                                   local numberVar j;

i:=i+1;                                                                                                         numbervar v;

redim preserve values[i];                                                                           shared numberVar array values;

if i=1 then                                                                                                  for j:=1  to i step 1 do 

values[i]:={@total}                                                                                     v:=values[j];

else if not({@total} in values[1 to i]) then                                                   v;

values[i]:={@total}

else

(

i:=i-1;

)

Tags:
Former Member
replied

Assuming position 1 of the array corresponds to value 1 of the Group in the Subreport, 2 corresponds to value 2 in the Subreport, try this:

whileprintingrecords;

shared numbervar array values;

numbervar x := x + 1;

values[x];

-Abhilash

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