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:

ElementDescription
Diagram Typee.g. "I want a component diagram"
Use Case / FlowDescribe what the diagram should represent
Steps or ActorsList participants and flow direction
Technology TagsMention IDoc, OData, BAPI, etc. (optional)
Format Requirede.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 NameField NamePKFKReferences
MARAMATNRY
MAKTMATNRYYMARA
MVKEMATNRYYMARA

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

TipWhy It Matters
Use clear structure in inputAI draws what you describe
Be specific about the flowStart β†’ Step 1 β†’ Step 2 β†’ Result
Ask for PlantUML outputEnsures you get usable code
Group systems logicallyFrontend, Backend, Middleware
Use Excel for ER/Class logicStructured 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.

0
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.