Working with Adobe offline infrastructure

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.

Getting ready

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).

Getting ready

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.

How to do it...

We will now carry out the following steps:

  1. The appropriate setting must be done in the transaction SO50. Call the transaction SO50. The screen appear as shown in the following screenshot:
    How to do it...
  2. Click the How to do it... button. A new row appears as shown. Enter the class name 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].
  3. Next, we will create the inbound handler class.
  4. Call transaction SE24 and enter the name of the inbound class that you like to create ( in our case ZST8_OFF_HANDLER).
    How to do it...
  5. We will include the interface IF_FP_OFFLINE. This will include two methods in our class (namely, GET_INSTANCE and HANDLE_PDF).
    How to do it...
  6. A simple one line code needs to be added to the GET_INSTANCE method as shown below:
    How to do it...
  7. The method 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:
    How to do it...
  8. We then declare variables corresponding to the two data fields defined in the context. The inbound function module is then called that transforms the XML data of the form into the variables MYFIELD1 and MYFIELD2 of our class.
    How to do it...
  9. The values of the two fields may then be saved into the database (for testing purpose, we save it in a cluster in a table ZST_TAB under cluster ID ZA under key with value in MYFIELD1).
    How to do it...
  10. Next, we need to connect the inbound class created with the form in question. For this we will go to transaction SFP and enter the name of the class created in the previous steps in the Properties tab of the form under consideration.
    How to do it...

How it works...

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.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.137.59