SAP Adobe Interactive Form Tutorial - Part 1
SAP Adobe Interactive Form Tutorial - Part 1
Share on Facebook
Tweet on Twitter
Spice of this part by Ram: Many of us ABAPer do not know that Adobe
Form can be tested stand alone in t-code SE37 (just like smartform). You
will not find this trick in every other Adobe Form tutorial. .
So buckle your seat belts and get ready for this beautiful journey on SAP
Adobe Form with our experience Pilot, Ram Daruru.
Enter the Interface and Create (Interface is mandatory for Adobe form).
What are the uses of Form Interface?
1. In the form interface, you specify the data that is exchanged with the
application program (such as tables, structures, work areas).
2. Under Global Definitions, you define your own fields, variables etc.
3. The system fields contain data with a predefined meaning (such as
the date).
Let us add our own custom Parameter Name. Select the Import option
under Form Interface (left side) and press the Create button (right side) to
add an Importing Parameter IV_TEXT.
For this tutorial, IV_TEXT is of type CHAR30 and check the optional Flag.
Go Back or go to t-code SFP again. This time we need to create the Form.
Provide the Description of the Form and the Interface name which we
created earlier.
Enter the Package name and Save.
This is the first look of our Form. Left side we have the Interface and right
side the Context.
Expand the Import Parameter and Drag and drop the required variable to
Context
In the context (also known as the form context), you specify which data is
copied from the interface to the form. You can also include this data as a
node in a hierarchy structure. In this hierarchy, you can also decide the
form logic by specifying conditions for processing the nodes.
The context function in Form Builder is the link that binds the interface to
the layout. You construct the form context from the existing interface.
In short, if you want your parameters i.e internal tables, work areas or
variable etc to be passed from your driver program to Interface and then to
the Form then you need to define that internal table, work areas or
variables at the Context of the Form. Does it make sense? Or did I
If you do not like short cuts (drag and drop) or if you want the context
parameter name to be different than that in Form Interface, then you need
to specify the Data Field in the properties of the Context element by
yourself. For example, if you want to create a context P_TEXT but you want
to bind it with IV_TEXT, then the Data Field should be IV_TEXT as shown
below.
Tip: Drag and Drop from Interface to the Context and then change the
name/description of the Context element. This will save your time and you
do not need to maintain the properties explicitly.
Let us chose Data View and Drag and Drop the Field which we want to print
on the form to Design view. You can place this filed anywhere in the layout.
For our example, we have just one element IV_TEXT. The reason being
simple. We created just one element in the Context. You can add a couple
of more context elements and they would be available here to be passed to
the layout. In next posts, we will add more complexity to our requirement
and you would be able to see how we can handle multiple elements.
You can change the Caption from IV_TEXT to required caption. For
example: Text. Click on the element and change the properties of the
Object on the right hand side.
You might also like to check ‘How I used SAP Adobe Form as my
personal PDF editor’
To see output for test purpose even before your calling program or driver
program is ready, you can press F8 and again F8 and input some value to
the Interface and check the output.
note: Hopefully, by now you have realized that like Smartform, Adobe form
also generates a function module in the back end.
Execute (F8)
Press on Print preview button. Check the input parameter is successfully
passed from interface to the layout.
Like SAP Script and Smartform, Adobe Form also need a Driver Program.
Forms have no utility if they are alone. They need a partner to be complete.
1
2 *&---------------------------------------------------------------------*
3 *=======================================================
4 ===============*
5 * YRAM_ADOBE_FORM_PROGRAM1 *
6 *=======================================================
7 ===============*
8 * Project : SAP Adobe Forms Tutorial *
9 * Author : Ramanjula Naidu DARURU *
1 * Description : Driver Program to Print Adobe form *
0 *=======================================================
1 ===============*
1 REPORT yram_adobe_form_program1.
1
2 TABLES : apb_lpd_otr_keys.
1
3 **&&~~ Data Objects
1 DATA: gv_fm_name TYPE rs38l_fnam, " FM Name
4 gs_fp_docparams TYPE sfpdocparams,
1 gs_fp_outputparams TYPE sfpoutputparams.
5
1 CONSTANTS : gv_form_name TYPE fpname VALUE 'YRAM_ADOBE_FORM1'.
6
1 **&&~~ Selection Screen
7 *
1 PARAMETERS : p_text TYPE char30.
8 *&---------------------------------------------------------------------*
1 **&&~~ Form Processing: Call Form - Open
9 *
2 CALL FUNCTION 'FP_JOB_OPEN'
0 CHANGING
2 ie_outputparams = gs_fp_outputparams
1 EXCEPTIONS
2 cancel = 1
2 usage_error = 2
2 system_error = 3
3 internal_error = 4
2 OTHERS = 5.
4 IF sy-subrc <> 0.
2 " Suitable Error Handling
5 ENDIF.
2 *&---------------------------------------------------------------------*
6 **&&~~ Get the Function module name based on Form Name
2 *
7 CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
2 EXPORTING
8 i_name = gv_form_name
2 IMPORTING
9 e_funcname = gv_fm_name.
3 IF sy-subrc <> 0.
0 " Suitable Error Handling
3 ENDIF.
1 *&---------------------------------------------------------------------*
3 **&&~~ Take the FM name by executing the form - by using Pattern-
2 **&&~~ call that FM and replace the FM Name by gv_fm_name
3 *
3 **&&~~ Call the Generated FM
3 CALL FUNCTION gv_fm_name "'/1BCDWB/SM00000176'
4 EXPORTING
3 /1bcdwb/docparams = gs_fp_docparams
5 iv_text = p_text
3 * IMPORTING
6 * /1BCDWB/FORMOUTPUT =
3 EXCEPTIONS
7 usage_error = 1
3 system_error = 2
8 internal_error = 3
3 OTHERS = 4.
9 IF sy-subrc <> 0.
4 * Implement suitable error handling here
0 ENDIF.
4 *&---------------------------------------------------------------------*
1 **&&~~ Form Processing: Call Form - Open
4 *
2 CALL FUNCTION 'FP_JOB_CLOSE'
4 * IMPORTING
3 * E_RESULT =
4 * EXCEPTIONS
4 * USAGE_ERROR = 1
4 * SYSTEM_ERROR = 2
5 * INTERNAL_ERROR = 3
4 * OTHERS = 4
6 .
4 IF sy-subrc <> 0.
7 * Implement suitable error handling here
4 ENDIF.
8 *&---------------------------------END----------------------------------*
4
9
5
0
5
1
5
2
5
3
5
4
5
5
5
6
5
7
5
8
5
9
6
0
6
1
6
2
6
3
6
4
6
5
6
6
6
7
6
8
6
9
7
0
7
1
7
2
7
3
7
4
7
5
7
6
7
7
7
8
7
9
8
0
8
1
8
2
8
3
8
4
Let us test the Output using the Driver Program:
Execute the Driver Program and chose the Print Preview option. The input
field is correctly displayed in the Form Layout.
Hopefully, you liked this simple article. This is just the ABCs of Adobe Form.
In next articles (Tables in Adobe Form), we would learn the words and then
start framing the sentences using these ABCs. . Do not worry, we will
hand hold you in this learning activity. But, you cannot learn to swim unless
you enter the water. So try practicing this simple exercise in your system
and I am sure you will have no issue. If any issue just shoot an email to
[email protected] or leave your questions in the comment section
and you will definitely have a quick response.
If you want to get such useful articles directly to your inbox, please
SUBSCRIBE. We respect your privacy and take protecting it seriously.
If you liked this post, please hit the share buttons and like us on
facebook.
Do you have anything to add to this article? Have you faced any issue using
Adobe Forms? Do you want to share any real project requirement or
solutions? Please do not hold back. Please leave your thoughts in the
comment section.