cancel
Showing results for 
Search instead for 
Did you mean: 

Adobe form conditional breaks with subtotal

Former Member
0 Kudos

Hi,

I need to develop a form with a dynamic table that calculate a subtotal by company

Eg:

Reference Cash disc. Withh.tax Net loc. curr. CoCd

0 0 10 Z001

TESTE 1 0 0 20 Z001

TESTE 1 0 0 20 Z001

Subtotal 40

CNRWaeoitftsCh ehldhor e.cdtn.ai sccxce u.rr.

TESTE 3 0 0 30 Z002

TESTE 3 0 0 30 Z002

TESTE 3 0 0 30 Z002

90

I can set the conditional break by company but i can calculate the subtotal.

Thank you in advance.

Miguel

Edited by: miglsilva on Dec 20, 2010 1:52 PM

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

I didn't get what you mean..

Can you please explain your requirement...?

Cheers,

Sai

Former Member
0 Kudos

Hi Sai,

Thank you very much for the reply,

I have to implement something like a dynamic table:

Imagine

I have one table with the purchase items of all the companies, like that:

XBLNR NETTO Company Code

TESTE 20 Z001

TESTE 20 Z001

TESTE 30 Z002

TESTE 30 Z002

TESTE 30 Z002

TESTE 60 Z003

TESTE 30 Z003

So i have to display that by company, and when finish the las item i have to add a line with the subtotal like that:

XBLNR NETTO Company Code

TESTE 20 Z001

TESTE 20 Z001

Subtotal 40

TESTE 30 Z002

TESTE 30 Z002

TESTE 30 Z002

Subtotal 90

TESTE 60 Z003

TESTE 30 Z003

subtotal 90

I had already the conditional break for break when the data[-1].bukrs ne data.bukrs but when i put the script for calculate the value the result it is all the items.

Thank you in advance.

Miguel

Former Member
0 Kudos

Hi Miguel,

I have done exactly the same to generate customer statements as output forms. using standard ABAP approach not any web dynpro or so.

What I did for this.

I managed to generate 3 tables from your source table.

Table 1 has list of Customer Name/Number

Table 2 has list of documents (date, amount, gst etc) having a reference field customer number here.

Table 3 has list of customer numbers with totals.

In the form context i will have table 1 first, with in this will have table 2 & table 3 with where condition on this field.

On the form I will have nested tables. (since the context filters the table 2 and 3 based on the customer number of table 1) at runtime you can see the list grouped.

Let me know did you get what I mean..? more than happy to provide further info.

Cheers,

Sai

OttoGold
Active Contributor
0 Kudos

What i would do:

a) NEVER do the counting in the form,

b) I would create extra rows in the backend with the SUMs (with some kind of a flag to understand which of the lines I process in the form are the SUM ones)

c) If needed I would script a test if this is the SUM line on every line and change the background color or change font to bold or something to make it more fancy.

Otto

Former Member
0 Kudos

HI,

Thank you very much for the reply.

Sai, I don't understand very much your approach.

Otto, i think in a something like that, if you could make the script it's better for me.

Thank you in advance.

Miguel.

OttoGold
Active Contributor
0 Kudos

I am afraid you don´t get me. Do this in ABAP in your backend. Then you don´t need any script.

Otto

Former Member
0 Kudos

Hi Otto,

I got you..

I would try that with a xml data source.

but I have one doubt, lets say the data is not grouped/sequenced by customer number then is it possible to sort it based on customer number on the form (just in case I have no chance to sort it in the interface or the source program.)

Thanks & Regards,

Sai

OttoGold
Active Contributor
0 Kudos

In my opinion you can always do things in backend. Even if it is about a SAP standard form, you can change the printing program, repair it or something, use form interface. The fact you can achieve this through scripting does not mean you should do it (or it was meant to be done this way). I only offer suggestions, you don´t have to do it my way...

Otto

Former Member
0 Kudos

Hi,

Now i'm trying to use one script in javascript for calculate the sub-total value from the table.

I use this code but i can't obtain the reference for the fields


var fields = xfa.layout.pageContent(xfa.layout.page(this)-1, "field", 0);
var total = 0;
for (var i=0; i <= fields.length-1; i++) {
if (fields.item(i).name == "PRICE") {
total = total + fields.item(i).rawValue;
}
}
this.rawValue = total;

In the hierarchy i use subform with the role of a table.

Anyone can help, what i did wrong ?

Thank you in advance.

Edited by: miglsilva on Dec 27, 2010 4:01 PM

Former Member
0 Kudos

Hi

Like Otto and also others have suggested, do this at the back end. It is just a few lines of abap... Using this script approach you will face some challenges sooner or later.

Br,

Hannu

Former Member
0 Kudos

HI Hannu,

Thank you for the reply,

I'am already do that on the backend, what i wan't to understand it's why i can't obtain the reference for the fields in adobe.

Thank you.

Miguel

Former Member
0 Kudos

Hi,

If the total has to be calculated from a single field in a table.

Just say


Sum(page1.sfform1.table1.row1.field[*]); // this example just replace your field path there ...

Cheers,

Sai

Answers (0)