Wednesday, February 9, 2011

Sending an Adobe form as an attachment in an email

Consider the offline scenario where the candidate gets the appointment letter along with personnel information form as an attachment to his/her email after he/she has been completed final round of interview. He/She fills the form and sends it back. The data from the PDF is then retrieved and updated in SAP by HR. For this we don’t require Web Dynpro Development.

In this document we discuss how to send PDF file as an E-mail attachment to respective candidate.

Step1: Go to transaction SFP to create form interface. Provide the interface name ‘ZPERSONNEL_INT’.

Click on create button and provide the description.

Click on Save. Provide the package name in the following screen and press enter.

Step2: Define the IMPORT parameter as shown.

Now save and active the interface.

Come back to initial screen of form.

Step3: Now create form. Provide the form name ‘ZPERSONNEL’.

Click on create button and provide the description and interface name.

Click on save and provide the package.

Step4: Drag the IMPORT parameter ‘EMP_INFO’ from interface to context tab.

Step5: Now go to layout tab.

Drag the drop the each field from data view to layout editor as shown.

Save and activate it.

We can provide the tool tip text using Accessibility tab as shown.

Step6: Now create an ABAP program which will create a form and email to selected candidate so that it can be filled offline. (Click here for the program used for this demo purpose)

The program will have the following steps

A. Obtain the name of the generated function module of the form using ‘FP_FUNCTION_MODULE_NAME’ by pass the form name to it.

B. Set the output parameter and open the spool job. Fill the value ‘X’ to NODIALOG and GETPDF parameter of the structure SFPOUTPUTPARAMS. Pass this structure to function module ‘FP_JOB_OPEN

C. Call the generated function module. Pass the value ‘X’ to parameter FILLABLE of the structure SFPDOCPARAMS (Form parameters for Form Processing) which is standard parameter. By default this FILLABLE parameter is assigned with space. When ‘X’ is passing to this parameter then form acts as interactive form, otherwise it is print form.

D. Now the PDF file generated is available in the parameter PDF of structure /1BCDWB/FORMOUTPUT. Convert the generated PDF file data to binary format using the function module ‘SCMS_XSTRING_TO_BINARY’.

E. Send this form to mail as a PDF attachment using Business Communication Service (BCS).

Step7: Now execute the ABAP program.

Click on ‘OK’ button.

Now check the email.




No comments:

Tutorials on SAP-ABAP

Adobe Interactive Forms Tutorials

Business Server Pages (BSP)

Userexits/BADIs

Web Dynpro for ABAP (Step by step procedure for web dynpro,Tutorials on Web Dynpro,)

ALV Tutorials

Blog Archive

goodsites