Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
stefan_schnell
Active Contributor
I presented here the possibility to use Quick PDF Library from Debenu easily. Here now another use case: Very often we use forms in our business work flows. You fill out a form and send it via e-mail to next person in the process chain. This person inspects the content and transfers the data from the form in the EDP system - very often manually. But it is very easy possible to read the data from a PDF form automatically and use it in your ABAP context.

Here an example how to read data from a PDF form to create a new user via the function module BAPI_USER_CREATE1:

  1. Create a form with a text editor, in my case I use Writer from OpenOffice.

  2. Save the form as PDF file.

     

  3. Fill out the form in the Acrobat Reader and save the PDF file.

     

  4. Now you can use the data from the form inside your ABAP code, e.g. like this.

     

  5. On this way it is very easy to create new users in your central user management system to distribute them on the target system. You have the PDF form as verification and it is not necessary to do something manually.


Here the code:
"-Begin-----------------------------------------------------------------
Program zBAPI_USER_CREATE1_ReadForm.

"-Variables---------------------------------------------------------
Data PDF Type Ref To zDebenuPDFLibraryAX1115.
Data rc Type Integer.
Data UserName Type String.
Data Password Type String.
Data FirstName Type String.
Data LastName Type String.
Data FullName Type String.
Data LogonData Type BAPILOGOND.
Data Address Type BAPIADDR3.
Data BAPIUserName Type BAPIBNAME-BAPIBNAME.
Data BAPIPassword Type BAPIPWD.

"-Main--------------------------------------------------------------
Create Object PDF.
If PDF->LoadLib( ) = 1.

PDF->LoadFromFile( Exporting Password = ''
FileName = 'BAPI_USER_CREATE1_Fill.pdf'
Importing Result = rc ).
If rc = 1.

PDF->GetFormFieldValueByTitle( Exporting Title = 'username'
Importing Result = UserName ).
PDF->GetFormFieldValueByTitle( Exporting Title = 'password'
Importing Result = Password ).
PDF->GetFormFieldValueByTitle( Exporting Title = 'firstname'
Importing Result = FirstName ).
PDF->GetFormFieldValueByTitle( Exporting Title = 'lastname'
Importing Result = LastName ).
PDF->GetFormFieldValueByTitle( Exporting Title = 'fullname'
Importing Result = FullName ).

BAPIUserName = UserName.
BAPIPassword-BAPIPWD = Password.
Address-FirstName = FirstName.
Address-LastName = LastName.
Address-FullName = FullName.

Call Function 'BAPI_USER_CREATE1'
Exporting
USERNAME = BAPIUserName
LOGONDATA = LogonData
PASSWORD = BAPIPassword
ADDRESS = Address.

EndIf.

PDF->FreeLib( ).
EndIf.

"-End-------------------------------------------------------------------

This is an simple example but it shows exemplary the possibilities.
3 Comments