Rita Kotecha
11th July 2005, 15:33
Hi,

I have a report where I have No. of lines printed from the service order. I have a layout after.orno where the total is printed and another after.fieldname where the authorised signatory is printed.

In the report script I have written in the before.layout of the after.orno
need(23)

as I want the total and the signature on the same page and the layouts after.orno and after.fieldname have 23 lines in all.

With this it works fine.

Can any one tell me If I can dynamically calcuate the no. of lines to be printed in and below the field.orno layout (instead of hardcoding 23)?

evesely
11th July 2005, 20:57
You could look up the number of rows for the layouts in the ttadv331 table (ttadv331.rows, company 0) using the various index fields (i.e., language, PVRC, report, layout), sum them together, and use the need() function with this total as the argument in the before.layout of the first layout. I haven't ever tried it, but it should be possible.

Rita Kotecha
12th July 2005, 15:44
Are there any standard functions from which I can get the current report and layout in the report script.

Then only I can search in ttadv331 for the layouts following it and the no of lines for the same.

evesely
13th July 2005, 15:57
Try spool.report and lattr.layout.id$.

Rita Kotecha
14th July 2005, 13:53
Hi Mr Evesely,

Can you please explain me more about lattr.layout.$id

evesely
14th July 2005, 15:49
If you step through a report in debug mode, there are a ton of variables that have values. When you get to the section of code pertaining to the layout where you want to use need(), look at the value of the lattr.layout.id$ variable. It contains the name of the current layout (e.g., "detail.1", "before.ticst001.pono.1"). I'm not sure why you need this; unless you are making a generic function, you already know the layout for which you are writing code.

Once you know the layout, it's just a matter of mapping it to the fields in ttadv331. The layout type field is enumerated (after field layouts are ttadv.layt.after.field = 5).

I hope that helps.

Rita Kotecha
18th July 2005, 16:54
Thanks Mr evesly,

Shall try it in my code and post the report scipt once I am through. Yes the purpose is to write a general dll.