SAP Adobe Interactive Form Tutorial - Parte 4
SAP Adobe Interactive Form Tutorial - Parte 4
SAP Adobe Interactive Form Tutorial - Parte 4
Share on Facebook
Tweet on Twitter
1
2 IF v_regular_employee = abap_true.
3 v_time_sign = 'GMT - 6'.
4 ELSEIF v_regular_employee = abap_false.
5 v_time_sign = 'GMT - 7'.
6 ENDIF.
coding.
PS: There might be many ways to achieve the above scenario. We have
kept it simple for the sake of clarity.
I think, we have provided enough teaser for our today’s tutorial. Let’s
watch the full movie now.
We assume that you have been following our series step by step. That is
the reason we have specified the Part number in each tutorial title so that
you can study and learn systematically, part by part. If you are a novice in
the field of Adobe forms and you have not checked our earlier series, we
would suggest you pause here. Go back to our earlier tutorials and refresh
your Adobe skills. At least know the t-codes and Form, Interface, Context
and Driver program concepts.
But, if you already now those concepts or you are really interested to know
about hiding/displaying fields dynamically, please go ahead with this
Enter the Interface name and Create (Interface is mandatory for Adobe
form).
Enter the short description and Save.
Drag IV_NAME and IV_FLAG from Interface which we created earlier and
drop them to the Context area.
Go to Layout
Go to Data View and Drag and drop the field IV_NAME.
Go to Show option and select form: ready from the drop down list.
Here you will get a chance to write Javascript or Form Calc Code.
1
2 if($record.IV_FLAG.value != "X")
3 {
4 this.presence = "hidden";
5 }
Check, Save and Activate.
Since the script to hide the elements did not get triggered as we passed
IV_FLAG = X. Therefore the elements are not hidden in the output.
Press F8. Press on Print Preview button. This time the Javascript code gets
triggered to hide the element. So the Output is a blank page this time.
You can call the above Form from driver program and get the same output.
Please check the below-working code.
Output would be same as stand alone test, depending on what you pass on
the selection screen . So thought of not consuming more memory of this
page.
Try this short hands on Adobe Form and Driver program in your system and
have fun.
1
2 *&---------------------------------------------------------------------*
3 *=======================================================
4 ===============*
5 * YRAM_ADOBE_FORM_PROGRAM4 *
6 *=======================================================
7 ===============*
8 * Project : SAP Adobe Forms Tutorial *
9 * Author : Ramanjula Naidu DARURU (www.SAPYard.com) *
1 * Description : Dynamically Hiding & Displaying a field on the Adobe Form
0 * Layout based on Condition *
1 *=======================================================
1 ===============*
1 REPORT yram_adobe_form_program4.
2
1 *=======================================================
3 ===============*
1 * Selection Screen
4 *=======================================================
1 ===============*
5 PARAMETERS: p_name TYPE name1,
1 p_flag TYPE char1.
6
1 **&&~~ Data Objects
7 DATA: gv_fm_name TYPE rs38l_fnam, " FM Name
1 gs_fp_docparams TYPE sfpdocparams,
8 gs_fp_outputparams TYPE sfpoutputparams.
1
9 CONSTANTS : gv_form_name TYPE fpname VALUE 'YRAM_ADOBE_FORM4'.
2
0 *=======================================================
2 ===============*
1 * START of Calling the Form
2 *=======================================================
2 ===============*
2 *&---------------------------------------------------------------------*
3 **&&~~ Form Processing: Call Form - Open
2 *
4 CALL FUNCTION 'FP_JOB_OPEN'
2 CHANGING
5 ie_outputparams = gs_fp_outputparams
2 EXCEPTIONS
6 cancel = 1
2 usage_error = 2
7 system_error = 3
2 internal_error = 4
8 OTHERS = 5.
2 IF sy-subrc <> 0.
9 " Suitable Error Handling
3 ENDIF.
0 *&---------------------------------------------------------------------*
3 **&&~~ Get the Function module name based on Form Name
1 *
3 CALL FUNCTION 'FP_FUNCTION_MODULE_NAME'
2 EXPORTING
3 i_name = gv_form_name
3 IMPORTING
3 e_funcname = gv_fm_name.
4 IF sy-subrc <> 0.
3 " Suitable Error Handling
5 ENDIF.
3 *&---------------------------------------------------------------------*
6 **&&~~ Take the FM name by execuing the form - by using Pattern-
3 **&&~~ call that FM and replace the FM Name by gv_fm_name
7 **&&~~ Call the Generated FM
3 CALL FUNCTION gv_fm_name
8 EXPORTING
3 /1bcdwb/docparams = gs_fp_docparams
9 iv_name = p_name
4 iv_flag = p_flag
0 EXCEPTIONS
4 usage_error = 1
1 system_error = 2
4 internal_error = 3
2 OTHERS = 4.
4 IF sy-subrc <> 0.
3 * Implement suitable error handling here
4 ENDIF.
4 *&---------------------------------------------------------------------*
4
5 *&---------------------------------------------------------------------*
4 *&---- Close the spool job
6 CALL FUNCTION 'FP_JOB_CLOSE'
4 EXCEPTIONS
7 usage_error = 1
4 system_error = 2
8 internal_error = 3
4 OTHERS = 4.
9 IF sy-subrc <> 0.
5 * <error handling>
0 ENDIF.
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
I am sure, you would need this trick in your kitty for every Adobe Form
project. Let your client ask for any exceptions, you are not scared any
more. You know how to handle it. Afterall Programmers are the Wizzards.