Skip to Content

Web Service using ADOBE forms

Scenario: Fetching the Material Description for a Material in Adobe Form using Web Service.


Consider a Scenario User enters a Material Number in a Adobe Form and the Material Description has

to be fetched from the Material master table , for this we use web service to fetch the description.


I. Create a Web Service:

  Step 1: we need to create a Remote enable function module

/wp-content/uploads/2014/05/1_461958.jpg

Step 2 : Define one Import parameter material number(MATNR) and Two Export parameter material Description (MAKTX) and BAPIRETURN (Mandatory)

/wp-content/uploads/2014/05/2_461959.jpg

/wp-content/uploads/2014/05/3_461966.jpg

  Step 3: Write the code for to fetch the material description in source code.

/wp-content/uploads/2014/05/1_461958.jpg

Then activate and check the function module

Step 4: Goto the Utilities->More utilities->Create web service->From the function module

/wp-content/uploads/2014/05/1_461958.jpg

Step 5: A Web Service Wizard  will be displayed

Give the Service name and Description

Press continue

/wp-content/uploads/2014/05/1_461958.jpg
Press continue

/wp-content/uploads/2014/05/1_461958.jpg
Press continue

/wp-content/uploads/2014/05/1_461958.jpg
Check local object or package name

Press continue

/wp-content/uploads/2014/05/1_461958.jpg
Press complete

/wp-content/uploads/2014/05/1_461958.jpg

Step 6: Now goto Transaction SOAMANAGER

The browser will start

Goto Tab Business Administration ->Web Service Administration

/wp-content/uploads/2014/05/1_461958.jpg
To find your webservice type your Service name in the Search  Pattern and then select your service then click

/wp-content/uploads/2014/05/1_461958.jpg
Step 7: Click Open WSDL Document for selected binding

/wp-content/uploads/2014/05/1_461958.jpg
A Browser Window opens with XML code

Copy the URL, This URL is the generated WSDL Link.

/wp-content/uploads/2014/05/1_461958.jpg

II . Create Adobe Forms

Step 1 : Then goto the transaction SFP and create a empty interface then create a form

Goto the layout tab

Edit ->New data connections

/wp-content/uploads/2014/05/1_461958.jpg

Enter a New Data Connection Name

Select WSDL File and click next

/wp-content/uploads/2014/05/1_461958.jpg

  Paste your URL and press next

/wp-content/uploads/2014/05/1_461958.jpg

Step 2 : Select your web service and press finish

The web service is added to the form .

Step 3 : In layout to create a new button and change it’s control type to Execute

/wp-content/uploads/2014/05/1_461958.jpg

In execute tab select your Data connection name

/wp-content/uploads/2014/05/1_461958.jpg

Step 4: Drag and drop the MATNR and MAKTX fields to the Form.

/wp-content/uploads/2014/05/1_461958.jpg
  activate the form

Step 5 : Create a print program for the form.

In the ‘####’ place  paste your form name

data: ie_outputparams type sfpoutputparams.

data: i_name type fpname,

i_funcname type funcname.

data: fp_docparams type sfpdocparams.

data: fp_formoutput type fpformoutput.

data: data_tab type SOLIX_TAB.

ie_outputparams-getpdf = ‘X’.

ie_outputparams-nodialog = ‘X’. ” suppress printer dialog popup

call function ‘FP_JOB_OPEN’

changing

ie_outputparams = ie_outputparams.

try.

i_name = ‘######################’.                                 “Your Form Name

call function ‘FP_FUNCTION_MODULE_NAME’

exporting

i_name = i_name

importing

e_funcname = i_funcname.

catch cx_fp_api_repository.

catch cx_fp_api_usage.

catch cx_fp_api_internal.

endtry.

fp_docparams-langu = ‘E’.

fp_docparams-country = ‘US’.

fp_docparams-FILLABLE = ‘X’.

call function i_funcname

exporting

/1bcdwb/docparams = fp_docparams

importing

/1bcdwb/formoutput = fp_formoutput

exceptions

usage_error = 1

system_error = 2

internal_error = 3.

call function ‘FP_JOB_CLOSE’

exceptions

usage_error = 1

system_error = 2

internal_error = 3

others = 4.

data: filename type string,

path type string,

fullpath type string,

default_extension type string value ‘PDF’.

cl_gui_frontend_services=>file_save_dialog(

exporting

default_extension = default_extension

changing

filename = filename

path = path

fullpath = fullpath ).

check fullpath is not initial.

call function ‘SCMS_XSTRING_TO_BINARY’

exporting

buffer = fp_formoutput-pdf

tables

binary_tab = data_tab.

cl_gui_frontend_services=>gui_download(

exporting

filename = filename

filetype = ‘BIN’

changing

data_tab = data_tab ).

cl_gui_frontend_services=>execute(

exporting

document = filename ).

Output :

Step 6 : Run the print program and then save the pdf form in your drive or desktop , then open the form  using the Adobe Reader (7.0 or above) .

Give the material number and press description Button , then it fetches the description of the Material entered.

/wp-content/uploads/2014/05/1_461958.jpg

Please let me know if anyone face any issue while developing or testing it.

Thanks & Regrads,

Arun,

Arunkumar Chandrasekar,

Senior Consultant – SAP Practice @Kaavian Systems Pvt. Ltd.

7 Comments
You must be Logged on to comment or reply to a post.