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
- In the DATASEL file, the required data selections are defined to create a CSV file
- In the JRXML file, the layout is defined to show the CSV/XML data
- 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 |
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: |
_UNB0004 _ISAI06 | As a possible option for Edifact/Odette/AnsiX12 files, the following |
DC40DIRECT | As a possible option for IDoc files, the following search strategy is used: |
_L | Optional language code in lowercase (de,en,fr). The following |
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
|
---|
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:
- The EDI file for which a DATASEL file is to be customized appears in the viewer
- Layout directory:
- To create a DATASEL file, you must have at least one own
layout directory. - For modifying, renaming, moving and deleting a DATASEL file your own
layout directory must have been selected in the main toolbar.
- To create a DATASEL file, you must have at least one own
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
- 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 ) - For each report field, a CSV column is generated in the order of selection instructions
- The report fields are always initial blank
- The order of selection statements depends on the structure of the EDI message,
not from the later report - 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 |
| | OR: At least one condition must be true |
5. A condition can have the following comparison operators:
Operator | Meaning |
---|---|
== | equal |
!= | 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, |
7. A condition can be a command:
Command | Meaning |
---|---|
CheckWriteRecord | The condition result (true / false) is stored internally Example: |
ClearReportfield==Reportfield | Deletes immediately the value from the specified report field Example: |
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 |
Format4905CalloffDate | Format the call-off dates of the VDA4905-513/514 record types, |
Goto==TargetEdiField | Jumps to the TargetEdiField and starts again with the processing. |
Initial | Checks 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 |
SegmentGroup | It 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) |
ValueAppend | Appends the EDI value to the actual report field value Example: |
ValueNotEmptyZero | Is true if the value of EDI field is not blank or does not contain |
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 |
---|---|
JasperreportName | Name 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.
JasperReports from Jaspersoft is supported as a layout reporting engine.
The version of the design development environment "Jaspersoft Studio" must not be greater
than the version of <R2EdiViewer program directory>/lib/jasperreports-n.nn.n.jar:
- Download: "Jaspersoft Studio" the design development environment for JasperReports
- Wiki: Designing a Report with Jaspersoft Studio
Six steps to change a delivered layout:
- Create your own layout directory in the R2EdiViewer customizing menu.
- Copy the DATASEL, JRXML and JASPER file of the layout to be changed from the
"layouts" directory into the newly created layout directory. - In R2EdiViewer, select the new layout directory, switch to CSV view
and save the EDI file as a CSV file. - In Jaspersoft Studio, create a "Data Adapter" for the CSV file.
- In Jaspersoft Studio, open the JRXML source file from the new layout directory and
make your changes. - If Jaspersoft Studio and R2EdiViewer are running with the same Java version,
the JASPER file (binary file) can be generated in Jaspersoft Studio ("Compile Report" icon).
If different Java versions are used, the old JASPER file must be deleted from the new layout directory.
When the new JRXML layout is executed for the first time, R2EdiViewer automatically compiles
the JRXML file into a binary JASPER file.
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":
- Enable/Disable "Enable namespace support", depending on your XML file
- 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 - With JasperReports from 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 of layout files incl. syntax check
"List" searches all layout directories, performs a syntax check and then displays the result
in an overview for all DATASEL, JRXML and JASPER files.
- DATASEL file:
- Change within the last 30 days
- Syntax error found
- JRXML and JASPER file are missing
- JRXML or JASPER file is missing
- The JRXML file specified by the {JasperreportName} directive
- No errors found
- JRXML file:
- A DATASEL file refers to this JRXML file
- Syntax warning found
- Syntax error found (no new JASPER file can be created)