4.4.Display layouts

An EDI file (EDIFACT/IDOC/VDA/ANSIX12) is displayed according to the standard syntax directory
with field name and field value.
For XML files line breaks are inserted or, if ShortView is active, displayed line by line, compressed.

If you select a layout directory and exists a layout for the detected file format, this will be used
for processing the file.

As a layout tool, JasperReports is supported.

The following example is based on:

  • EDIFACT-INVRPT message
  • The default layout directory "layouts" was selected as the layout directory.
  • "English" was selected as the preferred language.

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

    which leads to the following layout processing:


    The Report toolbar can scroll, zoom and print the report.

 

Layout directory

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

You can create, delete and rename your own layout directories via customizing.
Layout directories can be created in the user directory and, with write access, also in the
program directory. Layout directories must begin 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/XML 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
F[_DC40_DIRECT][_DC40_MESTYP][_DC40SNDPRN][_DC40RCVPRN].datasel

JRXML

Identical to DATASEL plus optional language code [_L].jrxml

JASPER

Identical to DATASEL plus optional language code [_L].jasper


Meaning

F

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

_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)

DC40DIRECT
DC40MESTYP
DC40SNDPRN
DC40RCVPRN

As a possible option for IDoc files, the following
search strategy is used:
01. _DC40DIRECT_DC40MESTYP_DC40SNDPRN_DC40RCVPRN
02. _DC40DIRECT_DC40MESTYP_DC40RCVPRN
03. _DC40DIRECT_DC40MESTYP_DC40SNDPRN
04. _DC40DIRECT_DC40SNDPRN_DC40RCVPRN
05. _DC40DIRECT_DC40RCVPRN
06. _DC40DIRECT_DC40SNDPRN
07. _DC40DIRECT_DC40MESTYP
08. _DC40DIRECT
09. _DC40MESTYP_DC40SNDPRN_DC40RCVPRN
10. _DC40MESTYP_DC40RCVPRN
11. _DC40MESTYP_DC40SNDPRN
12. _DC40SNDPRN_DC40RCVPRN
13. _DC40RCVPRN
14. _DC40SNDPRN
15. _DC40MESTYP

_L

Optional language code in lowercase (de,en,fr). The following
search strategy is used:
1. Search with language startup 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_ORDERS05_2_DELORD_de.jrxml
  • EDIFACT_97A_DELFOR_1234567890TEST.datasel
  • ANSIX12_004010_830_en.jrxml

(info) Directive

The DATASEL-directive {JasperreportName} can be used to specify any layout name.

 

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.
No DATASEL file is required for XML layouts.

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

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 there is only a DATASEL file (no JRXML/JASPER file), the CSV file is displayed.

If there is also a JRXML/JASPER file, you can use the toggle button /  to 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 a spreadsheet:

  • If the column begins with C_ , G_ , I_ they will be highlighted in colour
  • A click inside a cell colours 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 from the later report
  5. A CSV record is created:
    after a value has been written in the last report field
    - as soon as a return jump occurs 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, so there is a return jump, 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 starting 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 an internal report field, such as a counter, you simply define an EDI field, that 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, special processing takes place:

  • 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:
            - value has been written to the last Cancel field of all selection statements
            - 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 are 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

&

AND: Both conditions must be true

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

|

OR: At least one condition must be true


5. A condition can have the following comparison 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

The condition result (true / false) is stored internally
with the report field (e.g. G_DOC=true).
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_FX)

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


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

EdiValue

It uses the value of the EDI field
(instead of the value of the report field).
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 processes the EDI value.

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

InitialChecks if the 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)

SegmentGroupIt uses the current segment group number
(instead of the value of the report field).
Useable as operand1 or operand2.

Example:
NAD-020-3039=PARTY_ID(SegmentGroup==7)

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 in the following format:

{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

As "Data Adapter", "CSV file" or "XML document" is to be used.
As data source the CSV file, generated by the DATASEL file, or the XML file must be specified. 

For an "XML document":

  1. Enable/Disable "Enable namespace support", depending on your XML file
  2. Under Jaspersoft Studio->Properties, Xalan must be entered as XPATH executor,
    so that the namespace in the XML element is correctly recognised, therefore:
    net.sf.jasperreports.xpath.executer.factory = net.sf.jasperreports.engine.util.xml.XalanXPathExecuterFactory
  3. With JasperReports version 6.20.6, the "org.apache" classes from xalan.jar are no longer delivered.
    In the "org" directory of "Jaspersoft Studio\plugins\net.sf.jasperreports_6.20.6.final.jar"
    the "apache" directory must therefore be copied from the "org" directory of xalan.jar.

4.4.2.2. R2EdiViewerXL.CFG

XML files can be read by JasperReport directly via the data adapter.
This means that no DATSEL file is needed to create a CSV file.
An XML file must be assigned to a JasperReport.
These assignments are made via customizing ("Layout XML/Configuration").

An XML file is searched for self-defined search terms.
The first complete match of all search terms finds the JasperReport and the layout directory.
But the determined JasperReport is only used if the layout directory is also selected.

The syntax is:

LayoutDir:XML_ALL_ReportName:InclPrefix|ExclPrefix=SearchString1[~SearchString2][~SearchStringN...]

  • Field 1: Layout directory where the JasperReport is located
  • Delimiter: colon
  • Field 2: Name of the existing JasperReport (JASPER/JRXML), must start with "XML_ALL"
  • Delimiter: colon
  • Field 3: InclPrefix = XML tags contain a namespace prefix 
                 ExclPrefix = XML tags contain no namespace prefix 
  • Delimiter: equal sign
  • Field 4: Search strings (separated by tilde characters), which must all be contained in the XML file
                          

4.4.2.3. Font Extension

If you use "Font Extensions" in your report, you have to save the exported JAR file
(contains among others the TTF font) in addition into R2EdiViewer's "private" directory.
The JAR file name must be one of the 5 empty R2EdiViewer_CustomerExtensionLibraryXX.jar
files.

4.4.2.4. JAR-files

If R2EdiViewer can not display a JasperReports because of missing JasperReports support libraries,
then copy the missing JAR-files into the user or "private" directory of R2EdiViewer.
The JAR file name must be one of the 5 empty R2EdiViewer_CustomerExtensionLibraryXX.jar
files.

 

4.4.3. List and check of layout files

"List and check of layout files" searches all layout directories and shows an overview
of all DATASEL, JRXML and JASPER files.

  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