0% found this document useful (0 votes)
31 views3 pages

Example Calling Forms in An Application Program ABAP

The document provides an excerpt of a program that demonstrates how to call function modules for printing forms in an application. It outlines the steps to open a spool job, retrieve the form name, invoke the generated function module with parameters, and close the spool job, including error handling for each step. Key data types and parameters used in the process are also defined.

Uploaded by

viceawork05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views3 pages

Example Calling Forms in An Application Program ABAP

The document provides an excerpt of a program that demonstrates how to call function modules for printing forms in an application. It outlines the steps to open a spool job, retrieve the form name, invoke the generated function module with parameters, and close the spool job, including error handling for each step. Key data types and parameters used in the process are also defined.

Uploaded by

viceawork05
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Example: Calling Forms in an Application Program

The following is a program excerpt showing how the function modules


are called.
1. FP_JOB_OPEN opens the spool job.
2. FP_FUNCTION_MODULE_NAME gets the form name.
3. Generated function module of the form
4. FP_JOB_CLOSE closes the spool job.
In this example, the parameters CUSTOMER, BOOKINGS, and
CONNECTIONS are sent to the form interface, where they must
already be defined.

DATA: CUSTOMER TYPE SCUSTOM,


BOOKINGS TYPE TY_BOOKINGS,
CONNECTIONS TYPE TY_CONNECTIONS,
FM_NAME TYPE RS38L_FNAM,
FP_DOCPARAMS TYPE SFPDOCPARAMS,
FP_OUTPUTPARAMS TYPE SFPOUTPUTPARAMS.

* GETTING THE DATA


<data selection>

* PRINT:

* Sets the output parameters and opens the spool job


CALL FUNCTION 'FP_JOB_OPEN'
CHANGING
IE_OUTPUTPARAMS = FP_OUTPUTPARAMS
EXCEPTIONS
CANCEL = 1
USAGE_ERROR = 2
SYSTEM_ERROR = 3
INTERNAL_ERROR = 4
OTHERS = 5.
IF SY-SUBRC <> 0.
<error handling>
ENDIF.

* Get the name of the generated function module


CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
EXPORTING
I_NAME = ‘<form name>’
IMPORTING
E_FUNCNAME = FM_NAME.
IF SY-SUBRC <> 0.
<error handling>
ENDIF.

* Language and country setting (here US as an example)


fp_docparams-langu = 'E'.
fp_docparams-country = 'US'.

* Call the generated function module


CALL FUNCTION FM_NAME
EXPORTING
/1BCDWB/DOCPARAMS = FP_DOCPARAMS
CUSTOMER = CUSTOMER
BOOKINGS = BOOKINGS
CONNECTIONS = CONNECTIONS
* IMPORTING
* /1BCDWB/FORMOUTPUT =
EXCEPTIONS
USAGE_ERROR = 1
SYSTEM_ERROR = 2
INTERNAL_ERROR = 3.
IF SY-SUBRC <> 0.
<error handling>
ENDIF.

* Close the spool job


CALL FUNCTION 'FP_JOB_CLOSE'
* IMPORTING
* E_RESULT =
EXCEPTIONS
USAGE_ERROR = 1
SYSTEM_ERROR = 2
INTERNAL_ERROR = 3
OTHERS = 4.
IF SY-SUBRC <> 0.
<error handling>
ENDIF.

You might also like