Visual SAP with plantUML #9 - How to Use ChatGPT to Generate Diagrams β From Prompt to PlantUML

Creating diagrams manually slows you down.
You know the process β but translating it into visuals takes time, formatting, and layout effort. With AI, you describe the flow in words, and ChatGPT turns that into a structured, readable, PlantUML diagram. You save hours.
ChatGPT helps you:
Visualize processes from natural language
Speed up documentation for functional specs or technical designs
Generate clean PlantUML code you can preview, version, and reuse
π§© What Youβll Learn
How to write effective prompts to generate diagrams
What types of diagrams work best
How to use structured input (like Excel)
A library of ready-to-use prompts for SAP use cases
β 1. What to Send as Input
The key to getting high-quality diagrams from AI is giving it structured context.
π§Ύ Your Prompt Should Include:
Element | Description |
Diagram Type | e.g. "I want a component diagram" |
Use Case / Flow | Describe what the diagram should represent |
Steps or Actors | List participants and flow direction |
Technology Tags | Mention IDoc, OData, BAPI, etc. (optional) |
Format Required | e.g. "Use PlantUML syntax", "Group by area" |
π You donβt need technical terms. Just be clear and linear.
π¬ Example Input
vbnet
CopyEdit
Generate a component diagram in PlantUML.
I have:
- A Fiori app that sends data to SAP PO
- SAP PO transforms and routes the message to S/4HANA
- Backend uses BAPI to post to HANA DB
Group into: Frontend, Middleware, Backend.
βοΈ 2. Example Output from ChatGPT
plantuml
CopyEdit
@startuml
title SAP Integration β Component Diagram
package "Frontend" {
component "Fiori App"
}
package "Middleware (SAP PO)" {
component "iFlow"
component "Mapping & Routing"
}
package "Backend (S/4HANA)" {
component "SAP Gateway"
component "BAPI Layer"
component "HANA DB"
}
"Fiori App" --> "iFlow" : OData / SOAP
"iFlow" --> "Mapping & Routing"
"Mapping & Routing" --> "SAP Gateway"
"SAP Gateway" --> "BAPI Layer"
"BAPI Layer" --> "HANA DB"
@enduml
β
Copy this into .puml
and render it in VS Code or online.
You just saved 20β30 minutes of diagramming.
π§° 3. Prompt Library β Use Case Templates
Here are prompt patterns you can reuse across SAP projects.
π¦ ER Diagram
Prompt:
yaml
CopyEdit
Generate a PlantUML ER diagram for the following:
- MARA: MATNR (PK), MTART, MATKL
- MAKT: MATNR (FK to MARA), SPRAS, MAKTX
- MVKE: MATNR (FK to MARA), VKORG, VTWEG
Show relationships with cardinality.
π¨ Activity Diagram
Prompt:
diff
CopyEdit
Create an activity diagram in PlantUML for:
- Creating a delivery
- Checking stock
- If stock is available, pick and post goods issue
- If not, notify the user
Add decisions and start/stop blocks.
πͺ Sequence Diagram
Prompt:
diff
CopyEdit
Make a sequence diagram for:
- External system calls API Gateway
- Gateway triggers BAPI in S/4HANA
- S/4 processes and returns JSON
Use β for sync, β> for async
π© Class Diagram
Prompt:
diff
CopyEdit
Class diagram in PlantUML:
- Controller class runs validation checks
- Interface IF_CHECK
- Two classes implement it: Check_Material, Check_Price
- Controller aggregates them and calls execute()
π₯ Use Case Diagram
Prompt:
vbnet
CopyEdit
Use case diagram:
Actors: Purchasing Agent, Finance Clerk
Use Cases: Create PO, Display Supplier, Approve Invoice
Map actors to their actions.
π« C4 Context Diagram
Prompt:
yaml
CopyEdit
C4 context diagram in PlantUML:
- Person: Sales Rep
- System: SAP S/4HANA
- External: CRM and SAP PO
Sales Rep uses S/4HANA
S/4 connects to CRM and PO
Use the C4 syntax and include titles.
π 4. Using Excel or Structured Input
Yes β you can go beyond plain text. Structured data makes diagrams better.
π‘ Best Use Case: ER Diagram from Excel
Table Name | Field Name | PK | FK | References |
MARA | MATNR | Y | ||
MAKT | MATNR | Y | Y | MARA |
MVKE | MATNR | Y | Y | MARA |
Prompt:
pgsql
CopyEdit
Here is an Excel sheet with table definitions.
Generate a PlantUML ER diagram showing relationships.
Primary keys are marked 'Y'. Foreign keys map to other tables.
β You can attach or paste data as Markdown or CSV.
β ChatGPT will build the entities and relationships automatically.
π§ 5. Best Practices
Tip | Why It Matters |
Use clear structure in input | AI draws what you describe |
Be specific about the flow | Start β Step 1 β Step 2 β Result |
Ask for PlantUML output | Ensures you get usable code |
Group systems logically | Frontend, Backend, Middleware |
Use Excel for ER/Class logic | Structured input = better output |
β Summary
You donβt need to draw. You just need to describe.
ChatGPT will handle the rendering.
Use it to:
Generate specs fast
Align teams visually
Avoid drawing everything by hand
Keep documentation clear, live, and maintainable
The more structured your input β the better your diagram output.
Subscribe to my newsletter
Read articles from Dzmitryi Kharlanau directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by

Dzmitryi Kharlanau
Dzmitryi Kharlanau
SAP Logistics Consultant with 10+ years of experience in SAP SD, SAP MM, SAP LE, and SAP IS-Automotive. Skilled in SAP system support, integration, and process improvements. Achievements βοΈ Delivered custom logistics solutions, overseeing the entire process from concept to go-live. βοΈ Achieved SLA compliance in JIT environments, managing tasks from requirements to release independently. βοΈ Resolved complex issues swiftly, minimizing downtime and optimizing efficiency. Interests: Motivated to work with π§ S/4HANA SD, MM, BTP, and ABAP, taking responsibility for end-to-end solutions.