BAAN IV Tools Reports

46
BAAN IV Tools Reports Module description 7775 US

Transcript of BAAN IV Tools Reports

Page 1: BAAN IV Tools Reports

BAAN IV Tools

Reports

Module description 7775 US

Page 2: BAAN IV Tools Reports
Page 3: BAAN IV Tools Reports

Reports

i

Document

Number : 7775 USType : Training materialName : ReportsVersion : ADate : January 1996

Document information

© Copyright 1996 Baan Development B.V. The Netherlands

All rights reserved. No part of this publication may be reproduced and/or published by print, photoprint,

microfilm, audiotape, electronically, mechanically or any other means, or stored in an information

retrieval system, without prior permission from the copyright owner.

The information in this document is subject to change without notice and should not be considered as a

commitment by Baan Development B.V. No responsibility is assumed for any error which may appear in

this document.

Page 4: BAAN IV Tools Reports

Reports

Reports

ii

Page 5: BAAN IV Tools Reports

Reports

iii

1. Reports in perspective 1.11.1 Reports in BAAN IV 1.11.2 Customizing reports in BAAN IV 1.1

2. The printing process 1.12.1 The data flow from tables to paper 1.12.2 The printing-process 1.12.2.1 Session 1.22.2.2 Program script (object) 1.22.2.3 Form 1.32.2.4 Report 1.32.2.5 Device 1.32.2.6 Query 1.3

3. Developing and customizing reports 3.13.1 Procedure to develop or customize a report 3.13.2 Prerequisites 3.23.2.1 Package VRC for development 3.23.2.2 Development parameters 3.23.2.3 Developer authorizations 3.23.2.4 Current package VRC 3.23.2.5 Preparations 3.2

4. Mandatory and Optional Sessions 4.14.1 Maintain Report Default Sizes (ttadv3140m000) 4.14.2 Maintain Report Parameters (ttadv3141m000) 4.24.3 Design the report 4.24.3.1 Components of a report 4.24.3.2 Types of reports 4.34.3.3 Remarks about the examples 4.44.4 Maintain Reports (ttadv3130m000) 4.44.5 Maintain Report Input Fields (ttadv3132s000) 4.54.6 Maintain Report Layouts (ttadv3131s000) 4.54.7 Fields on a layout 4.74.7.1 Maintain Report Fields (ttadv3134s000) 4.84.7.2 Maintain Report Label Fields (ttadv3143s000) 4.84.7.3 Maintain Report Special Fields (ttadv3133s000) 4.94.8 Edit report script 4.94.9 Compile Reports (ttadv3240m000) 4.104.10 Maintain Sessions (ttadv2100m000) 4.114.11 Test the Report 4.11

5. Other Sessions 5.15.1 Display Reports (ttadv3530m000) 5.15.2 Display Objects by report (ttadv3536m000) 5.15.3 Print Reports (ttadv3430m000) 5.25.4 Print Current Reports for Package VRC (ttadv3431m000) 5.25.5 Delete Unchanged Objects by Report (ttadv3236m000) 5.3

Table of contents

Page 6: BAAN IV Tools Reports

Reports

Reports

iv

5.6 Global Replace of Report Data (ttadv3230m000) 5.35.7 Maintain Report Editor Options (ttadv3139m000) 5.3

6 Exercises 6.1Exercise 1 Report type 2 6.2Exercise 2 Report type 3 6.3Exercise 3 Calculated Field 6.4Exercise 4 Calculations 6.5Exercise 5 Stock Transaction with summary 6.6Exercise 6 Average stock value 6.7Exercise 7 Devision by Zero Error 6.9Exercise 8 User name on a report (1) 6.10Exercise 9 User name on a report (2) 6.11Exercise 10 Date format 6.12Exercise 11 Reading a (not supplied) reference table 6.13

Page 7: BAAN IV Tools Reports

Reports

v

Structure

This document supports the BAAN IV classroom training session forcustomization and development of reports for the BAAN IV applications.

Two main topics are described in This document: the use of reports andthe way in which reports can be developed and customized to meet theusers’ requirements.

After placing reports in perspective to BAAN IV and discussing theiruse, the procedures and prerequisites for creating new reports andmodifying existing reports are explained.

Character based and graphical environment

BAAN IV can be used in a character based environment (ASCII) and bymeans of a graphical user interface (GUI). One of the differencesbetween these two environments is that in ASCII, the commands aremostly given using keystrokes, while in the GUI, this can be done usingdrop-down menus, buttons, mnemonics or short cuts. (For explanationsof these terms, see the book on the User Interface (7781US).) Thisdocument sometimes describes how to activate sessions or steps.Whenever that is done, the key commands for ASCII are named and(only) the pull down menu commands for the GUI.

On-line help

For detailed descriptions of this subject, there is comprehensive on-linehelp available in the system. The on-line help information can bedisplayed by entering a question mark [?] in the Choice field [sessionhelp] or the fields [field help] in the ASCII environment, or by selectingthe corresponding action from the Help drop-down menu.

Course

This document does not specifically relate to one course. A course cancover a number of subjects or parts of subjects making use of therelated books.

Introduction

Page 8: BAAN IV Tools Reports

Reports

Reports

vi

Page 9: BAAN IV Tools Reports

Reports

1 - 1

This chapter is divided in two parts: in the first part, the use of reportswill be described, and then the customizing and developing of reportswill be explained in the second part.

1.1 Reports in BAAN IV

Reports are used to present data from the database usually on paper.This presentation is called a report layout. in BAAN IV, there are manyreports to present different data related to customers, suppliers, items,invoices, etc.

A report can be activated by starting the process in a print session or aquery, which can be selected from a menu.

A report can be sent to a device, such as a physical printer, the display,or to a file in various formats, such as Uniplex™, WordPerfect™, ASCII,Ventura™, etc.

1.2 Customizing reports in BAAN IV

If the presentation of the data on an existing report does not satisfy thebusiness requirements, the report can be changed or a new onecreated using BAAN IV Tools (Customization).

This customizing is done through the report editor in BAAN IV Tools(Customization), which is a 4-GL interface to facilitate difficultprogramming. If the business requirements have still not been satisfiedafter using Tools, additional 3-GL-programming can be done bycreating a report script.

Multi-column reports can be created for a variety of reasons, such asfor printing adhesives.

1. Reports in perspective

Page 10: BAAN IV Tools Reports

1 Reports in perspective

Reports

1 - 2

Page 11: BAAN IV Tools Reports

Reports

2 - 1

In this chapter the global data flow from database tables to a report isexplained along with the printing process.

A report is prepared after data, which has been entered in a session orquery, is processed. The session or query retrieves the data from thedatabase.

2.1 The data flow from tables to paper

Figure 2-1 shows how data flows from a database table through asession or query through a report to the printer which presents theresults on paper. A data flow through UNIX is not depicted in this figure.

Figure 2-1 Place of a report in the data flow

To use an existing report, there has to be a session to retrieve the datafrom the BAAN IV tables. There will be selection criteria from which tochoose on a form (screen) of type 4. After the printing process begins,additional information must be supplied, such as the report to beselected, printer (or device) to be used, etc.

If a query is used to retrieve the data for a report, a report name mustbe entered for the query. After the query begins, the process is similarto the process using a session in that additional information must beentered.

There are other ways to view data besides printing reports. Forexample, a display session can be used to retrieve the required data.

2.2 The printing-process

The print session retrieves data for the report. Figure 2-2 shows theuser input entered in a session sent to the program script and report-object.

2. The Printing Proces

DatabaseSession

orQuery

ReportDataflowDataflowDataflow

Page 12: BAAN IV Tools Reports

2 The Printing Proces

Reports

2 - 2

Figure 2-2 The printing process

2.2.1 Session

Sessions are software components that combine the main program (acompiled program script or object) of this session, the forms (screens)or user-interface, and the main table in which the data is processed andstored.

A print session consists of a main program that is initiated after theforms have been processed. This is described next.

2.2.2 Program script (object)

The program (4-GL) reads the main table and related tables. Thelogistics of the data flow is also controlled by this script

The program script cannot be changed because Baan delivers only theobject and not the sources, which explains the reason the programscript does not change unless the sources are also bought. In certainsituations, a query can be used instead of a program script if the querywill read data from tables.

For each record in the table, all related records from other tables and allglobal variables (for data not stored in tables) are sent to the report. If afield from a table is retrieved and shown on the report, other relatedfields will be available for display, as well.

Program(script)

Form(s)with

selection criterea

Device Reportname

Report-object

Database(tables)

TemporaryFile

Optionalsorting

Page 13: BAAN IV Tools Reports

2 The Printing Proces

Reports

2 - 3

2.2.3 Form

The form for a print session is the user interface which allows the entryof selection criteria to retrieve and print the data. This often includesranges of data. The printing process is started by a user command inthis form.

2.2.4 Report

If more than one report is attached to a print session, the main programprompts for the report to be used. The data retrieved from the tables bythe main program (main object) will be sent to the selected report.

The report itself is also a program (report object), which executes itselfand communicates with the main program to receive data.

In the optional report script, additional data manipulation can beprogrammed. This report script will be part of the bigger report program(report object).

The following criteria must be entered in a print session:

n The subset of the data (sent by the session) to be used in the reportn the presentation of the delivered datan the page layoutn the order of the datan the kind of data manipulation to be performedn the additional data (not delivered by the session) that must be

retrieved from the database

2.2.5 Device

After the report has been chosen, the main program will start a sessionto allow selection of the device to print the report. In the form used inthis process, various selections can be made, such as the paper typeand font. This data will also be sent to the report to enable the reportobject to create its own layout.

2.2.6 Query

A query can be substituted for a print session. This subject will becovered in the Queries (7776US) book.

Page 14: BAAN IV Tools Reports

2 The Printing Proces

Reports

2 - 4

Page 15: BAAN IV Tools Reports

Reports

3 - 1

This chapter will describe the general procedure for developing andcustomizing reports. Also, the prerequisites for this procedure will beoutlined. The next chapter will be more detailed about the specific stepsin the procedure.

3.1 Procedure to develop or customize a report

Figure 3-1 Procedure to develop or customize a report

3. Developing and customizing reports

Maintain ReportDefault Sizes

(ttadv3140m000)

Maintain ReportParameters

(ttadv3141m000)

Design the reporton paper

Maintain Reports(ttadv3130m000)

Maintain ReportLayouts

(ttadv3131s000)

Maintain ReportFields

(ttadv3134s000)

Maintain ReportLabel Fields

(ttadv3143s000)

Maintain Report Special Fields

(ttadv3133s000)

Edit Report Script(user option 4 inttadv3130m000)

Compile Reports(ttadv3240m000)

Maintain ReportInput Fields

(ttadv3132s000)

Test the Report

Maintain Sessions(ttadv2100m000)

Page 16: BAAN IV Tools Reports

3 Developing and customizing reports

Reports

3 - 2

3.2 Prerequisites

Certain prerequisites must be taken care of before a report can bedeveloped or customized. These prerequisites will be discussed in thissection (3.2). The discussion on the procedure related to prerequisitescan be found in the Administration (7782US) book.

3.2.1 Package VRC for development

An extra package Version Release Customer Extension (VRC) mustexist next to the standard package VRC.

3.2.2 Development parameters

Development parameters must be defined for the user.

3.2.3 Developer authorizations

The user must have development authorizations for the extra packageVRC.

3.2.4 Current package VRC

The user’s current package VRC must equal the extra package VRC.When a customization or development session is started, the actionsare always processed for the user’s current package VRC.

3.2.5 Preparations

Before beginning a procedure to develop or customize a report, thefollowing items should be checked.

Has a thorough analysis of the needed changes been conducted?

Do printouts exist with information about sessions, forms, reports,labels, domains, tables, and relations between tables (i.e., IDEFscheme)? The following session can be used to print the necessaryinformation:

n Print Sessions (ttadv2400m000)n Print Forms (ttadv3400m000)n Print Reports (ttadv3430m000)n Print Labels (ttadv1440m000)n Print Domains (ttadv4400m000)n Print Table Definitions (ttadv4420m000)•• Maintain Idef1-X Data (ttadv4131m000)

Page 17: BAAN IV Tools Reports

Reports

4 - 1

In this chapter, the procedure steps for creating and adjusting reportsare described.

4.1 Maintain Report Default Sizes (ttadv3140m000)

In this session, default sizes and font types are defined for a report tostandardize page setting sizes.

Figure 4-1 Maintain Report Default Sizes

Figure 4-1 shows the different page set-up settings that can bemaintained in this session. To have the system automatically calculatedthe number of lines for the footer, enter a value of -1. Sometimes it isnecessary to enter a fixed value, for example, if there is more than onefooter.

4. Mandatory and Optional Sessions

Line Length

Top Margin

Bottom Margin

Page Length

Footer area

Left Margin

Page 18: BAAN IV Tools Reports

4 Mandatory and Optional Sessions

Reports

4 - 2

If the different footers also have different sizes and they are printedconditionally, it will be difficult for the system to calculate the number oflines. In this case, the number of lines of the biggest footer should beentered as the length of the footer.

As with the footer, if a value of -1 is entered for the Page Length, thesystem will calculate the lines left to be printed at runtime.

A paper type can also be selected when starting a print session andspecifying a device. The paper type will define the number of lines to beprinted on the paper. The system will determine the page length byusing the paper type, if -1 is entered for the page length.

4.2 Maintain Report Parameters (ttadv3141m000)

In the Maintain Reports (ttadv3130m000) session, the description of areport can be entered. This description can be put on the report itself bymaking an entry in a Report Special Field (see the Maintain ReportSpecial fields (ttadv3133s000) session).

When the report is compiled (not run), the Report Description can beconverted to uppercase automatically by setting the Convert specialreport description to upper case parameter to Yes in the MaintainReport Parameters (ttadv3141m000) session.

4.3 Design the report

To design a report, the necessary data to include must be determinedand there should be an idea of what the report should look like topresent the required data. The report components and types must beknown to design the layout.

4.3.1 Components of a report

There are many components making up a report, such as headers andfooters. A report layout can contain the following items:

n Report Special Fieldsn Report Fieldsn Label Fieldsn Ordinary characters including graphical characters (like box

characters)

The first three items will be explained later in this chapter. The last itemis self-explanatory.

Page 19: BAAN IV Tools Reports

4 Mandatory and Optional Sessions

Reports

4 - 3

4.3.2 Types of reports

The structure of the layout must be known to design a report on paper.There are three types of reports, which resemble the Form types I, IIand III. In designing a report, these layout types are built with specificlayout types in the Maintain Report Layouts (ttadv3131s000) session.Here are some examples of the three types of reports.

Type I reportThe Type I report is a standard report with the data being listed in ahorizontal format. Note that for each item (making up a single record),several lines are required to display the data.

Date : 95-03-01 [10:45] VAT CODES Page : 1company ISC Company : 603VAT Code : 001Description: no VATPercentage : 0.00

VAT Code : 002Description: low VATPercentage : 5.00

VAT Code : 003Description: medium VATPercentage : 10.00

VAT Code : 004Description: high VATPercentage : 15.00

Figure 4-2 Type 1 report

Type II reportIn a Type II report, the data in each row belongs to a different recordwhile the columns represent the fields of each record.

Date : 95-03-01 [10:05] WAREHOUSE DATA INFO Page : 1company ICS Company : 603Warehouse Code Description Blocked y/n100 warehouse #100 no200 warehouse #200 no300 warehouse #300 no400 warehouse #400 no500 warehouse #500 yes600 warehouse #600 yes700 warehouse #700 yes800 warehouse #800 yes900 warehouse #900 yes

Figure 4-3 Type II report

Type III reportA report of this type displays records related to a common key (view). InFigure 4-4, gardening tools and measuring tools are two examples of acommon key with related records listed beneath the key.

Page 20: BAAN IV Tools Reports

4 Mandatory and Optional Sessions

Reports

4 - 4

Date : 95-03-01 [11:37] ITEM Page : 1company ISC Company : 603Item Code Description Purchase Price Stock on Hand Stock Value

Item Group : 010 gardening tools

1010301 spade 17.5 x 17 x 27 120.00 2200 264,000.00 1010395 spade 15 x 16.5 x 28 120.00 1000 120,000.00 1010956 spade 10 x 12.5 x 32 100.00 225 22,500.00

Total : 406,500.00

Item Group : 011 measuring tools

1100017 ruler (length 1m) 30.00 100 3,000.00 1100033 ruler (length 2m) 40.00 20 800.00 1101870 tape measure digital 120.00 75 9,000.00 1101897 tape measure ultraso 250.00 80 20,000.00 Total : 32,800.00

Item Group : 012 hammers

1200011 hammer 50gm 20.00 55 1,100.00 1200046 hammer 150gm 30.00 300 9,000.00 1200054 hammer 200gm 35.00 750 26,250.00 1200070 hammer 250gm 40.00 125 5,000.00 1200097 hammer 400gm 50.00 550 27,500.00

Total : 68,850.00

Figure 4-4 Type III report

4.3.3 Remarks about the examples

Type I and II reports contain only header and detail layouts. In the TypeIII report, there are also a Before.field layout and an After.field layout.These layouts are described below in the discussion on the MaintainReport Layouts session.

4.4 Maintain Reports (ttadv3130m000)

In this session, a new report can be inserted or copied to a new name.This copying or inserting is performed using the current package VRC.

In this session all data is entered to connect the report with othersoftware components, such as:

n The name of the report. This subject is discussed in more detail inthe Customization and Development General Data (7787US) book.

n The language of the report. A language is attached to a report,which will also determine the language of the software component.

n The package VRC, in which the default value, current packageVRC, is automatically displays. This VRC should be between the“root” package VRC (delivered by Baan) and the package VRC thatis entered in the Maintain Packages by Package Combinationsession. To see the detailed procedure, refer to the Administration(7782US) book.

Page 21: BAAN IV Tools Reports

4 Mandatory and Optional Sessions

Reports

4 - 5

4.5 Maintain Report Input Fields (ttadv3132s000)

The print session will retrieve all variables considered external includingtable fields for the report.

The table fields and variables specified in this session act like a filter onthe table fields and variables retrieved by the session or query.

If a table field or variable is specified and is not retrieved by the sessionor query, it will be shown as empty or zero (depending on the type ofthe domain) because if something does not go through this session’sfilter, it cannot come out either to be included in a report.

When a new report is developed, all fields to be used must be entered,but when an existing report needs to be adjusted, it is not mandatorybut may be necessary to enter new fields.

The domain will be filled in automatically for a table field. For a variablename, the domain of the variable must be entered. The term, “domain,”is explained in the Customization and Development General Data(7787US) book.

In addition, the sort mode can be specified in this sub-session tooverride the order of the data retrieved. If the sort mode is specified,the printing of the report will slow down a bit because an extra sort stepwill be used in the printing process.

A value for a depth can be entered, but if the Input Field is a table fieldwith a depth, the system will use that depth value automatically. For avariable (i.e., anything that is not a table field), the depth must beentered, but this should usually be 1. In case of a depth bigger than 1,the field is an array. An array is a row of the same type of variable thatcan be accessed by the name of the variable and an index number (forexample, var(10)).

4.6 Maintain Report Layouts (ttadv3131s000)

A layout must be specified to provide a place to put report fields. Alayout is a specific region of the report layout to be printed, for example,a header. The header will be printed on the top of each page. Thereport program determines when a region is printed.

Different layouts can be entered to create the report layout. The type oflayout is an enum field, i.e., a field with enumerated values making it alist with a limited number of values.

Page 22: BAAN IV Tools Reports

4 Mandatory and Optional Sessions

Reports

4 - 6

The following are different types of layouts:

n Before.reportn Headern Before.fieldn Detailn After.fieldn Footern After.report

Figure 4-5 Sample Report with Different Types of Layouts

A layout can be printed report under different conditions. For example,left and right pages can be created by creating two layout sequences ofthe same type and then assigning a condition for even and odd pagesto the type.

There can also be a fixed font type for a layout but the font type mustbe fixed in the Maintain Reports session, as well.

= Header

= Before.field

= Detail

= After.field

Date : 95-03-01 [11:37] ITEM Page : 1

company ISC Company : 603

Item Code Description Purchase Price Stock on Hand Stock Value

Item Group : 010 gardening tools

1010301 spade 17.5 x 17 x 27 120.00 2200 264,000.00

1010395 spade 15 x 16.5 x 28 120.00 1000 120,000.00

1010956 spade 10 x 12.5 x 32 100.00 225 22,500.00

Total : 406,500.00

Item Group : 011 measuring tools

1100017 ruler (length 1m) 30.00 100 3,000.00

1100033 ruler (length 2m) 40.00 20 800.00

1101870 tape measure digital 120.00 75 9,000.00

1101897 tape measure ultraso 250.00 80 20,000.00

Total : 32,800.00

Page 23: BAAN IV Tools Reports

4 Mandatory and Optional Sessions

Reports

4 - 7

A layout can span an area of up to 22 lines. If more lines are needed ina layout, two or more layouts of the same type must be created withdifferent sequence numbers.

A layout can be edited after it has been inserted by using the writecommand and then specifying the layout to be edited. Layouts can beedited all at once in one screen.

4.7 Fields on a layout

Report fields are used to represent specific data. There are three typesof report fields:

n report fieldsn report label fieldsn report special fields

Report fields are used to represent table fields (or variables). Reportlabel fields are used to display language-dependent text. Report specialfields are used for the report or company name. For the three availabletypes of fields there are some common elements. The user can specifythe position, the size and the print effects (bold, underline, etc.). Thenext figure shows a report and the fields are depicted.

Figure 4-6 Fields in a report

Date : 95-03-01 [11:37] ITEM Page : 1

company ISC Company : 603

Item Code Description Purchase Price Stock on Hand Stock Value

Item Group : 010 gardening tools

1010301 spade 17.5 x 17 x 27 120.00 2200 264,000.00

1010395 spade 15 x 16.5 x 28 120.00 1000 120,000.00

1010956 spade 10 x 12.5 x 32 100.00 225 22,500.00

Total : 406,500.00

Item Group : 011 measuring tools

1100017 ruler (length 1m) 30.00 100 3,000.00

1100033 ruler (length 2m) 40.00 20 800.00

1101870 tape measure digital 120.00 75 9,000.00

1101897 tape measure ultraso 250.00 80 20,000.00

Total : 32,800.00

= Report Special Fields

= Report Label Fields

= Report Fields

= Report Field with Agregate Function

Page 24: BAAN IV Tools Reports

4 Mandatory and Optional Sessions

Reports

4 - 8

A field can be specified on a layout by using the report editor to placethe field at the cursor position. To display the command to perform thisaction (and additional commands, as well), enter <Esc> H in ASCII, orusing the Help drop-down menu in the GUI.

4.7.1 Maintain Report Fields (ttadv3134s000)

Report fields are used to display the input fields specified in theMaintain Input Fields (ttadv3132s000) session on a layout.

Table fields and variables can be entered in a report field.

When a text field (field of the text data type) is entered, texts createdusing the text editor can be printed in the reports. If the length of a textline exceeds the length defined in the report, the remaining text on thatline is truncated, and placed on the following line. Each layout mayhave more than one text field, except for the detail line, which may onlyinclude one text field.

A function (conditional) can also be applied to a field. The aggregatefunctions include:

n Countn Totaln Cumulativen Minimumn Maximumn Average

The aggregate function, Total, will calculate and sum all valuesdepending on the layout type. For example, when the Total function isapplied to a footer, the Print Expression will be totaled for each page. InFigure 4-6, the aggregate function is applied to the After.field layouts tototal the stock value for each item group.

4.7.2 Maintain Report Label Fields (ttadv3143s000)

Language-dependent text can be managed with labels. Labels areused to keep text constant in software components. If some text needsto be changed, only the label has to be changed, and afterwards thesoftware components must be converted to runtime (i.e., compiled,dumped or converted to runtime DD).

Label fields can be entered and labels selected by zooming to theMaintain Labels (ttadv1140s000) session from the report editor.

If a label is specified that does not exist or does not fit in the selectedarea of the label field, a new label description (i.e., label content) canbe entered to be inserted in the label table.

Page 25: BAAN IV Tools Reports

4 Mandatory and Optional Sessions

Reports

4 - 9

The procedure for creating labels is described in the Customization andDevelopment (7787US) book.

4.7.3 Maintain Report Special Fields (ttadv3133s000)

Report special fields are used to display general runtime information,such as the company name and number, and can be entered from thereport editor.

The special fields in menus and forms are almost the same. Reportscan contain some additional special fields including:

n Number of records, which depends on the type of layout. Forexample, in a footer, the number of records on a page and in anAfter.report layout is the total number of records processed.

n Page number

4.8 Edit report script

Report scripts are used if specific data, that is not available in the rightformat, needs to be displayed. A report script can process the data toprepare it for presentation, and can also be used to read records fromreferential tables that are not retrieved by the session.

This session can be activated by a form-specific option in the MaintainReports (ttadv3130m000) session. This option will start the editorspecified in the Maintain Development Parameters by User(ttadv0110m000) session, which usually is the UNIX editor, vi.

A script can be created with an additional code for each specificsequence of each specific layout using this editor. The code for thelayouts must be specified by section and subsection.

The following one-label sections are sections with no subsections:

n declaration:n before.program:n after.program:n after.receive.data:n functions:

The possible main sections are:

n before.report.<layout_number>:n after.report.<layout_number>:n header.<layout_number>:n detail.<layout_number>:n before.<field name>.<layout_number>:n after.<field name>.<layout_number>:n footer.<layout_number>:

Page 26: BAAN IV Tools Reports

4 Mandatory and Optional Sessions

Reports

4 - 10

For each main section, there has to be at least one subsection. Thepossible subsections are:

n before.layout:n after.layout:

There are two special sections for texts − one main and onesubsection:

n Main section:field.<text_field>:

n Subsection:before.print:

declaration:; (comment) declare a variable to calculate the stock valuedomain dmpris stock.valuedetail.1:before.layout: stock.value = dmoes001.stck * dmoes001.spri

Figure 4-7 A simple report script

In this example, the stock value will be printed by declaring a variablewith the type, domain dmpris.

The stock value must be calculated for each detail layout (record) andbefore the layout is printed. Consequently, the calculation is performedin the `before.layout’ subsection of the section detail.1 (there is onlyone detail layout with sequence number 1).

Additional information about these sections and 3-GL programming canbe found using the On-line Help.

4.9 Compile Reports (ttadv3240m000)

Reports must be compiled before they can be printed. The sessionspreviously explained are used only for creating information on how aparticular report works and is presented (data in Application Dictionary),not how it is to be executed (Runtime Dictionary).

To compile a report, the following items must be specified in thissession:

n The range of package VRCsn The languagesn The reportsn Some key to control compiling in more than one VRC (usually, the

value, 1, is entered). This is explained in the Customization andDevelopment (7787US) book because it is a common option formenus, forms, reports and program scripts.

Page 27: BAAN IV Tools Reports

4 Mandatory and Optional Sessions

Reports

4 - 11

It is also possible to compile the report in the Maintain Reports(ttadv3130m000) session. This option is often used to compile singlereports.

4.10 Maintain Sessions (ttadv2100m000)

The Maintain Sessions (ttadv2100m000) session is discussed in detailin the Customization and Development (7787US) book. The objective isto attach the report to a session to activate it.

This session is not mandatory. For example, if the report is copied to anew VRC and keeps the same report name, this session does not havebe run. The existing session (in the old VRC) used to activate a reportwith the same name will automatically activate the new report from thenew VRC (depending on the VRC derivation structure) withoutchanging the session.

It is also possible to attach the report to a query in the Maintain QueryData (ttadv3180m000) session. This is discussed in detail in theQueries (7776US) book.

4.11 Test the Report

A report must be tested to ensure that it is functioning correctly. Thistesting is usually divided in two actions. First, the warnings and errormessages produced by compiling the reports must be examined.Second, the print session with the report attached to it must be started,and the printout results studied.

It is also possible to compile and debug at the same time using theMaintain Reports (ttadv3130m000) session. With this option, the reportcan be run step by step through the source code so that the values ofspecific fields and variables can be reviewed.

NOTE

Page 28: BAAN IV Tools Reports

4 Mandatory and Optional Sessions

Reports

4 - 12

Page 29: BAAN IV Tools Reports

Reports

5 - 1

In this chapter the sessions described are not mandatory in theprocedure of creating or adjusting reports but offer special options andfeatures related to reports. These sessions fall into the followingcategories:

n Display sessionsn Print sessionsn VRC related sessionsn A search and replace session (for application dictionary data)n Changing editor options

Display and print sessions can be used as needed. Changing editoroptions will change the commands for all users that use the reporteditor.

Extreme caution should be exercised using the search and replacesession because replacements may be irreversible.

5.1 Display Reports (ttadv3530m000)

In this session, reports are displayed using the user’s current packageVRC. The newest reports will be shown from the VRC derivationstructure.

5.2 Display Objects by report (ttadv3536m000)

The Compile Reports (ttadv3240m000) session can compile reports toproduce a report object in a newer VRC in the Runtime Dictionary. Forexample, if a label has been changed in a report, it would be a goodidea to use this session. After report is compiled, the report data in theApplication Dictionary is in the VRC while the label is in the newestVRC. The report object should be created in the same VRC as thelabel.

Figure 5-1 shows a report object in a VRC in the Runtime Dictionary,that is not in the Application Dictionary in the same VRC.

This session will display the source VRC and the object VRC for reportsto show which report object will be executed at runtime. The ShowCurrent VRC Only parameter specified in the Change Current PackageVRC of User (ttadv0140m000) session will control the selection ofreports displayed in this session.

Reports in the source VRC are located in the application dictionary,whereas report objects are located in the runtime dictionary.

More information on this subject can be found in the Customization andDevelopment (7787US) book.

5. Other Sessions

Page 30: BAAN IV Tools Reports

5 Other Sessions

Reports

5 - 2

Figure 5-1 Report object without Application Dictionary representative in same package VRC

5.3 Print Reports (ttadv3430m000)

Report data is printed in this session. There are different ways ofsorting to print this data. There are options to print more global or moredetailed information about the report, in addition to, including orexcluding report scripts.

5.4 Print Current Reports for Package VRC(ttadv3431m000)

This session prints the actual reports, using the latest version from thespecified package VRC.

Application Dictionary Runtime Dictionary

VRC 2

VRC 1 Report

Label (usedin the report)

Report object (Withnew label text in it)

Compil

e Rep

orts

(derivedfromVRC 1)

Page 31: BAAN IV Tools Reports

5 Other Sessions

Reports

5 - 3

5.5 Delete Unchanged Objects by Report(ttadv3236m000)

Reports can be compiled in another VRC derived from the current onebased on changes in labels. It is also possible to compile reports toproduce report objects in the latest VRC to reduce the amount ofsearch time to find the object. If the latest VRC is used, often severalduplicate report objects will be the result but these objects can bedeleted in this session.

5.6 Global Replace of Report Data (ttadv3230m000)

Sometimes development of reports begins with some standards, forexample, to print certain data using specific print effects. If a newstandard is introduced later in the development process, it would take alot of time to replace all these print effects by maintaining individualreports.

This session is used to replace all kinds of data in a range of reports.

In the first form of this session, the type of report data to replace isspecified including:

n Report General datan Report Input datan Report Layout datan Report Layout Field datan Report Layout Special Field Datan Report Layout Texts

These selections may change the flow of actions for this session. Withcertain selections, starting the process will lead to another series offorms to enter detailed selection criteria and replacement data.

Extreme caution should be exercised because these replacement canbe irreversible.

5.7 Maintain Report Editor Options (ttadv3139m000)

The report editor is used to edit report layouts, such as the positioningof fields on these layouts. The keys (or key combinations) used toperform specific actions in the report editor can be changed so thatother keys are used. This session should only be used if some key orkey combination interferes with something else, such as a terminalemulator running on a Personal Computer.

NOTE

Page 32: BAAN IV Tools Reports

5 Other Sessions

Reports

5 - 4

Page 33: BAAN IV Tools Reports

Reports6 - 1

There are eleven exercises in Chapter 6. The first assignments will be quite detailedand illustrated with examples but later exercises will contain less and less detail. Itmay be necessary to consult the On-line Help because there are some subjects used inlater exercises that are not described in this book.In contrary to the previous chapters, the commands will not be described for bothASCII and GUI. All the commands included in this chapter are named for ASCII,while the corresponding options for the GUI can be found in the different drop-downmenus.

6 Exercises

Page 34: BAAN IV Tools Reports

6 Exercises

Reports6 - 2

Exercise 1 Report type 2

Create a report type 2 to print information about items.The report contains the following fields:•• Item Code•• Item Description•• Purchase Price•• Stock on Hand

The name of this report is dmoes040111100.Select the appropriate paper size for an 80-column report. Note that the only first 20positions of description are shown − not the full 30.When you have completed creating the report, do the following steps.1 Compile the report.

2 Link the report to the Print Item Data (dmoes0401m000) session.

3 Convert the session to Runtime.

4 Do a global modify on the dmoes001 table for the dmoes001.stck field. The newvalue for all items is 10 except for Item 1010301 and 1010956. These items willkeep their old values.

5 Start the report.

Your printout should resemble Figure 6-1.

Date: 95-03-01 [15:30] REPORT TYPE 2 Page : 1BAAN IV Tools Company Company : 600ÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄItem Code ³ Description ³ Purchase Price ³ Stock ³ÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1010301 ³ spade 17.5 x 17 x 27 ³ 120.00 ³ 150 ³ 1010395 ³ spade 15 x 16.5 x 28 ³ 120.00 ³ 10 ³ 1010956 ³ spade 10 x 12.5 x 32 ³ 100.00 ³ 120 ³ 1100017 ³ ruler (length 1m) ³ 30.00 ³ 10 ³ 1100033 ³ ruler (length 2m) ³ 40.00 ³ 10 ³ 1101854 ³ tape measure (length ³ 50.00 ³ 10 ³ 1101870 ³ tape measure digital ³ 120.00 ³ 10 ³ 1101897 ³ tape measure ultraso ³ 250.00 ³ 10 ³ 1200011 ³ hammer 50gm ³ 20.00 ³ 10 ³ 1200046 ³ hammer 150gm ³ 30.00 ³ 10 ³ 1200054 ³ hammer 200gm ³ 35.00 ³ 10 ³ 1200070 ³ hammer 250gm ³ 40.00 ³ 10 ³ 1200097 ³ hammer 400gm ³ 50.00 ³ 10 ³

Figure 6-1 Start Report

Page 35: BAAN IV Tools Reports

6 Exercises

Reports6 - 3

Exercise 2 Report type 3

Copy the report created in the previous exercise to dmoes040111200. Modify the reportin the following ways:1 Append the Item Group Code field.2 Sort on this field.3 Display all items by Item Group.

Compile the report and then link it to the dmoes0401m000 session. After you print thereport, compare your printout with Figure 6-2.Date: 95-03-01 [15:30] REPORT TYPE 3 Page : 1BAAN IV Tools Company Company : 600

Item Group: 010 gardening toolsÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄItem Code ³ Description ³ Purchase Price ³ Stock ³ÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1010301 ³ spade 17.5 x 17 x 27 ³ 120.00 ³ 150 ³ 1010395 ³ spade 15 x 16.5 x 28 ³ 120.00 ³ 10 ³ 1010956 ³ spade 10 x 12.5 x 32 ³ 100.00 ³ 120 ³

Item Group: 011 measuring toolsÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄItem Code ³ Description ³ Purchase Price ³ Stock ³ÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1100017 ³ ruler (length 1m) ³ 30.00 ³ 10 ³ 1100033 ³ ruler (length 2m) ³ 40.00 ³ 10 ³ 1101854 ³ tape measure (length ³ 50.00 ³ 10 ³ 1101870 ³ tape measure digital ³ 120.00 ³ 10 ³ 1101897 ³ tape measure ultraso ³ 250.00 ³ 10 ³

Item Group: 012 hammersÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄItem Code ³ Description ³ Purchase Price ³ Stock ³ÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1200011 ³ hammer 50gm ³ 20.00 ³ 10 ³ 1200046 ³ hammer 150gm ³ 30.00 ³ 10 ³ 1200054 ³ hammer 200gm ³ 35.00 ³ 10 ³ 1200070 ³ hammer 250gm ³ 40.00 ³ 10 ³ 1200097 ³ hammer 400gm ³ 50.00 ³ 10 ³

Figure 6-2 Records grouped by Item Group Code

Page 36: BAAN IV Tools Reports

6 Exercises

Reports6 - 4

Exercise 3 Calculated Field

Copy the report created in Assignment 2 to dmoes040111300. Append the Stock Valuefield. This field is calculated, not a database, field, based on this formula:stock value = purchase price * stock on handYou are prompted to enter the domain to which this field is linked. The result must beentered as a double.

? What warning is displayed after you enter the field?

Also, append the text (shown at the bottom of the sample printout in Figure 6-3) to theend of the report.Compile the report and then link it to the dmoes0401m000 session. Compare yourprintout to Figure 6-3.Date: 95-03-01 [15:30] CALCULATED FIELD Page : 1BAAN IV Tools Company Company : 600

Item Group: 010 gardening toolsÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄItem Code ³ Description ³ Purchase Price ³ Stock ³ Stock ValueÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1010301 ³ spade 17.5 x 17 x 27 ³ 120.00 ³ 150 ³ 18,000.00 1010395 ³ spade 15 x 16.5 x 28 ³ 120.00 ³ 10 ³ 1,200.00 1010956 ³ spade 10 x 12.5 x 32 ³ 100.00 ³ 120 ³ 12,000.00

Item Group: 011 measuring toolsÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄItem Code ³ Description ³ Purchase Price ³ Stock ³ Stock ValueÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1100017 ³ ruler (length 1m) ³ 30.00 ³ 10 ³ 300.00 1100033 ³ ruler (length 2m) ³ 40.00 ³ 10 ³ 400.00 1101854 ³ tape measure (length ³ 50.00 ³ 10 ³ 500.00 1101870 ³ tape measure digital ³ 120.00 ³ 10 ³ 1,200.00 1101897 ³ tape measure ultraso ³ 250.00 ³ 10 ³ 2,500.00

Item Group: 012 hammersÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄItem Code ³ Description ³ Purchase Price ³ Stock ³ Stock ValueÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1200011 ³ hammer 50gm ³ 20.00 ³ 10 ³ 200.00 1200046 ³ hammer 150gm ³ 30.00 ³ 10 ³ 300.00 1200054 ³ hammer 200gm ³ 35.00 ³ 10 ³ 350.00 1200070 ³ hammer 250gm ³ 40.00 ³ 10 ³ 400.00 1200097 ³ hammer 400gm ³ 50.00 ³ 10 ³ 500.00

This report shows the stock values per item. The items are grouped by Item Group Code.

Figure 6-3 Stock Value Field

Page 37: BAAN IV Tools Reports

6 Exercises

Reports6 - 5

Exercise 4 Calculations

Copy the report of the previous exercise to dmoes040111400.The difference with the previous report is:•• average purchase price and total Stock Value per Item Group•• total of the stock values in this report

Compile the report and link it also to session dmoes0401m000. The result is shown infigure 6-4.Date: 95-03-01 [15:30] CALCULATIONS Page : 1BAAN IV Tools Company Company : 600

Item Group: 010 gardening toolsÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄItem Code ³ Description ³ Purchase Price ³ Stock ³ Stock ValueÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1010301 ³ spade 17.5 x 17 x 27 ³ 120.00 ³ 150 ³ 18,000.00 1010395 ³ spade 15 x 16.5 x 28 ³ 120.00 ³ 10 ³ 1,200.00 1010956 ³ spade 10 x 12.5 x 32 ³ 100.00 ³ 120 ³ 12,000.00 Average: 113.33 Total: 31,200.00

Item Group: 011 measuring toolsÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄItem Code ³ Description ³ Purchase Price ³ Stock ³ Stock ValueÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1100017 ³ ruler (length 1m) ³ 30.00 ³ 10 ³ 300.00 1100033 ³ ruler (length 2m) ³ 40.00 ³ 10 ³ 400.00 1101854 ³ tape measure (length ³ 50.00 ³ 10 ³ 500.00 1101870 ³ tape measure digital ³ 120.00 ³ 10 ³ 1,200.00 1101897 ³ tape measure ultraso ³ 250.00 ³ 10 ³ 2,500.00 Average: 98.00 Total: 4,900.00

Item Group: 012 hammersÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄItem Code ³ Description ³ Purchase Price ³ Stock ³ Stock ValueÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ 1200011 ³ hammer 50gm ³ 20.00 ³ 10 ³ 200.00 1200046 ³ hammer 150gm ³ 30.00 ³ 10 ³ 300.00 1200054 ³ hammer 200gm ³ 35.00 ³ 10 ³ 350.00 1200070 ³ hammer 250gm ³ 40.00 ³ 10 ³ 400.00 1200097 ³ hammer 400gm ³ 50.00 ³ 10 ³ 500.00 Average: 35.00 Total: 1,750.00

Grand Total: 37,850.00

This report shows the stock values per item. The items are grouped by Item Group Code.

Figure 6-4 Average values, Sub and Grand Totals and additional text

Page 38: BAAN IV Tools Reports

6 Exercises

Reports6 - 6

Exercise 5 Stock Transaction with summary

Copy the report dmoes042011000 to dmoes042011100 and modify it in the followingway (figure 6-5):•• Sort on Warehouse Code (1) and Item Code (2)•• If the warehouse changes, start on a new page•• The warehouse is given as follows:

"*** Warehouse Code : ccc ddddddddddddddddddddd" (c = warehouse code d = description)

•• All transactions are printed by sequence number•• Give a summary of all quantities by transaction type. There are five transaction

types:−− Purchase Order(dmkowt.pur.order)−− Sales Order (dmkowt.sls.order)−− Production Issue(dmkowt.prod.issue)−− Production Receipts(dmkowt.prod.receipt)−− Stock Adjustment(dmkowt.stck.adju)

Date : 95-03-01 [15:31] TRANSACTIONS - SUMMARY Page : 3BAAN IV Tools Company Company : 600*** Warehouse Code: 800 warehouse #800ÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿³ Item Code : 1010301 spade 17.5 x 17 x 27.5 cm ³ÃÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´³ Sr.no. ³ Kind of Txn. ³ Quantity ³ Date ³ Time ³ Closed y/n ³ÃÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´³ 10 ³ purchase order ³ 1000 ³ 93-03-02 ³ 08:00 ³ yes ³³ 20 ³ sales order ³ 500 ³ 93-03-02 ³ 08:30 ³ yes ³³ 30 ³ production issue ³ 250 ³ 93-03-02 ³ 09:00 ³ yes ³³ 40 ³ production receipt ³ 200 ³ 93-03-02 ³ 09:30 ³ yes ³³ 50 ³ stock adjustment ³ 60 ³ 93-03-02 ³ 10:00 ³ yes ³³ 60 ³ stock adjustment ³ -10 ³ 93-03-02 ³ 10:30 ³ yes ³³ 70 ³ purchase order ³ 2000 ³ 93-03-04 ³ 08:00 ³ yes ³³ 80 ³ sales order ³ 1000 ³ 93-03-04 ³ 08:30 ³ yes ³³ 90 ³ production issue ³ 500 ³ 93-03-04 ³ 09:00 ³ yes ³³ 100 ³ production receipt ³ 400 ³ 93-03-04 ³ 09:30 ³ yes ³³ 110 ³ stock adjustment ³ 120 ³ 93-03-04 ³ 10:00 ³ yes ³³ 120 ³ stock adjustment ³ -20 ³ 93-03-04 ³ 10:30 ³ yes ³ÃÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ³ Total Purchase Orders : 3000 ³³ Total Sales Orders : 1500 ³³ Total Production Issues : 750 ³³ Total Production Receipts : 600 ³³ Total Stock Adjustments : 150 ³ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙÚÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ¿³ Item Code : 1010395 spade 15 x 16.5 x 28 cm ³ÃÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÂÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´³ Sr.no. ³ Kind of Txn. ³ Quantity ³ Date ³ Time ³ Closed y/n ³ÃÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄ´³ 10 ³ purchase order ³ 2000 ³ 93-03-03 ³ 08:00 ³ yes ³³ 20 ³ sales order ³ 1000 ³ 93-03-03 ³ 08:30 ³ yes ³³ 30 ³ production issue ³ 500 ³ 93-03-03 ³ 09:00 ³ yes ³³ 40 ³ production receipt ³ 400 ³ 93-03-03 ³ 09:30 ³ yes ³³ 50 ³ stock adjustment ³ 120 ³ 93-03-03 ³ 10:00 ³ yes ³³ 60 ³ stock adjustment ³ -20 ³ 93-03-03 ³ 10:30 ³ yes ³ÃÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÅÄÄÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÁÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ³ Total Purchase Orders : 2000 ³³ Total Sales Orders : 1000 ³³ Total Production Issues : 500 ³³ Total Production Receipts : 400 ³³ Total Stock Adjustments : 100 ³ÀÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÄÙ

Figure 6-5 Stock transactions with summary

Page 39: BAAN IV Tools Reports

6 Exercises

Reports6 - 7

Exercise 6 Average stock value

In this assignment the report must present the average stock value per item group.The base report is already made in the assignment “Calculations”. In this report thetotal stock value is calculated by an Aggregate Function in a Report Field. AnAggregate Function can take care of calculating the total number of items, but it is notpossible to devide these two results, because the result of an Aggregate Function cannot be referenced.In this case a script has to be created to do something that is not provided by the reporteditor. In this assignment the report must present the average stock value per itemgroup. The average stock value is defined as the total stock value devided by the totalamount of items. The stock value is defined as: ( stock on Hand * Selling Price ).In this script code has to be entered to do the same thing as those Aggregate Functions.Because programming is not an objective of this book the solution of this problem isgiven.To calculate the total of items, the total stock value and the average stock value threevariables are needed. So the next code is needed in the script:declaration:

domain dmquan total.stock ; Total stockdomain dmpris tot.stock.value ; Total stock valuedomain dmpis avg.stock.value ; Average stock value

These variables have to be assigned a default value like in the next code:before.program:

tot.stock = 0tot.stock.value = 0avg.stock.value = 0

Within every detail layout the present value of the fields is known, so if the total stockand the total stock value is to be calculated, the code has to be in the detail section.Every time a detail layout is to be printed, this section will be activated as well. Thepresent values within this record can be added to the variables by the following code::detail.1:

before.layout:tot.stock = tot.stock + dmoes001.stcktot.stock.value = tot.stock.value + ( dmoes001.stck * dmoes001.spri )

Eventually if all the records of the same Item Group have been printed, the total stockvalue and the average stock value have to be printed. This is done by the After Fieldlayout that is already present in the base report. The average stock value has to be puton it to, but first (before printing the layout) the average stock value has to becalculated. After printing this layout the process has to start all over again, startingfrom zero (after layout subsection).

Page 40: BAAN IV Tools Reports

6 Exercises

Reports6 - 8

This is done by the following code:after.dmoes001.igpc:

before.layout:avg.stock.value = tot.stock.value / tot.stock

; Printing the layout

after.layout:tot.stock = 0tot.stock.value = 0avg.stock.value = 0

The variable avg.stock.value can be specified within a report field on the “PrintExpression”.The total script looks like this:declaration:

domain dmquan total.stock ; Total stockdomain dmpris tot.stock.value ; Total stock valuedomain dmpis avg.stock.value ; Average stock value

before.program:tot.stock = 0tot.stock.value = 0avg.stock.value = 0

detail.1:before.layout:

tot.stock = tot.stock + dmoes001.stcktot.stock.value = tot.stock.value + ( dmoes001.stck * dmoes001.spri )

after.dmoes001.igpc:before.layout:

avg.stock.value = tot.stock.value / tot.stock

; Printing the layout

after.layout:tot.stock = 0tot.stock.value = 0avg.stock.value = 0

Page 41: BAAN IV Tools Reports

6 Exercises

Reports6 - 9

Exercise 7 Devision by Zero Error

In the previous assignment there was not taken care of the fact that an division by zerocould take place. The stock on hand for all items of a specific item group could bezero!In this assignment code is going to be entered to prevent the error message.Compiling the report will not have shown an error message for this report, becausethere is no syntax error in the script. If the report is executed with an Item Group withno stock on hand an the next error message will appear:Error: Overflow: format=‘-ZTZZZTZZ9VD99’ value=‘0.NaNG’.This is why the value of the total stock has to be tested on the value 0.This is done by changing the following codeafter.dmoes001.igpc:

before.layout:avg.stock.value = tot.stock.value / tot.stock

intoafter.dmoes001.igpc:

before.layout:if tot.stock <> 0 then avg.stock.value = tot.stock.value / tot.stockelse avg.stock.value = 0endif

Page 42: BAAN IV Tools Reports

6 Exercises

Reports6 - 10

Exercise 8 User name on a report (1)

Sometimes it is very useful if it is possible to track down the user responsible for thereport printout.In this assignment is described what to do to put the BAAN IV logname on a report.To put the BAAN IV logname (User Name) on a report, the predefined variable`logname$’ can be used (see the On-line Help on the subject “predefined variables oftype string). This variable is defined with `string logname$(16)’, so it is a string of 16characters long. This variable represents the BAAN IV logname, specified on the field“User” in the Maintain User Data (ttaad2100m000) session.This variable can be put on a Report Layout by means of a Report Field with logname$specified as Print Expression.Because logname$ is not an Input Field the domain has to be specified in this ReportField as well. An existing domain of type `string’ and a length of 16 characters can beused. There are a lot of common domains which can be used for this purpose, forexample the domain names starting with tcmcs. The domain that can be used here istcmcs.str16.

Page 43: BAAN IV Tools Reports

6 Exercises

Reports6 - 11

Exercise 9 User name on a report (2)

In the previous assignment the BAAN IV logname was put on a report, but this is notalways obvious enough. Sometimes the full name is preverred.In this assignment the solution is described to put this user This name is specified inthe Maintain User Data (ttaad2100m000) session on the field Name.This value can only be read by a script, because a `function’ has to be used. Before thisfunction can be used the usage of this function has to be defined. This is done by the`include file’ bic_tt in the script. This include file contains the definitions of a setfunctions and variables.A variable has also to be declared to assign the User Name to:declaration:

#include <bic_tt> ; Use function definitions from BAAN IV Toolsdomain tcmcs.str30 user.name

Next the assignment has to be coded, because this has to be done only once, the bestsection to put the code in is the before.program:before.program:

user.name = tt.user( logname$, user.name )

The variable user.name can be put on a report by specifying a Report Field, with thisvariable as the content (there has to be specified a domain too!)

Page 44: BAAN IV Tools Reports

6 Exercises

Reports6 - 12

Exercise 10 Date format

With a Report Special Field it is possible to put a date in the header of a report, but it isnot possible to change the format of this date.In this assignment is described what to do to accomplish this.First a new date format has to be created. With the Maintain Date Formats(ttadv4180m000) session a new date format can be specified. Create a date format likethe next one:

1993-August-08

? With this date format, what is the maximum number of characters that canappear?

Execute a runtime conversion for the date formats and leave the bshell and start itagain.Next a Report Field has to be created (for example in the header, instead of the ReportSpecial Field).It is not important for this assignment on which report the Report Field is specified,the procedure is the same for every report. Choose one of the previously adjustedreports to create a new date format in the header!To force another date format a Report Field is used in the header layout. Within thisReport Field the function `date.num()’ (See the On-line Help on the subject `Programmer Reference Information’) is specified on the field “Print Expression”.On the field “Domain” a domain of type date has to be specified, for example tcdate.The previously created date format is not used for this domain (it is not attached to thisdomain), so the format of the domain has to be distached from this domain within thisReport Field, this will be accomplished by specifying No as the value of “Link withdomain”. If the latter is specified it is possible to specify our own created date formaton the field “Print Format”, this is done by entering the value %D099 if the createddate format is specified by code 099.At last the report has to be compiled and tested.The same result can be obtained by creating a script. This script is only an exampleand not part of this assignment:declaration:

string today(16)

before.program:today = sprintf$(ì%D099 & ì,î & lattr.language$, date.num() )

The variable today can be specified on the “Print Expression” in a report field withtcmcs.str16 specified on the “Domain”. Note the difference with the assignment.

Page 45: BAAN IV Tools Reports

6 Exercises

Reports6 - 13

Exercise 11 Reading a (not supplied) referencetable

If the session does not deliver the data from a related table, code has to be entered inthe report script to do this reading within the report itself.In this assignment an example is described to read the VAT description from the VATtable from within the report that prints the stock transactions. The session does notdeliver the data from the VAT table.The report “Stock Transactions” attached to the Print Stock Transactions(dmoes0420m000) session only reads the main table and the “first line” related tablesare delivered by the session, so if the “second line” related tables have to be read, ascript has to be created.Explanation of “first line” and “second line” table relations:•• Fist Line: the relation between two tables.•• Second Line: the relation between table A and table C, if table A refers to table B

and table B refers to table C.

In the next script `embedded SQL’ is used to read the VAT description from the VATtable (dmoes012). With every detail layout (stock transaction) the description of thereferred VAT code (stock transactions are related to items and items are related toVAT codes) is read:declaration:

table dmoes012domain dmdscr btw.dscr

detail.1:before.layout:

select dmoes012.dscrfrom dmoes012where dmoes012.cvat = :1wherebind( 1 , dmoes001.cvat )selectdo

btw.dscr = dmoes012.dscrendselect

Now the variable btw.dscr can be specified in a Report Field with domain dmdscr.

Page 46: BAAN IV Tools Reports

6 Exercises

Reports6 - 14