Thursday, July 2, 2026

Generative AI in SAP Document AI for Document Digitization - Using Fiori and RAP

 

Generative AI in SAP Document AI for Document Digitization

Overview

SAP Document AI offers comprehensive document processing for structured, semi-structured and unstructured data trapped within various document formats, unlocking its true potential for your business.


By seamlessly integrating and matching this data with your business information, SAP Document AI significantly reduces manual efforts and minimizes errors.

Leveraging the latest advancements in AI technologies, SAP Document AI provides enhanced accuracy, ensuring high-quality data for your organization. Our solution empowers informed decision-making while cutting processing costs, effectively lowering the total cost of ownership. All of this is delivered through seamless integration within SAP’s renowned business applications.

SAP Document AI leverages Generative AI to transform scanned documents (PDF, JPEG, etc.) into structured business data like invoices, sales orders, payment advice, or any custom template. This intelligent document processing integrates advanced OCR, multilingual support, and AI-based learning to automate and enhance data extraction workflows.

Business Challenges

·         Manual Document Processing

·         Unstructured and Multiformat Data

·         Language and Regional Diversity

·         Lack of Standardization

·         Slow Adaptation to Changes

·         Compliance and Data Accuracy

·         Limited Integration with Business Systems

·         Scalability Constraints

 

Key Benefits

-          Automation of manual data entry processes.

-          Improved accuracy through continuous learning and adaptation.

-          Scalable solution for multilingual and multi-format document processing.

-          Enhanced analytics capabilities with structured data integration.

-          Reduction in operational costs and processing time.

Extended Capabilities of SAP Document AI

End-to-End Document Processing
Handles both structured and unstructured data from various business documents.

Advanced OCR & Multilingual Support
Supports over 100 languages and 35+ file formats, including handwriting and barcode detection.

Generative AI Integration
Uses pretrained transformers and large language models for superior document understanding and minimal training data requirements.

Preconfigured Business Content
Includes templates for invoices, purchase orders, delivery notes, and more.

 

 

Process Flow

1. Document Upload Interface

Users upload scanned documents via a frontend interface. Supported formats include PDF and JPEG.

2. Storage & Preprocessing

Uploaded documents are stored in a Document Server in unclassified form for further processing.

3. AI-Powered Conversion

SAP Document AI processes the documents using advanced OCR, multilingual capabilities, and Generative AI to extract and structure business-relevant data.

4. Learning & Adaptation

The system continuously learns from user corrections and historical data to improve accuracy and performance.

5. Validation & Correction

Extracted data is validated and corrected by users or automated rules to ensure accuracy before finalization.

6. Structured Data Output

Final structured data is saved in a database and displayed via a frontend for analytics and reporting.

 

Building a SAP Fiori App with RAP and Document AI Integration

1. Prerequisites


- SAP Business Technology Platform (BTP) account
- SAP S/4HANA system with RAP (Restful ABAP Programming Model) enabled
- SAPUI5 development environment (SAP Web IDE or Business Application Studio)
- Access to SAP Document AI APIs

2. Frontend Setup (SAPUI5)


Create a Fiori app using SAPUI5 with the following views:
- Upload View: Allows users to upload documents
- Validation View: Displays extracted fields and allows corrections

Sample XML for Upload View:


<UploadCollection id="uploadCollection" uploadUrl="/upload" change="onUploadChange"/>
<Button text="Submit to Document AI" press="onSubmit"/>

3. Backend Setup (RAP)


Define a RAP service to handle document metadata and validation logic.
Create CDS views and behavior definitions.

Sample CDS View:


@EndUserText.label: 'Document Processor'
define root view entity ZDOCUMENT_AI as select from zdoc_ai {
  key DocumentID : UUID;
  FileName       : string;
  Status         : string;
  Confidence     : Decimal(5,2);
}

4. Integration with Document AI APIs


Use HTTP client in ABAP to call Document AI APIs for document submission and status retrieval.

Sample ABAP Code:


DATA(lo_http_client) = cl_http_client=>create_by_url( 'https://document-ai.sap.com/api/upload' ).
lo_http_client->request->set_header_field( name = 'Authorization' value = lv_token ).
lo_http_client->request->set_method( 'POST' ).
lo_http_client->send( ).

5. Validation Logic


Once the document is processed, display extracted fields with confidence levels.
Allow users to correct mappings using dropdowns and save templates.

Sample UI5 Table Row:


<Table>
  <columns>
    <Column><Text text="Field"/></Column>
    <Column><Text text="Extracted Value"/></Column>
    <Column><Text text="Confidence"/></Column>
    <Column><Text text="Correction"/></Column>
  </columns>
  <items>
    <ColumnListItem>
      <cells>
        <Text text="{fieldName}"/>
        <Text text="{value}"/>
        <Text text="{confidence}%"/>
        <Select items="{dropdownOptions}" selectedKey="{correctedValue}"/>
      </cells>
    </ColumnListItem>
  </items>
</Table>

 

Steps followed in POC on Document AI using Fiori as Frontend.

Step 1: Choose the jpg or pdf document from computer and submit to Document AI


 

Step 2: On submission the document is uploaded. Press refresh to check the processing status.


 

Step 3: Once the document is processed a green tick mark appears. Once the green tick mark appears, click the document name.



 

Step 4: Validate the field mapping for the document. Generative AI find the document type and maps the field data to the document fields.



 

Step 5: On clicking Validate and Save template, a template for the data will be saved which will be used for future uploaded documents for similar document type.



Step 6: The template is saved and automatically used next time.



Step 7: Once validated, document can be saved.



 

Step 8: Document gets saved into backend system.



 

Step 9: The saved data can be checked in the system tables.

The Fiori app code using RAP is provided in the attachment.

No comments:

Post a Comment

AI-Powered Warehouse Temperature Automation Using IoT and SAP

  Overview In this project, we present a smart, scalable solution that leverages  AI ,  IoT , and  SAP technologies  to automate and optim...