This quickstart shows you how to process documents (invoices) from a source bucket and store the processed document (JSON file) in a target bucket by using the batch processing capability of Document AI API .
Before you begin
Before you run this quickstart, make sure that you or your administrators have completed the following prerequisites:
-
You have a Google Cloud account and project.
-
Billing is enabled for your project. See how to confirm that billing is enabled for your project .
-
The on-premises or any cloud edition of ABAP SDK for Google Cloud is installed and configured. See how to install and configure the on-premises or any cloud edition of ABAP SDK for Google Cloud .
-
Authentication to access Google Cloud APIs is set up. See how to set up authentication .
-
Make sure the Document AI API is enabled in your Google Cloud project.
-
In the Document AI Workbench, create a processor with type
INVOICE_PROCESSOR. For more information, see Creating and managing processors . -
In Cloud Storage, create a source bucket to store the invoices for processing and place the invoices in this bucket. For more information, see Create buckets .
-
In Cloud Storage, create a target bucket to store the processed files.
Create a program to process documents
-
In the SAP system, create an executable program in your custom namespace (for example, Z or Y) by using transaction
SE38.-
In the SAP GUI, enter transaction code
SE38. -
In the Programfield, enter a name of your program, for example,
ZDEMO_DOCUMENT_AI. -
Click Create.
-
Specify the program attributes:
-
In the Titlefield, enter a title of your program, for example,
Process invoices. -
In the Typefield, choose
Executable Program. -
Click Save.
-
-
Save the program as a Local Object.
-
In the ABAP Editor, add the following code:
Replace the following:
-
DEMO_DOC_PROCESSING: the client key name. -
PROJECT_ID: the ID of the Google Cloud project. -
LOCATION_ID: the processor's location. -
PROCESSOR_ID: the ID of the processor. -
SOURCE_BUCKET_URI: the URI of the Cloud Storage bucket folder where source documents are kept for processing. -
TARGET_BUCKET_URI: the URI of the Cloud Storage bucket where the processed document (JSON file) would be stored.
-
-
-
Run your application in
SE38. -
To validate the results, follow these steps:
-
In the Google Cloud console, go to Cloud Storage Bucketspage.
-
Open the target bucket. The processed document is stored in the form of a JSON file.
-
What's next
- Explore other quickstarts available on the GitHub repository, GoogleCloudPlatform/google-cloud-abap/abap-sdk /ZGOOG_SDK_QUICKSTART/ .
- Read the guide Application development with the on-premises or any cloud edition of ABAP SDK for Google Cloud .
- View the code samples .
- Ask your questions and discuss ABAP SDK for Google Cloud with the community on Cloud Forums .

