DOC-65423
-
Upload
justforregister -
Category
Documents
-
view
5 -
download
3
description
Transcript of DOC-65423
-
Generated by Jive on 2015-07-17+02:001
How To Read Data From a PDF Formular andUse it Inside ABAP
Hello community,
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 inthe 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 inyour ABAP context.
Here an example how to read data from a PDF form to create a new user via the function moduleBAPI_USER_CREATE1:
1. Create a form with a text editor, in my case I use Writer from OpenOffice.
-
How To Read Data From a PDF Formular and Use it Inside ABAP
Generated by Jive on 2015-07-17+02:002
2. Save the form as PDF file.
-
How To Read Data From a PDF Formular and Use it Inside ABAP
Generated by Jive on 2015-07-17+02:003
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.
-
How To Read Data From a PDF Formular and Use it Inside ABAP
Generated by Jive on 2015-07-17+02:004
5. On this way it is very easy to create new users in your central user management system to distributethem on the target system. You have the PDF form as verification and it is not necessary to dosomething manually.
-
How To Read Data From a PDF Formular and Use it Inside ABAP
Generated by Jive on 2015-07-17+02:005
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 = ''
-
How To Read Data From a PDF Formular and Use it Inside ABAP
Generated by Jive on 2015-07-17+02:006
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.
Enjoy it.
CheersStefan