zeroFill

An utility to add leading zeros up to given length to a numeric string 
Please note Alphanumeric string will be left untouched

A procedure to use in Seeburger BIC Mapping Designer
It will extend your library for string handling

/*  -----------------------------
    Peter Lykkegaard, 22 mar 2019
    -----------------------------   
	Method
	   zeroFill
	Parameters
	   value$: String to prefix with zeros
	   Num%: Number of characters, length of string after prefixzing
	Returns
	   $
	Description
	   If the parameter value is a numeric value and 
	   the length of the string does not exceed length of the value
   */

   if (isNumeric(value$) && len(value$) < num%)
       copy lfill(value$, "0", num%) to value$;
   endif

   exitProc(value$);

 

Linux commands

Some usefull Linux commands to keep the site updated

Deploy .NET project

rsync -avz -e 'ssh' /mnt/c/Users/<project>/<user>:/var/www/<project>

Update system

sudo apt update && sudo apt full-upgrade



 

 

Split text on right most space before limit is reached

Split text on right most space before limit is reached
Use to split text on several lines in receiving document, eg edifact LIN-IMD-C273 has several 7008 text element

//    -----------------------------
//    Peter Lykkegaard, 22 mar 2019
//    -----------------------------
//    Split long note on right most space before limit is reached
//    TODO! Check parameters if they are of valid type/content
//
//    Name: splitNoteBySpace
//    Description: Method to split a given string by latest space before length limit
//    Parameters
//        input$, alphanumerical / String which needs to be split
//        max$, alphanumerical / Max characters on each line
//    Output, alphanumeric / array / Array of strings to return
 
local lvOutput$[];

#importJavaStart
    import java.util.regex.Matcher;
    import java.util.regex.Pattern;
#importJavaEnd
 
#javastart

    String input = _StrVar_PINPUT.getString();
    int max = (int)_NumVar_PMAX.getNum();
    int len = input.length();
    
    String regex = "(.{1," + max + "})(?:\\s|$)";
 
    Pattern pattern = Pattern.compile(regex, Pattern.MULTILINE);
    Matcher matcher = pattern.matcher(input);
    
    _StrVar_LVOUTPUT.getJuVar(0, 2).setString(input);

    if (len > max)
    {
        int idx = 0;     // Entries in output   
        while (matcher.find()) {
            for (int i = 1; i <= matcher.groupCount(); i++) {
                _StrVar_LVOUTPUT.getJuVar(idx, 2).setString(matcher.group(i).toString());
            }
            idx++;
        }
    }
#javaEnd
     
exitProc(lvOutput$);

 

Validate EDI

Validate EDI (XML, Edifact and Ansi X12)  

Site

Functionality

  • Multiupload
    • No data is stored on the server
    • MIME type is detected based on file content
      • It is possible to upload without file extensiom
      • All other files than text (edifact / ansi x12) or xml are skipped / not supported
  • Validate structure (eg schema validation)
  • Validate business logic (eg schematron validation)
  • XSLT Styling, readable document in HTML
  • Calculate content and compare with values in eg an invoice

Milestones

Current task

  • Scoped the project, only a few XML and EDIFACT versions will be implemented
    • OIOUBL (danish adaption of the UBL standard)
    • Peppol BIS
    • Standard eg EDIFACT D96 are considere in a limited version as a start as a proof of concept
    • cXML and xCBL are a possibility
  • Store validation classes / objects in memory cache to use on subsequent requests
  • XSLT transformations uses SaxonHE
    • All stylesheet versions are supported
    • Included stylesheets or XML documents are supported
  • Documentation of source code (XML documentation)
    • SandCastle is used to generate HTML or MD documents
    • Add content documentation to source code

Release

  •  WIP
    • Jun 23: Only local test / development atm, date for a first beta release not estimated
    • Oct 23: Slow process with local test / development, getting closer to a beta release 
    • Dec 23: Testing, prepare for release on VPS with Ubuntu
    • Jan 14: Project running on VirtualBox / Ubuntu 23.10 / NET 8
      • NGINX as Reverse Proxy in fron of Kestrel web server
    • Jan 14: Test memory usage to validate 8 Gb mem limit
    • Jan 23: Released on https://www.validatefile.dk
      • VPS with 2 CPU, 8 Gb mem running Ubuntu 23.10 server and .NET 8
    • Feb 07: Small adjustment, preparation for xCBL and cXML validation, About page added

To do list for project: 

Sandcastle

Use local postman for testing?

Unit test

Check for vulnerability

GDPR (mostly done)

Information or questions: Please contact plykkegaard at gmail dot com

Seeburger: Map from IDOC to Edifact Transactionset

Edit IDOC document properties

Once the IDOC definition is imported in the Mapping Designer make sure to set Max Occurences on the document root (DC1)
Use unlimited (-1) or 9999

  • IDOCs are send from SAP to a queue with append
  • File is read and mapped to edifact
    • Header is set in New Mapping and footer in Mapping End