Product Information
Automated mapping programs – Generative TDD with ChatGPT
Summary
In my previous article “Never again create a mapping manually!” I’ve tried to show our idea for making sure that you no longer need to create mappings in integration platforms like SAP Integration Suite, SAP Process Orchestration, etc. in a manual way if you use a generative Test Driven Development approach. In this article I’d like to show the next steps with this approach and show how a typical mapping program generation can happen.
Generative Test Driven Development
If you’d like to find our more what is generative Test Driven Development please have a quick look at this section “What is a generative Test Driven Development (generative TDD) and why is that a breakthrough in SAP integration platform development, delivery and maintenance?” here “Never again create a mapping manually!”
Background
Let’s take an example of integration platform migration. You may need to migrate an ABAP mapping from a very old dual stack SAP PI/XI systems into the SAP Integration Suite or maybe you have an SAP PO system and the mapping is done in a message mapping but it contains 20 UDFs working on context and there’s no documentation of this mapping (never happens right?) so before you move it to SAP Integration Suite you want to change it so you’d rather create a new mapping. In order to generate a new mapping program we will start with downloading a lot of existing/historical input-output pairs from the productive landscape. On the basis of those input-output pairs only system will query ChatGPT or any other generative AI which can generate XSLT, Groovy mappings. Once the mapping is updated in the integration platform you now need to rerun all of the available historical input-output pairs and make sure all variants are covered.
Governance and validation
Remember that generative AI solutions like ChatGPT are not that smart. They can generate the mapping in any language but you need to validate it. So automated generation of mappings comes at a cost – you need to learn how to validate your new mappings.
Step by Step process of generating a new mapping
Step 1
Download a few hundreds of of historical input-output pairs for the interface you plan to migrate. This is the idea of Test Driven Development – you start with test cases and only on the basis of that you start doing the development (or generation) work.
Figure – using Int4 Robotic Crawler to download 200 historical input-output pairs and create test cases from them in Int4 Shield
Step 2
Now the fun (generation) starts.
Ask the system to prepare a mapping based on the collection in a specific language , for example XSLT.
And the mapping proposal is generated and can be uploaded into the SAP Integration Suite
Step 3
Validate the mapping with all test cases (in this case 200) at once.
Figure – Retest all test cases automatically to validate the generated mapping in Int4 Shield
Wait – something is not right – the mapping worked from the structure point of view but it didn’t from the value point of view, as all material numbers have unnecessary “_” in the description which was removed in the old mapping.
Figure – result from the message comparison from the new and old mapping in Int4 Shield
Step 4
What to do now? Repeat Steps 2 and 3 until you get the right validation without any errors.
Success, validation does not return any errors!
Figure – result from the message comparison from the new and old mapping in Int4 Shield
Now you can finish the validation and your new mapping program is generated automatically and fully validated – thanks to the power of generative TDD approach.
Next Steps
Automated generation of mapping programs is just a start but what about the performance? If we can generate mappings and validate them in a matter of minutes why not generate them in 2-3 languages (XSLT, Groovy) and compare the execution time?
Summary
The idea of the example here is not to show function of how exactly the generative TDD works but on a high level what are the steps to automatically generate mapping programs from existing historical messages and make sure you can validate them so they work properly. It’s an iterative process that still required understanding of what needs to happen, how should it happen and why should it happen.
Further references:
SAP Discovery Center mission – Automate over 65% of your SAP Integration Suite migration with Int4 solutions
SAP PRESS book: Testing SAP APIs: Strategy and Execution
openSAP course (on SAP iPaaS migration testing) – Avoid SAP S/4HANA Project Delays with Third-Party Systems Service Virtualization
I'm using for groovies and xslts. Next step should be integrate the TDD Tools with it. And keep iterating untill it works.
hi Xavier,
That is the plan with Int4 Shield
BR,
Michal Krawczyk
Very good!
it would be great if you keep writing articles involving using ChatGPT to automate processes in SAP.
Best regards.
Why generating an existing message mapping again via chat-gpt, when you could migrate it by default with the Migration Tool. An AI could missunderstand the Data, maybe not all possible variants of logic are in the set of messages. Also most existing Java mapping you could use with a litten work.
Also most xslt mapping.
what about security? you put real test messages to an AI....Do you know what the Data used for?
hi Thorsten Stork
Thank you for the great questions 🙂
Question 1: Why generating an existing message mapping again via chat-gpt, when you could migrate it by default with the Migration Tool.
Answer: What about ABAP mappings? (yes, still there), message mappings with 20 UDFs (no one knows how they work), what about predelivered content? Then come the really important factors: what about the integration redesign? Do you still want to run your flow the same way you did on SAP PO (BPM, etc.) or maybe use functions from event mesh, etc. like in my blog: https://blogs.sap.com/2023/04/26/mach-architecture-with-sap-btp-and-advanced-event-mesh/ why bring the old garbage into the new house? Why not do some clearing before hand? 🙂
Questions 2: An AI could missunderstand the Data, maybe not all possible variants of logic are in the set of messages.
Answer 2: Of course - that's why we combine it with Int4 Shield functions to validate the mappings (with thousands of messages) - otherwise it makes no sense as you've pointed out of course. AI does not work without validation in this case but that's why we have Step 4 in this blog 🙂
Question 3: Also most existing Java mapping you could use with a litten work.
Answer 3: Why not move them to Groovy (do you want java in SAP IS)?
Question 4: what about security? you put real test messages to an AI....Do you know what the Data used for?
Answer 4: very important topic! As you can see in the summary ChatGTP in it's current form (27th of April 2023) does not support this. So we either wait for new release which can handle that or we use another AI model (what is most likely the case) - for the productive version of Int4 auto mapping generation functionality.
Hope that clarifies a bit 🙂
Best Regards,
Michal Krawczyk
Hello,
to question / answer 3: Of cource it would be better to use groovy script, but to convert java mapping to groovy script I do not have to "regenerate" it in groovy script via "reanalyse" thousand of messages. Dierect conversion is normally not so difficult and based on the original code logic
But if someone want to this way, ok.
Regards
Thorsten Stork
hi Thorsten,
100% correct - both ways are perfectly fine but both still need to be validated with tons of messages
to make sure everything is working right?
BR,
Michal Krawczyk