Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Fetch data from documents through OCR to SAP

0 Kudos

Hi,

We have a requirement to scan the hard copies of import/export license provided by the government and store the values fetched from the documents in SAP through automation like OCR. How to achieve this in SAP?

I have found an API in SAP API Hub (Inference Service for Optical Character Recognition (OCR)). This API returns the characters found in the uploaded file in a string and we need to process the response in order to fetch the key fields. But this is somewhat difficult as the response may vary depending on scanned licenses. Has anyone used SAP OCR API to process the scanned document?

1 ACCEPTED SOLUTION

former_member650260
Participant
0 Kudos

Hi,

this is a non-trivial project. I would use a tool like ocrmypdf (free of charge and used by google for their books project) which uses tesseract (can create hocr directly)

After creating the pdf or during the process create a xml file with also free tools like poppler pdfalto or use the hocr which is created during the process.

These tools will create not only single characters but also words or textlines with their position on the page. You can fiddle with the parameters which is a word, but the default works pretty well in english and german.

Parse the xml e.g. with cl_xml_document or with a transformation

Be aware that e.g. the position from top can vary in a single line depending how the original file was created. Depending from your needs you have to adjust the positions. If you have the corrected position of each text-element you can extract the data in a logical way.

If you data structure is easy the following solution could be also sufficient.

Concatenate all "words" in a string and use regex.

Good luck.

3 REPLIES 3

Jelena
Active Contributor
0 Kudos

"Store the values" how exactly and what is the projected volume of the document scanning?

Also "response may vary" - sorry but how exactly are you expecting some API to recognize specific field if it could be anywhere? OCR programs usually rely on specific consistent format (they need to know where exactly the needed field is located) or on some pattern, which would need to be provided for them (e.g. look for the number next to specific word, etc.). None of this just comes out of the box...

former_member192029
Active Contributor

There are plenty of OCR / ICR tools are available in the market. But based on the input document structure (semi/un structure / fixed ), we need to choose the OCR tool. Most of the tools are having power API, which can directly integrate with SAP or atleast it can generate output/ values in a spreadsheet. Either we can directly consume via API or use the RPA tool to automate it. We have evaluated all OCR tools ( Abbey, Kofax, Antworks, Google, IBM Data cap etc) and selected an OCR tool with RPA combination to process further. Note: I've not shared the name of the OCR/ RPA vendor here and it may vary based on the scenarios/ requirements

Thanks

former_member650260
Participant
0 Kudos

Hi,

this is a non-trivial project. I would use a tool like ocrmypdf (free of charge and used by google for their books project) which uses tesseract (can create hocr directly)

After creating the pdf or during the process create a xml file with also free tools like poppler pdfalto or use the hocr which is created during the process.

These tools will create not only single characters but also words or textlines with their position on the page. You can fiddle with the parameters which is a word, but the default works pretty well in english and german.

Parse the xml e.g. with cl_xml_document or with a transformation

Be aware that e.g. the position from top can vary in a single line depending how the original file was created. Depending from your needs you have to adjust the positions. If you have the corrected position of each text-element you can extract the data in a logical way.

If you data structure is easy the following solution could be also sufficient.

Concatenate all "words" in a string and use regex.

Good luck.