When implementing interfaces, good documentation is at least as important as good architecture and clean programming. Unfortunately, writing documentation is certainly not one of the favorite tasks of developers and consultants. In today's blog post I would like to show how you can add nice process graphics to your own CPI interface documentation with just a few tricks.
Let's start with a quick
In addition to information on connection data, error handling and use cases and other things, interface documentation should also contain graphics on the process flow. Ideally, a graphic illustration of the IFlow itself is suitable here. Unfortunately, the CPI does not yet have a feature for exporting an IFlow in a graphical form.
Taking a screenshot is also of limited help, since larger IFlows in particular quickly produce pixelated graphics (because you have to zoom out to get the whole IFlow into the screenshot, but at the same time lose a lot of details in the graphic). The optimum would be the export of an IFlow as vector graphic. (As it is also requested here in SAP's Influence Program - please leave a vote there).
The solution is closer than expected. Technically IFlows are .zip archives containing different configuration and description files like scripts, mappings but also the process flow. The process flow is stored as an XML file according to the BPMN standard. We now make use of this, since there are already some rendering tools for this standard.
Example procedure in 3 steps
Choose the IFlow you want to convert to a SVG graphic.
Then go to the package overview and download the specific IFlow.
Now open the downloaded zip archive with a any archive viewer (e.g. 7-zip, Winrar, Explorer) and navigate to the following path inside the archive:
Extract the *.iflw-file onto your local disk. The iflw-file contains the BPMN-styled XML that we use to render the SVG in the next step.
Navigate to https://demo.bpmn.io/, click "open" and select the IFLW file. You should see a graphical representation of your IFlow. Change and edit the diagram to your favor.
At the end you can export the diagram as SVG file with just a single click.
Note: As you can see in our example the exception subprocess isn't rendered with all it's details I'm not sure if this is due to a limitation of the BPMN viewer or because the IFLW file isn't fully compliant to the BPMN standard. So take the approach shown above as baseline process for graphic generation, but keep in mind to double check that the graphic contains everything you need. (Or add missing details in the graphics editor later on.)
Outlook and ideas
While the above approach shows that it is possible to display a vector-based diagram of an IFlow with little effort, there is still room for improvement. For one thing, not all elements of the IFlow are always displayed and for another, the process (download, unzip, upload, save SVG) can certainly be simplified.
By use of the official SAP CPI SAP BTP Integration Suite, Cloud Integration (oh lord, please let SAP quickly invent a catchy acronym 🥴) APIs, which are documented over here (https://beta.api.sap.com/api/IntegrationContent/resource), the download process could be automated. The unzipping then could be done via native functions of the used programming language/framework. For the last step (the rendering of the BPMN model) there exist different libraries like...
Maybe some of our community's #CodingHeroes can wrap the logic up in a small tool...
Last but not least, I like to know how you manage/write your documentation today. Do you use flow diagrams in your documentations? If so, which tool for digram generation (screenshot, another toolchain, ...) do you use?