In this recipe, we will see the usage of the Adobe offline infrastructure. The Adobe offline infrastructure allows you to process user-filled PDF forms (received by e-mail), and then extract data from it and update in the SAP database. It allows you to implement offline interactive scenario when you have the user to fill the PDF form offline and then send back to you at a given e-mail address.
The inbound processing of the form sent via e-mail requires a configuration setting in transaction SO50
(Exit Rules for Inbound Processing). In our context, it lets us specify how the received PDF form attachment at a given e-mail address is to be handled. The generic main inbound handler class CL_FP_INBOUND_HANDLER
should be entered in the Exit Name field for the receiving e-mail address.
Once an e-mail is received, the PDF attachment is forwarded for processing to the generic inbound handler, which retrieves the entered data and then calls the application inbound handler relevant to the form in question.
In addition, an (application) inbound class handler based on the interface IF_FP_OFFLINE
must be created and necessary code written in its methods. This class is used for processing the received form data in XML format (received from the generic handler) and extract the data entered by the user in it by converting them to ABAP variables.
The advantages are that with minimal configuration and coding, the desired requirement may be achieved. This recipe will cover the configuration of transaction SO50
and the inbound handler class (and its method coding).
The standard SAP examples were referred to while creating this recipe. This includes the inbound handler class CL_FP_OFFLINE_FP_TEST_IA_01
and the Adobe form FP_TEST_IA_01
.
As a prerequisite, the basis consultant must do the settings for the activation of the SMTP plug-in in the SAP system. This ensures that e-mail communication takes place and is received without problems.
An ABAP program must be created that will send the PDF form to the respective user. This will then be filled by the user and then sent to the specified e-mail address in SO50
(and our inbound processing will take on from there). The program will use the Business Communication Service. An important thing to make sure is that when the function module for the Adobe form is called, the FILLABLE field of parameter structure /1BCDWB/DOCPARAMS
must be assigned the value F
(and not X).
In addition to the earlier, the value F means Activates Special handling for Offline Interactive Scenarios.
For the sake of this recipe, we assume that we have created two fields FIELD1
and FIELD2
in the interface and the context respectively. The user has entered the values of the FIELD1
and FIELD2
fields in the form and these values are to be extracted.
We will now carry out the following steps:
SO50
. Call the transaction SO50
. The screen appear as shown in the following screenshot:CL_FP_INBOUND_HANDLER
in the Exit Name field. Select the Communication Type as Internet Mail. Enter the recipient address at which the user will send the filled form. For example, [email protected]
.
SE24
and enter the name of the inbound class that you like to create ( in our case ZST8_OFF_HANDLER
).IF_FP_OFFLINE
. This will include two methods in our class (namely, GET_INSTANCE
and HANDLE_PDF
).GET_INSTANCE
method as shown below:HANDLE_PDF
code is then written. Within the HANDLE_PDF
method, we first call the function module FP_FUNCTION_MODULE_NAME
. The form name parameter of the function module is supplied with the form name stored in the method parameter IV_FORM_NAME
. The inbound function module name is then imported in the variable INBOUND_FM
. The code is shown in the following screenshot:MYFIELD1
and MYFIELD2
of our class.ZST_TAB
under cluster ID ZA
under key with value in MYFIELD1
).SFP
and enter the name of the class created in the previous steps in the Properties tab of the form under consideration.Within the mail-sending program, the assignment of F for the FILLABLE field adds necessary information to the attached PDF relevant to the offline scenario. Once the form is filled and sent back by the user to the e-mail address specified in transaction SO50
, it is handled by the Adobe Infrastructure offline, that passes it and the XML data contained in it to the inbound handler class.
The main method HANDLE_PDF
is used for transforming the XML data entered in the form into data variables. The form name and the data in XML form are passed to the method through the parameters IV_FORM
and IV_XML
respectively. We first get the function module corresponding to our form that allows the transformations of the XML data into ABAP variables corresponding to context data. The FP_FUNCTION_MODULE
function is passed the name of the form name contained in importing parameter IV_FORM
and then the function module corresponding to EV_FUNCNAME_INBOUND
parameter is imported and stored in INBOUND_FM
. The function module whose name is stored in variable INBOUND_FM
is then called and supplied with the XML Data ( contained in IV_XML
). The function module transforms the XML and the returned ABAP data is stored in FIELD1
and FIELD2
variables.
3.15.137.59