4.4.Display layouts

Functionality

An EDI file (EDIFACT/IDOC/VDA/ANSIX12) is displayed according to the standard syntax directory
with field name and field content. If you select a layout directory and exists a layout for the
detected file format, this will be used for processing the EDI file.
As a layout tool, JasperReports is supported.

The following example is based on:

  • EDIFACT-INVRPT message
  • As layout directory, the default layout directory "layouts" is selected
  • As preferred language, "English" is selected

  • In the layout directory "layouts" three suitable layout files exists for this file format,
    - EDIFACT_96A_INVRPT.datasel
    - EDIFACT_96A_INVRPT_en.jrxml
    - EDIFACT_96A_INVRPT_en.jasper

    which leads to the following layout processing:


    With help of Report toolbar you can scroll, zoom and print the report.

 

Layout directory

The default delivered sample layout files are located in the directories "layouts"
and "layoutsEdifileChecker".

About customizing your own layout directories can be created, deleted and renamed.
Layout directories can be created in the user directory and, with write access, also in the
program directory. Layout directories must start with "layout".
If no suitable data selection file (DATASEL) was found in the selected layout directory,
the default directory "layouts" is also searched.

3 Layout files

  1. In the DATASEL file the required data selections are defined to create a CSV file
  2. In the JRXML file the layout is defined to show the CSV data
  3. The JASPER file is a compiled JRXML file and is used by R2EdiViewer to display the EDI file.
    If only a JRXML file exists, it is compiled into a JASPER file.

 

Rules of layout file names

For the 3 layout files, the following naming conventions exist:

Layout file

Format

DATASEL

F[_UNB0004][_UNB0010][_UNB0026].datasel
F[_ISAI06][_ISAI07][_GS479].datasel

JRXML

F[_UNB0004][_UNB0010][_UNB0026][_L].jrxml
F[_ISAI06][_ISAI07][_GS479][_L].jrxml

JASPER

F[_UNB0004][_UNB0010][_UNB0026][_L].jasper
F[_ISAI06][_ISAI07][_GS479].[_L].jasper


Meaning

F

File format coming from „File statistics" view, for example:
- EDIFACT_96A_DELFOR
- SAPIDOC_DELFOR02
- VDA_ALL_4905
- ANSIX12_004010_830

_UNB0004  _ISAI06

_UNB0010  _ISAI07

_UNB0026  _GS479

As a possible option for Edifact/Odette/AnsiX12-files, the following
search strategy is used:
1. _UNB0004_UNB0010_UNB0026
2. _UNB0010_UNB0026
3. _UNB0004_UNB0026
4. _UNB0004_UNB0010
5. _UNB0026
6. _UNB0010
7. _UNB0004
8. File-format _XXX_message (e.g. EDIFACT_XXX_INVOIC)

_L

Optional language code in lowercase (de,en,fr). The following
search strategy is used:
1. Search with language start parameter
2. Search for English version
3. Search for German version
4. Search for French version
5. Search without language code

Valid examples:

  • VDA_ALL_4905.datasel
  • VDA_ALL_4905_de.jrxml
  • VDA_ALL_4905_de.jasper
  • SAPIDOC_DELFOR02_de.jrxml
  • EDIFACT_96A_DELFOR_O0013000202GOODYEAR_de.jrxml
  • ANSIX12_004010_830_en.jrxml

(tick) Directive

With the directive {JasperreportName} you can change the layout name in any other one.

 

4.4.1. Data selection in the .datasel-file

In the DATASEL file the data selection instructions for creating a CSV file is stored.
It specifies which EDI fields will be used for the new layout.

About customizing you can create DATASEL files (with or without a template), change, rename,
move and delete them.

This requires:

  1. The EDI file for which a DATASEL file is to be customized, appears in the viewer
  2.  Layout directory:
    1. To create a DATASEL file, you must have at least one own
      layout directory.
       
    2. For modifying, renaming, moving and deleting a DATASEL file your own
      layout directory must have been selected in the main toolbar.

As soon as a DATASEL file exists for the file format, a CSV file is created.

 

INVRPT example file: EDIFACT_96A_INVRPT.datasel

If only a DATASEL file exists (no JRXML/JASPER file) the CSV file is displayed.

If there is also a JRXML/JASPER file, with the toggle button / you can switch between
Report view and CSV view. This is useful to check the DATASEL statements,
because only if you have a correct CSV file you can get a correct report.

A CSV file is displayed as spreadsheet:

  • Start the column with C_ , G_ , I_ these are color-highlighted
  • Click into a cell coloring the cell value
  • Double click on the column name hides the column
  • Spreadsheet button makes all hidden columns visible again

 

4.4.1.1. Basic rules

  1. For each desired EDI field, which you want to use in the report,
    a selection statement is required in the following format:
    EDI field=Report field(Condition1&|Condition2)
  2. For each report field a CSV column is generated in the order of selection instructions
  3. The report fields are always initial blank
  4. The order of selection statements depends on the structure of the EDI message,
    not the later report
  5. A CSV record is created as soon as a return is detect in the selection statements.
    Example:
    The report field G_MENGE has been filled with the scheduled quantity. Then comes a new
    schedule position and the new item number is filled in the field G_ARTNR.
    G-ARTNR is located before G_MENGE, a rebound takes place, so a CSV record is generated.

4.4.1.2. datasel syntax

EDI field

Format of EDI fields: S-G-F

  • S = Segment name (examples: BGM,512, E2EDK09003)
  • G = Group number (example: 020)
  • F = Field number (examples: 1004,004,003)

If there is an EDI field several times in a segment (e.g. NAD-030-3124) then beginning with
the second EDI field you need to append #2 to the
second EDI field (NAD-030-3124#2)
and #3 to the third EDI field (NAD-030-3124#3) etc.   

Examples of delivery schedule number fields:

  • EDIFACT = BGM-020-1004
  • ANSIX12 = BFR-030-328
  • VDA = 512-004
  • IDOC = E2EDK09003-003

If you need internal report fields for example counters, you simply define an EDI field which does not exist
in the EDI file (e.g. INTERN-001).

 

 

Report field

Basically the name of a report field is arbitrary. Exceptions:
a) Do not use underline characters
b) If a report field starts with the following characters, a special processing is occurred:

  • G_ = Group change field means that before EDI value is saved in this field,
            this field and all in the selection statement following report fields are deleted,
            including the condition result (true/false) from the CheckWriteRecord command
            (if a return is detected in the selection statements a new CSV record is written).
  • C_ = Cancel field means that there is no deletion of report fields and despite a return in the
            selection statements, no CSV record is written unless the EOF of the EDI file
            has been reached.
  • I_ =   Internal field is never triggered to delete values or to write a CSV record (also no EOF).

Examples of report field names:

  • LABNEU
  • G_SNDPRN
  • C_PARVW
  • I_COUNTART

By default the following report fields will be automatically generated in each CSV file:

  • R2EdiFilename = Name of the EDI file
  • R2LayoutDirPath = Complete path of the layout-directory
    (useful for "subreportExpression" and "dataSourceExpression")
  • R2Language = Language

 

Condition

Generally, a condition must be fulfilled, before the report field is filled with
the value from the EDI field.

1. The whole condition must be in simple brackets, for example: (C_PARVW==LF)

2. A condition consists of: operand1 operator  operand2

3. A report field or a command is expected as operand1

4. Several conditions can be linked by logical operators:

Operator

Meaning

&

UND: Both conditions must be true

Example: (I_DTM_QUALIF==171&I_RFF_QUALIF==AIF)

|

ODER: At least one condition must be true


5. A condition can have following relational operators:

Operator

Meaning

==

equal

Example: (C_PARVW==LF)

!=

not equal

>

greater

<

less

>=

greater or equal

<=

less or equal

An EDI value is then expected as operand2 or the commands "Initial, EdiValue".
Allowed characters are:
Letters, numbers and blank, comma, minus, dot, hash, slash, semicolon, underscore


6. A condition can have arithmetic operators:

Operator

Meaning

++

Increase the report field immediately by 1,
if any existing preconditions are true.

Example: (I_COUNTART++)

7. A condition can be a command:

Command

Meaning

CheckWriteRecord

Condition result (true / false) is stored internally.
Only if all CheckWriteRecord conditions are true,
a CSV record is written.

Example:
BGM-010-1001=G_DOC(CheckWriteRecord&EdiValue!=393)
Consignment invoice(Factored invoice) are ignored.

ClearReportfield==Reportfield

Deletes immediately the value from the specified report field
if any existing prerequisites are true.

Example:
COM-010-3155=I_TYP(EdiValue!=FX&ClearReportfield==C_FAX)

ClearWriteRecord==ReportfieldDeletes immediately the condition result (true / false) from
the specified report field,
if any existing preconditions
are true.


Example:
UNS-010-0081=G_UNS(ClearWriteRecord==I_TYPE)

EdiValue

It uses the value of EDI field (instead the report field name).
Useable as operand1 or operand2.

Examples:
BGM-010-1001=MSGTYP(EdiValue==241)
TAX-050-5278=C_TAXRATE(C_TAXRATE1!=EdiValue)

Format4905CalloffDate

Format the call-off dates of the VDA4905-513/514 record types,
so that the special date formats after a 555555-date are
more understandable for the user.

Example:
513-008=G_DVON(Format4905CalloffDate)

Goto==TargetEdiField

Jumps to the TargetEdiField and starts again with the processing.
Report fields with a Goto condition appear in the CSV file,
but only with the value "<NU>" (not used).
Only the TargetEdiField proccesses the EDI value.

Example:
513-010=DATUM2(Goto==513-008)

InitialChecks if value of the report field is initial (empty).

Example:
DTM-010-2380=DOCDAT(I_DTM_Q==137& I_RFF_Q==Initial)

NewLine

Creates a new CSV record, if the data have changed compared to
the last CSV record.

Example:
E2EDP14-005=PACKFILLMENGE(NewLine)

SegmentName

Saves the actual segment name (BGM) / record type (511)

Example:
INTERN-002=I_SA(SegmentName)

ValueAppend

Appends the EDI value to the actual report field value
separated with space.

Example:
E2EDKT2001-001=C_HEADERTEXT(ValueAppend)

ValueNotEmptyZero

Is true if the value of EDI field is not blank or does not contain
only zeros (00000...).

Example:
513-009=MENGE(ValueNotEmptyZero)

4.4.1.3. Directives

Enter directives at the beginning of a DATASEL line. Format of directives:

{directive name==directive value}

Possible directives:

Directive                   Meaning
JasperreportNameName of any JasperReports (JRXML/JASPER file), which must be
located
in the layout-directory.

Example: {JasperreportName==EDI file checker}

 

4.4.2. Create a layout with JasperReports in a .jrxml-file

The layout of a report is stored in a JRXML file.
As a layout tool JasperReports is supported by Jaspersoft:

- Download: Design tool "Jaspersoft Studio" to develop JasperReports
- Wiki: Designing a Report with Jaspersoft Studio

4.4.2.1 Data Adapter

Use "CSV file" as "Data Adapter".
As data source use through DATASEL file created CSV file.

4.4.2.2. Font Extension

If you use "Font Extensions" in your report, you have to save the exported JAR file
(containing among other TTF font) in addition into R2EdiViewer's user or "private" directory.

4.4.2.3. JAR-files

If R2EdiViewer can't show a JasperReports because JasperReports support libraries
are missing then copy missing JAR-files into R2EdiViewer's user or "private" directory.

 

4.4.3. List and check of layout files

Customizing "List and check of layout files" is used to search all layout directories.
All DATASEL, JRXML, and JASPER files are listed.

  1. DATASEL file:
    1.    Change within the last 30 days
    2. Syntax error found
    3. JRXML and JASPER file are missing
    4. JRXML or JASPER file is missing
    5. The JRXML file specified by the {JasperreportName} directive
    6. No errors found
  2. JRXML file:
    1. A DATASEL file refers to this JRXML file