Hi, I provide training in SAP UI5. Also feel free to checkout my new web page https://saptechblog.com
Adobe forms

Driver program in Adobe forms

This tutorial explains how to create a driver program for adobe forms/ calling the adobe form in a report.

The driver program has been created for the adobe form created in the following tutorial.

http://www.teamabap.com/2014/05/tables-in-adobe-form.html

The process for creating the driver program for the adobe forms is similar to that of the Smart forms.

Procedure:

1.       Open the job for form processing using function module – FP_JOB_OPEN.

2.       Call the function module to get the FP_FUNCTION_MODULE_NAME and pass the adobe form name to get the name of the function module generated for the adobe form.

3.       Call the function module generated for the adobe form and pass the required data to the interface of the function module.

4.       Close the job for form processing using the function module – FP_JOB_ CLOSE.

 

Go to the Tcode SE38 (ABAP Editor) and create a executable report program and paste the sample code below.


data : lv_form name type fpname value 'ZAF_SFLIGHT'.
data : lv_fmname   type
rs38l_fnam.
data : ls_output   type
sfpoutputparams.
data : ls_result   type
sfpjoboutput,
       lv_spoolid 
type
rspoid.


* Function module to get the name of the function module generated for

* Adobe form.

call function 'FP_FUNCTION_MODULE_NAME'
 
exporting
    i_name     = lv_formname
 
importing
    e_funcname = lv_fmname.


* Open the job using function module FP_JOB_OPEN

ls_output-connection =
'ADS'.

call function 'FP_JOB_OPEN'

 
changing
    ie_outputparams = ls_output
 
exceptions
    cancel          =
1
    usage_error     =
2
    system_error    =
3
    internal_error  =
4
   
others          = 5.


* Call the function module generated for the adobe form ZAF_SFLIGHT
* and replace the function module name with variable lv_fmname.
* in this example the form does not have any importing parameters

call function lv_fmname     "                             '/1BCDWB/SM00000642'
* EXPORTING
*   /1BCDWB/DOCPARAMS        =
* IMPORTING
*   /1BCDWB/FORMOUTPUT       =
* EXCEPTIONS
*   USAGE_ERROR              = 1
*   SYSTEM_ERROR             = 2
*   INTERNAL_ERROR           = 3
*   OTHERS                   = 4
          .


* Close the job calling the function module FP_JOB_CLOSE

call function 'FP_JOB_CLOSE'
 
importing
    e_result       = ls_result
 
exceptions
    usage_error    =
1
    system_error   =
2
    internal_error =
3
   
others         = 4.

* Check the result.

if ls_result-userexit is initial.
 
if ls_result-spoolids is
initial.
   
message id 'PO' type 'E' number '475'
.
  else.
   
read table ls_result-spoolids index 1 into
lv_spoolid.
   
message id 'PO' type 'S' number '622' with
lv_spoolid.
  endif.
endif.

 

By executing this program, the system will prompt for the output device name. Fill in the device name with dummy printer (LP01) and click on print preview to see the output.

 

 

Output:

clip_image002

 

clip_image004

 

 

In case you want to run the program in the background set the output option parametes as below to avoid the popup.

 

ls_output-nodialog = 'X'.
ls_output-Preview =
'X'
.
ls_output-DEST  =
'LP01'
.

 

 

 

About Arun

1 Comments:

Powered by Blogger.