Interface in Abap
Interface in Abap
Contents:
1. Interface Creation: ................................................................................................................................ 2
Adding Import and Export Parameters: .................................................................................................... 2
Defining Global Data in the Interface: ...................................................................................................... 3
Defining Code Initialization: ...................................................................................................................... 4
2. Form Creation ....................................................................................................................................... 5
Adding Text Box and Floating Fields to the Layout: .................................................................................. 6
Adding an Internal Table to the Layout: ................................................................................................. 10
Adding grand total and subtotal to the layout: ...................................................................................... 13
SUBTOTAL: To add the subtotal in the table for the column. ............................................................. 13
GRAND TOTAL: .................................................................................................................................... 18
Adding Flowing table in the form: .......................................................................................................... 19
3. Driver Program:................................................................................................................................... 21
P a g e 1 | 21
1. Interface Creation:
For creating an interface, select an interface radio button and give an interface a name as per
requirement. For example, ZTEST and click on create.
Give interface description and select a proper interface type as per the requirement and then click on ok.
Step 3: On the interface home screen, you will find the below options which you can define as per your
requirement.
P a g e 2 | 21
Step 4: For creating an import parameter, click on import and enter the parameter name and associated
type of it as shown below.
Check the Pass by Value check box. If you want to pass a default value, you can initialize it here.
Declaration of global data requires variable name, type and type name.
P a g e 3 | 21
Defining Code Initialization:
Import and export parameters are passed as below:
Required code can be written in the block highlighted by blue in the above screenshot.
Once all the code is written, save the interface and activate it.
P a g e 4 | 21
2. Form Creation
Step 2: Give the name as required for the form and then click on the create button.
Give the description of the form as required and interface name which we have created in the earlier step
and then click on ok.
Step 3: You will find the home screen as below with the interface and all the fields we created in the
interface. Drag the fields you need to use in the layout from interface to context.
Once all the fields are in the context block then you need to select layout.
P a g e 5 | 21
Step 4: For the creation of layout, there should be “ADOBE LIFECYCLE DESIGNER” installed in your PC else
it gives an error.
Once this designer is downloaded, click on the layout field as shown below.
Step 5: Once you click on the layout, you will see the below page.
a. Using the object library highlighted in the above screenshot with red color.
We can add the various boxes and fields (Content area, text box, text area, table, password block,
Signature field etc.) using the Object Library.
b. Using the area highlighted with Blue color in the above screenshot, we can drag and drop the fields in
the layout to the Master Pages.
To ADD a field with field name and value from the code, follow the simple steps shown below.
P a g e 6 | 21
In the Screenshot shown above, to add a value for example Customer PO No.
o Select a text box from the Object library and drag it to the required Position.
o Write the Text to be displayed for example Customer PO No.
o To add a field which will be coming from the driver program, right click in the text box, there you
will find the below options.
Select as floating field. This will add a text field as shown below in the text box.
P a g e 7 | 21
Once this TextField appears in the Text box. Go to the option Palettes in the Layout block shown below.
P a g e 8 | 21
Click on the small block near Data Binding which will open the new block.
Click on ZTEST_FORM and select the field from the list which you wish to assign as shown below.
This will create a Text box with the text field you required as shown below.
Using this method, you can add as many boxes as you want in the layout.
P a g e 9 | 21
Adding an Internal Table to the Layout:
Under this option, there will be list of the internal tables defined in the interface.
Find the specific table you wish to add in the layout from the list. For example, refer to the screenshot
below.
Select the table from the list and drag it into the layout where you want to add the table.
It will automatically add all the fields defined in the table in the interface.
P a g e 10 | 21
Refer to the screenshot below for the detail view of how the internal table looks once added to the
layout.
If we want to add a column with 2 more internal columns, then this can be achieved as follows:
While defining structure in SE11. Just add another table in the data type of the field with the fields you
want to add as shown below.
P a g e 11 | 21
Inside the table under data type, add all the fields you want inside that column as shown below.
And when you create a table of this structure type and add it in the interface of the form as shown below.
Now just drag and drop the table in the form, it will automatically create the table with column containing
internal columns as shown.
P a g e 12 | 21
Adding grand total and subtotal to the layout:
We can perform the grand total and sub-total for the fields and columns we want in the Adobe form. To
add the sub-total or grand total, refer the points below.
Step 1: Go to the form and then go to the context. In the context, select the table and there you will get a
data option as shown below.
P a g e 13 | 21
Double click on the table (ex: GT_ITEM_DETAILS) and click on the control level and add a line there as
shown below.
Just like POSNR, add all the fields based on which you wish to perform the total.
Step 2: Now go to the layout and select the field on which you want the total.
P a g e 14 | 21
In the hierarchy column, select the field (QTY (sales UOM)), right click on it and add a row as shown
below.
P a g e 15 | 21
Step 3: Now add a text box under the field where we want our subtotal to be displayed.
For adding a text box please refer the steps shown above.
Step 4: Once the text box is added, select the text box and add a object from the palettes as shown below.
P a g e 16 | 21
Select TYPE as Calculated Read only.
Step 5: After this Select the Expand arrow in the layout as shown below.
When you click on this expand arrow, you will get the below screen.
P a g e 17 | 21
Step 6: Now select "CALCULATED" from the show highlighted in RED color in the below screenshot and
"FORMCALC" from language highlighted in blue.
Step 7: Write the code(logic) in the below block for addition and then save and activate the form.
Following this few simple steps will add the subtotal to the block.
GRAND TOTAL:
Step 1: For example, we have a table in the layout. Now to add a grand total for a column or to a group of
columns, group the elements of the body row for which we want to add a grand total.
P a g e 18 | 21
Step 2: Now follow the same steps as we did for Subtotal, just write the logic for Grand total in the code
block.
This will add a grand total block in the footer of the table as required.
Right Click on the pages and click on insert sub-form as shown below:
P a g e 19 | 21
Step 2: Click on Sub-form, a box will appear in the layout and expand it according to requirement and add
the footer in the sub-form.
Step 3: Drag and drop the table as we did previously. Now we need to make the table so that if the size of
the table increases, it extends to the next page automatically. To make the table flowing, click on the sub-
form in data view and click on palettes and objects. There you will find the below block.
P a g e 20 | 21
Select content as “Flowed”, this will create a flowing table.
Now, if the table flows to the next page then the footer will get printed on the last page only.
3. Driver Program:
To Call Adobe Form through ABAP Program, we need a driver program.
Go to transaction SE38.
Write the below Code in your Program to call the ADOBE FORM.
Writing the above Driver Program with passing required fields will create a driver program.
P a g e 21 | 21