cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Can SAP DOCUMENT AI make automatic template selection?

TMNielsen
Contributor
0 Likes
391

This question was actually also asked back in 2022, but SAP Document AI has been updated 50-100 times since, so maybe a solution exist today.
We use Document AI basic edition.
We use SAP_purchaseOrder_schema or a extended copy of the same. We load purchase orders from different customers with different layouts and we see a lot of problems with the OCR not working in a consistent way. We hope we can fix some of these problems with templates. We would probably need templates for most of our customers POs.
We don't have a secure way to automatically determine which template to use before we load the PDFs.
Currently we can make a manual process where a user must open the pdf to see which customer it comes from and then manually load the pdf with the correct schema and template. This manual load process does not fulfill our goal for an automatic process.

The best solution will of course be if the OCR could be better so we wouldn't need a template, but a solution from the drawer with second best options could be if SAP Document AI automatic could detected the correct template from the templates related to the chosen schema.

Here is a a couple of examples of problems we hope to solve with templates. To be honest I don't think SAP Document AI performs very well in these cases:

1) A customer has more lines in the PDF for each item. The second line for an item has a scheduling line item no and SAP document AI reads this as a new item instead of just information for the previous item:

TMNielsen_7-1773910935121.png

2) With line items that has identical layouts SAP Document AI suddenly swich from identifying a "Supplier material no" to instead identify a "Customer material no":

TMNielsen_6-1773910862999.png

3) On page 1 SAP Document AI does not identify the "Supplier material no", but on page 2 it does.

Page 1: 

TMNielsen_5-1773910744439.png

Page 2:

TMNielsen_4-1773910695544.png

 

Best regards
Thomas Madsen Nielsen

 

Accepted Solutions (1)

Accepted Solutions (1)

tobias_weller
Product and Topic Expert
Product and Topic Expert

Hi @TMNielsen 
Yes, we do support a "template auto-detect feature" both in UI and API. See e.g. here https://help.sap.com/docs/document-ai/sap-document-ai/add-document
When considering templates, I recommend to also have a look at the best practices and limitations: https://help.sap.com/docs/document-ai/sap-document-ai/template-best-practices

Besides this, our recommendation for such scenarios is to consider the premium edition with instant learning to avoid the overhead of creating and maintaining templates.

Best regards, Tobias

TMNielsen
Contributor
0 Likes

Thank you Tobias. This is good news, but unfortunately I can't make it work via API.

If I load a file manually in the UI and select "Detect automatically" it finds a suitable template or no template if none is suitable. So, this is perfekt.

Here is the result when I load a file manually:

TMNielsen_1-1774352781290.png


According to documentation I can select "Detect automatically" in api call by setting templateId = "detect"

TMNielsen_0-1774352467285.png

I'm doing the call in ABAP, so my payload is build like this:

    CONCATENATE
         '--' lv_boundary lv_crlf
         'Content-Disposition: form-data; name="options"' lv_crlf
         'Content-Type: application/json' lv_crlf
         lv_crlf
         '{"clientId":"' imp_client '",'
         '"schemaId":"' gv_schema_id '",'
         '"schemaVersion":"' imp_schema_version '",'
         '"templateID":"detect"}'
         lv_crlf
       INTO lv_json_part.

but it doesn't work:

TMNielsen_2-1774352889208.png

 

TMNielsen
Contributor
0 Likes

Ok I found my typo. It must be templateId, but I wrote templateID.

Answers (0)