Home Page FO Designer user guide. XSL-FO tool for Oracle APEX and the Java[TM] platform
Home
                                                    FO Designer guide
                                                  • First steps
                                                  • Introduction
                                                  • The user interface
                                                  • Working with the interface
                                                  • Structure of the template
                                                  • Executing the template to create PDF files
                                                  • Learn by doing
                                                  • The invoice IDOC example
                                                  • The Group by example
                                                  • The two columns example
                                                  • Barcodes
                                                  • Charts
                                                  • The running totals example
                                                  • Interactive forms
                                                  • Flavours
                                                  • The base template
                                                  • Long texts and HTML fields
                                                  • The memo field explained
                                                  • Advanced functionalities
                                                  • FOP Could Server
                                                  • Migration of existing XSL-FO files
                                                  • FAQS
                                                  • Troubleshooting
                                                  • Licenses
                                                  • The invoice IDOC example
                                                    bcl_716964462.htm

                                                    7. The invoice IDOC example explained

                                                    The  idoc_invoice subdirectory shows how you can create a user friendly PDF file from a SAP XML IDOC. This example has been based on the INVOIC01 format but it can be easily changed to be used with other IDOC types or versions.

                                                    In this section we will highlight some common task like:

                                                    • How to work without a schema file.
                                                    • Use of conditions in the XPath
                                                    • Use of second level detail areas.
                                                    • Use of combo boxes

                                                    The PDF output of the invoice will be:

                                                    The report's invoiceIDOC.xre layout is:

                                                    The structure of the template is:

                                                    1. There is a Page header that contains the IDOC number.
                                                    2. There is a Invoice header that contains the buyer information (bill to and delivered to)
                                                    3. after the invoice header there may be (optional) some comments to the invoice: Note the Detail 2 area has been associated to the /INVOIC01/IDOC/E1EDKT1/E1EDKT2/TDLINE node. There is one such node in the XML document for each comment line, so the area will be repeated for each comment line. If no comment lines exist, the area will not be created at all. The detail 2 area also has a detail 2 columns header area, this area will be created also only if at least one comment line exists. Furthermore the super area property of the Detail 2 area has been set to the header area.
                                                    4. after the comments there is a table header for the items in the invoice
                                                    5. The detail area will be repeated for each item in the invoice. Note the Detail area has been associated to the node /INVOIC01/IDOC/E1EDP01. This element exist for each item in the invoice. Furthermore the super area property of the Detail area has been set to the Header area.
                                                    6. for each item, there may be (optional) one or several comment lines. Note the Detail 1 area has been associated to the node /INVOIC01/IDOC/E1EDP01/E1EDPT1/E1EDPT2 which contains the item level comments. Furthermore the super area property of the Detail 1 has been set to the Detail area.
                                                    7. The invoice footer contains some totals information. In the same way as the invoice header, the footer does not have to be associated to any XML node in the XML document since both areas exits only (and always) once in each invoice. This therefore assumes the input XML document (IDOC) can contain only one invoice.
                                                    8. The page footer contains the legal information of the company issuing the invoice.

                                                    how to work without a schema file

                                                    In this example we do not have a XSD file that describes the IDOC invoice, therefore we click on the Create schema from XML button in the settings tab of the report, select the INVOIC-out.xml file and we get a pseudo-schema (INVOIC-out.xsd) created from the test file:

                                                    Use of second level detail areas

                                                    As already described in the structure of the template, this example contains a second level detail area called "detail 1". This area contains the comments associated to the items of the invoice.

                                                    The key steps to achieve this are:

                                                    • An area (Detail 1) has been inserted below the Detail area


                                                    • The XML node property of Detail1 is pointing to the /INVOIC01/IDOC/E1EDP01/E1EDPT1/E1EDPT2 which contains the comments of the item.
                                                    • The XML node type is set to relative, since the super area is pointing to /INVOIC01/IDOC/E1EDP01, the XML node property will refer to the comments of the current line only.

                                                    Use of conditions in the XPath

                                                    The bill to and delivered to information show a very common pattern in XML structures. The XML node /INVOIC01/IDOC/E1EDKA1/NAME1 contains the name of a company, but the meaning of the company is described by another node, namely the /INVOIC01/IDOC/E1EDKA1/PARVW. If the content of that node is RE, it means the data in the parent node refer to the bill to party. That is why the used XPath is:

                                                    /INVOIC01/IDOC/E1EDKA1[PARVW='RE']/NAME1

                                                    NAME1 node in the /INVOIC01/IDOC/E1EDKA1 node that meets the condition PARVW='RE'.

                                                    type in the condition part of the Xpath in the bottom field of the XPath selector window. You can add condition in square brackets [ ] at any position of the XPath.

                                                    Use of combo boxes

                                                    The first field in the invoice header is a good example for a combo box. The XML node /INVOIC01/IDOC/E1EDK14[QUALF='015']/ORGID can contain the values F2 or G2 which do not mean anything to a normal user. The combo box allows you to replace this codes with the descriptive values "invoice" and "credit note" which are the business meaning of those code.