Sie sind auf Seite 1von 22

SAP Adobe Interactive Form Tutorial.

Part III. Date Time and Floating Fields


By
Ram Daruru
-
January 4, 2017
10

Share on Facebook

Tweet on Twitter

Contributed by: Ram Daruru, Cibersites India Pvt Ltd., Bengaluru,


India

In Part I and Part II of our Adobe Form Tutorial Series, we played with
simple layout and tables respectively. Date, Time and some system fields
along with Floating Fields (dynamic / changing) are some variables, which
we will need in every other Interactive Adobe implementation. It is a simple
concept but unless someone tells us for the first time, it is still a secret. So,
let us start our short journey on this untrodden path (till now in SAPYard).

Transaction Code: SFP. Hope by now you have embraced this t-code just
like SAPScript and Smartforms ( and can recollect it even in your dreams).

Create the Interface (Interface is mandatory for Adobe form). Although


the tutorial says, SAP Adobe Forms, but Interface is the vertebrae of any

Interactive Adobe.

Enter the short description and Save.


Enter the Package name and Save.

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.

NAME is of type NAME1 (Data Element). Save, Check, Activate the


Interface.

Go to back SFP Transaction main screen. Now is the time to create the
Form.
Hit Create and provide the short description and Interface name which
you have created above.

Enter the Package name and Save.


Drag NAME from Interface to the Context area. Hope you remember, we
explained the term Context in previous posts. Simply remember it as the
Global/Top Include whose variables are visible/available to the whole
application. If we want to show some fields in the Adobe from the
Interface, then the field has to be there in the Context area.

Drag and drop the DATE and TIME fields to Context. These are system
generated variables.
Now it is time to play in our Layout Area. You can design your layout as
beautifully as possible and as complex you want. But for our learning, we

will Keep It Simple and Sweet(KISS).

i. A practical example of “How to use a Floating Field in Adobe?”.

Go to Layout
Insert a Standard text field.
Expand/Stretch (as you do in ms paint) the text field boundaries so that
you can write a sentence in it.
Enter the below text or any line you want. But choose one word which you
want to keep as floating field. Floating means, it can be printed anything
as per the binding. It depends on the runtime value of the bound variable.

My name is NAME, I am SAP Technical consultant. Thank you SAP Yard.

For our example, we want NAME to be dynamic. Select the text (NAME),
Right-click on it and choose it as Floating Field. The word NAME changes to
{TextField}.
Do I need to tell you that if you see anything in curly braces in Adobe

Form, they are Floating Field?

Bind the floating field with NAME field which we dragged to the Context
area.
The Field {Text Field} will have dynamic length (maximum up to bound
NAME field from context). It would expand and condense in size according
to your input. Name “Ram” is only 3 character, but name
“Wolfeschlegelsteinhausenbergerdorff” has more than 30 characters, but
your {TextField} would still accept it. After all, that is the use of a Floating
Field.

ii. How to work with Date and Time in Adobe?

Go to Data view:

Drag and Drop Date and Time fields to Layout.


Also Read: What’s there in the Date?
—————————————————————————————–
Ram’s Tip 1: Choosing the right Date/Time Pattern (format).

Select the Date Field and Press on Patterns.

You can change the date format, By Selecting the Date Pattern under the
select type.
You can select the pattern based on country, under Locale, by selecting the
required country.

We can also format the Time using the same steps mentioned above for the
Date field.

Ram’s Tip 2: Know the standard system fields in Adobe.

In Adobe Forms, the below are the system fields available.


—————————————————————————————–

Check, Save and Activate.

Stand Alone Test of Adobe Form in T-code SFP:

Press F8 or hit the execute button on the top of your Adobe Form. Pass
your value to NAME Field.

Press F8 (Execute). Give you local printer name and hit Print Preview
You will get your Date, Time and Floater Fields (dynamic runtime value)

printed.
Let us call the Form from our Driver Program.
Do we need to show the output again? Trust us, it would be exactly as

above in the stand alone test.

Hopefully, by now, you know how to write a driver program to call your
Adobe form. Do you still need it? OK. Check the working driver program

below.  Make sure to handle the exceptions properly.

1  
2 *&---------------------------------------------------------------------*
3 *=======================================================
4 ===============*
5 * YRAM_ADOBE_FORM_PROGRAM3 *
6 *=======================================================
7 ===============*
8 * Project : SAP Adobe Forms Tutorial *
9 * Author : Ramanjula Naidu DARURU (www.SAPYard.com) *
1 * Description : Driver Program for Printing Floating Field, Date & Time *
0 *=======================================================
1 ===============*
1 REPORT yram_adobe_form_program3.
1  
2 * Selection Screen
1 PARAMETERS: p_name TYPE name1.
3  
1 **&&~~ Data Objects
4 DATA: gv_fm_name TYPE rs38l_fnam, " FM Name
1 gs_fp_docparams TYPE sfpdocparams,
5 gs_fp_outputparams TYPE sfpoutputparams.
1  
6 CONSTANTS : gv_form_name TYPE fpname VALUE 'YRAM_ADOBE_FORM3'.
1  
7 *=======================================================
1 ===============*
8 * START of Calling the Form
1 *=======================================================
9 ===============*
2 *&---------------------------------------------------------------------*
0 **&&~~ Form Processing: Call Form - Open
2 *
1 CALL FUNCTION 'FP_JOB_OPEN'
2 CHANGING
2 ie_outputparams = gs_fp_outputparams
2 EXCEPTIONS
3 cancel = 1
2 usage_error = 2
4 system_error = 3
2 internal_error = 4
5 OTHERS = 5.
2 IF sy-subrc <> 0.
6 " Suitable Error Handling
2 ENDIF.
7 *&---------------------------------------------------------------------*
2 **&&~~ Get the Function module name based on Form Name
8 *
2 CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
9 EXPORTING
3 i_name = gv_form_name
0 IMPORTING
3 e_funcname = gv_fm_name.
1 IF sy-subrc <> 0.
3 " Suitable Error Handling
2 ENDIF.
3 *&---------------------------------------------------------------------*
3 **&&~~ Take the FM name by execuing the form - by using Pattern-
3 **&&~~ call that FM and replace the FM Name by gv_fm_name
4 **&&~~ Call the Generated FM
3 CALL FUNCTION gv_fm_name "'/1BCDWB/SM00000176'
5 EXPORTING
3 /1bcdwb/docparams = gs_fp_docparams
6 name = p_name
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  
4 *&---------------------------------------------------------------------*
2 *&---- Close the spool job
4 CALL FUNCTION 'FP_JOB_CLOSE'
3 EXCEPTIONS
4 usage_error = 1
4 system_error = 2
4 internal_error = 3
5 OTHERS = 4.
4 IF sy-subrc <> 0.
6 * <error handling>
4 ENDIF.
7
4
8
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

This post might look simple but believe us, if there is no one to guide you in
your team, even finding the Floating Field option in Adobe might kill some
time. Forget about how to format the date and time as per the end user’s
preference. Someone has to tell you for the first time and then you do it by
your own.

As we keep saying, we cannot learn to swim unless we wade through the


water. So try practicing the exercises in your system and I am sure you will
have no issue. This should not take more that 7 minutes of your day. If any
issue just shoot an email to mailsapyard@gmail.com or leave your
questions in the comment section and you will definitely have a quick
response.

Next Part IV: How to Hide and Display Fields using Javascript in SAP Adobe
Form
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.

Thank you very much for your time!!

https://sapyard.com/sap-adobe-form-tutorial-part-xi-configuring-adobe-forms-in-nace-opk8-and-
spro/

Das könnte Ihnen auch gefallen