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: 

Read PDF Content vith OCR directly in SAP

Pier_1973
Participant
0 Kudos

Hi there,

I would like to ask if is possible to read the content of a PDF with OCR directly on SAP.

The PDF file is attached to mail in inbound folder (SOIN).

In this PDF is written the purchase number and the position and I must catch these data to create Goods Movement.

Could you help me?

I appreciate if you write code.

Thank you in advance

12 REPLIES 12

matt
Active Contributor
0 Kudos

Where is the PDF coming from? Who is sending them?

Pier_1973
Participant
0 Kudos

Hi Matthew,

the PDF comes from an External partner who sends it via mail as attach.

Inside the PDF there are all information I need, such as Purchase Document Number, Position, Date of Creation and so on.

With these information I have to create Goods Receipt and Goods Movement.

Since my final customer don't want to activate IDoc Process I thought to read data from PDF using OCR but I don't know if it is possible.

matt
Active Contributor

Right next to the "Your Answer" editor, it says:

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details.

raymond_giuseppi
Active Contributor
0 Kudos
Questions
  • Is the pdf a native pdf (born digital, basically text and not bitmap)
  • Is there only one format for this pdf (single vendor)

If any answer is no, do you really want to develop such a tool and compete with certain SAP or SAP partner products?

Else look at sample such as Reading PDF attachment from sap inbox through ABAP

matt
Active Contributor

Hi Matthew,

the PDF comes from an External partner who sends it via mail as attach.

Inside the PDF there are all information I need, such as Purchase Document Number, Position, Date of Creation and so on.

With these information I have to create Goods Receipt and Goods Movement.

Since my final customer don't want to activate IDoc Process I thought to read data from PDF using OCR but I don't know if it is possible.

It's possible, but pdf is a really bad way to send electronic data. Frankly, I'd just tell them to send the information in a text file. Or if they insist on PDF, then use PDF/A-Format, which can have XML attachments.

First, you need a third party PDF/OCR reader.

Then you send the PDF to that reader, and get back the information you need. You could do this by installing such a program on the application server and using system commands, but I'd install it on a separate server and set up a web service.

Alternatively, find someone who offers PDF to text as a cloud service, and use that.

0 Kudos

Hello Matthew, thanks for your reply.

If i ask to exernal partner to provide me the pdf in PDF/A- Format how then can I read information inside it?

Is there a transformation in Sap that convert PDF into XML and then Into Internal Table?

If yes, could you post the code to do this?

matt
Active Contributor
0 Kudos

It requires more than just pdf/a - they have to explicitly put the information into the xml attachment.

But really - if they don't want to do IDOCs, why don't they just send the information as a text document, rather than PDF?

I've only done it the other way - created pdf/a invoices with an xml attachment in the ZUGFeRD format mandated by the German government. I've no idea how to process XML attachments within SAP - except by using some third part tool, and proceeding as the last two paragraphs of my answer.

Pier_1973
Participant
0 Kudos

Hello Giuseppi, I tried to use the code but i Have a short dump when i try to connect to ADS

Sandra_Rossi
Active Contributor
0 Kudos

You didn't answer Raymond questions, which were very important.
SAP do propose conversion tools but not as part of SAP ERP.

Sandra_Rossi
Active Contributor
0 Kudos

(I mean "SAP do propose conversion tools" except the very few ones i.e. ABAP List, SAPScript Forms and Smart Forms into PDF, but not the opposite way)

Pier_1973
Participant

Ah thanks. So the only way is to ask a text file with all information.

Thank you

raymond_giuseppi
Active Contributor

Without tool, better ask provider for text or xml file.

Some tools