Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 15

SAP Adobe Interactive Form Tutorial.

Part V. Images, Graphics and Logo in


Adobe Forms
By
Ram Daruru
-
February 7, 2017
8

Share on Facebook

Tweet on Twitter

In the previous part, we learned how to use Javascript in SAP Adobe Forms
to control the conditions. Today, we would learn how to include a logo on
an Adobe Form output.

Pre-requisite: We need to upload the required logo/image as shown below


in the T-code SE78 (same as we do for Smartforms).
Once you upload the image to SAP from your laptop/desktop/local machine,
please do not forget to validate it in t-code SE78. Check our logo image can
be found in SAP system.
Prepare the Form Interface

Transaction Code: SFP. Enter the Interface name and Create (Interface is


mandatory for Adobe form).

Enter the short description and Save.


Enter the Package name and Save.

Let us add our own custom Parameter Name for the image/logo. Select the
Import option under Form Interface (left side) and press the Create button
(right side) to add an Importing Parameter.
Please note: IV_LOGO is of type XSTRING (Data Type).
Save, Check and Activate the Interface.

Also Read: Still have doubts on SAP HANA?

Design the Form Layout


Go to back SFP Transaction main screen. Create the form.

Press on create button. Provide the short description and Interface name
which you have created earlier.

Enter the Package name and Save.


Drag IV_LOGO from Interface which we created earlier and drop them to
the Context area.
Right click on the YRAM_ADOBE_FORM5 under the context and create a
graphic.
Important step: Change the Graphic type from Graphic Reference to
Graphic content

Hit return key/enter key.


Select Yes option.

Enter Field as IV_LOGO (or whatever name you have given above)
And MIME Type as ‘IMAGE/BMP’.

Save.

Go to Layout. Choose the Data View Tab. Drag and drop the Graphic on the
layout.
You can stretch or condense your logo as per your need. You might want to
remove the logo caption i.e. the default Image Field text. This Image Field
text is a good place to write the tagline of the company/logo if you have
any. Else we can leave it blank.

We have added another text element below the logo for demonstration
purpose.

Check, Save and Activate. Our Layout with a Graphic and Form Interface is
complete. Did you notice, we have two elements in our layout. The logo
field and the graphic content. It can be compared to the variable name
and the actual content.

Driver Program to call the Adobe Form


You can use the below code as a reference to plug and play for printing the
logo.
1  
2 *&---------------------------------------------------------------------*
3 *=======================================================
4 ===============*
5 * YRAM_ADOBE_FORM_PROGRAM5 *
6 *=======================================================
7 ===============*
8 * Project : SAP Adobe Forms Tutorial *
9 * Author : Ramanjula Naidu DARURU (www.SAPYard.com) *
10 * Description : Printing a logo in the adobe form *
11 *=======================================================
12 ===============*
13 REPORT yram_adobe_form_program5.
14  
15 *=======================================================
16 ===============*
17 * Selection Screen
18 *=======================================================
19 ===============*
20 PARAMETERS : p_logo TYPE rstxt-tdname.
21 *=======================================================
22 ===============*
23 * Data Objects
24 *=======================================================
25 ===============*
26  
27 DATA: gv_fm_name TYPE rs38l_fnam, " FM Name
28 gs_fp_docparams TYPE sfpdocparams,
29 gs_fp_outputparams TYPE sfpoutputparams,
30 gv_name TYPE tdobname,
31 gv_logo TYPE xstring ,
32 gv_bmp TYPE xstring.
33 *=======================================================
34 ===============*
35 * Constants
36 *=======================================================
37 ===============*
38 CONSTANTS : gc_btype TYPE tdbtype VALUE 'BCOL',
39 gc_id TYPE tdidgr VALUE 'BMAP',
40 gc_object TYPE tdobjectgr VALUE 'GRAPHICS',
41 gv_form_name TYPE fpname VALUE 'YRAM_ADOBE_FORM5'.
42  
43 *=======================================================
44 ===============*
45 * START of Calling the Form
46 *=======================================================
47 ===============*
48 *&---------------------------------------------------------------------*
49 **&&~~ Form Processing: Call Form - Open
50 *
51 CALL FUNCTION 'FP_JOB_OPEN'
52 CHANGING
53 ie_outputparams = gs_fp_outputparams
54 EXCEPTIONS
55 cancel = 1
56 usage_error = 2
57 system_error = 3
58 internal_error = 4
59 OTHERS = 5.
60 IF sy-subrc <> 0.
61 " Suitable Error Handling
62 ENDIF.
63 *&---------------------------------------------------------------------*
64 **&&~~ Get the Function module name based on Form Name
65 *
66 CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
67 EXPORTING
68 i_name = gv_form_name
69 IMPORTING
70 e_funcname = gv_fm_name.
71 IF sy-subrc <> 0.
72 " Suitable Error Handling
73 ENDIF.
74  
75 *  Passing the logo name
76 gv_name = p_logo.
77  
78 *  Get the image/logo graphic information
79 CALL METHOD cl_ssf_xsf_utilities=>get_bds_graphic_as_bmp
80 EXPORTING
81 p_object = gc_object " GRAPHICS
82 p_name = gv_name " Name of the Logo
83 p_id = gc_id " BMAP
84 p_btype = gc_btype " BCOL for color, 'BMON' for Black & White
85 RECEIVING
86 p_bmp = gv_bmp
87 EXCEPTIONS
88 not_found = 1
89 internal_error = 2
90 OTHERS = 3.
91  
92 gv_logo = gv_bmp.
93  
94 *&---------------------------------------------------------------------*
95 **&&~~ Take the FM name by execuing the form - by using Pattern-
96 **&&~~ call that FM and replace the FM Name by gv_fm_name
97 **&&~~ Call the Generated FM
98 CALL FUNCTION gv_fm_name
99 EXPORTING
10 /1bcdwb/docparams = gs_fp_docparams
0 * iv_name = p_name
10 * iv_flag = p_flag
1 iv_logo = gv_logo
10 EXCEPTIONS
2 usage_error = 1
10 system_error = 2
3 internal_error = 3
10 OTHERS = 4.
4 IF sy-subrc <> 0.
10 * Implement suitable error handling here
5 ENDIF.
10 *&---------------------------------------------------------------------*
6  
10 *&---------------------------------------------------------------------*
7 *&---- Close the spool job
10 CALL FUNCTION 'FP_JOB_CLOSE'
8 EXCEPTIONS
10 usage_error = 1
9 system_error = 2
11 internal_error = 3
0 OTHERS = 4.
11 IF sy-subrc <> 0.
1 * <error handling>
11 ENDIF.
2
11
3

Let us Test our baby 


Execute Program : YRAM_ADOBE_FORM_PROGRAM5

Provide the image/logo name which we uploaded in SE78 or any other logo
name which is already available in SAP system. We would use
SAPYardLogo.
Please check the program above. The logo property is dynamically obtained
from the image name and fed to the SAP Adobe Form. You can input any
image you want from your SAP system. The program would handle it
automatically to obtain the signature of the image and pass it correctly to
the Adobe Form.

Press on Print preview and view the output with your image.
Check our logo. Do you like SAPYard Logo? Do you have any better
suggestion for the logo for our site?

Do you have anything to add to this article? Have you faced any issue
understanding and working on Adobe Form? Do you want to share any real
project requirement or solutions? Please do not hold back. Please leave
your thoughts in the comment section.

If you GENUINELY like our articles then it would be a HUGE help if you
subscribed and liked us on facebook. It might seem insignificant, but it
helps more than you might think.

Thank you very much for your time!!

You might also like