adding rows dynamically in a table using interactive adobe forms
TRANSCRIPT
-
7/30/2019 Adding Rows Dynamically in a Table Using Interactive Adobe Forms
1/5
Adding rows dynamically in a table using interactive Adobe Forms
By Phani Diwakar M, YASH Technologies
The requirement is to add the table rows dynamically in the table. This document is dealt withhow to create dynamic table in interactive form using offline scenario.
Step1: Go to SFP transaction and provide interface name.
Click on Create button and provide the meaningful description for the interface.
Step2: Now create import parameter ZMAT as shown below.
Save and activate the interface.
Step3: Now again go to transaction SFP to create form. Provide the form name.
Click on Create button. A popup will appear where provide the interface name and meaningfuldescription of the form.
-
7/30/2019 Adding Rows Dynamically in a Table Using Interactive Adobe Forms
2/5
Step4: Now drag the import parameter ZMAT to context as shown.
Step5: Now go to layout.
Drag the table ZMAT to body page.
Drag the button from library on to body page below the table as shown.
Step6: Now go to Hierarchy tab,
Go to OBJECT palette of DATA and provide the min count is 3 (when we execute the form initially itshows 3 default rows) as shown below.
Step7: Now click on Insert Button.
-
7/30/2019 Adding Rows Dynamically in a Table Using Interactive Adobe Forms
3/5
In the script editor, write the following code which generates the rows dynamically at run time.
In script editor:
var anInstanceManager = data.Bodypage.ZMAT.DATA.instanceManager;
var newInstance = anInstanceManager.addInstance(1);
var aToIndex = data.Bodypage.ZMAT.DATA.index + 3; (Adds the rows from 4th
postion)
var aFromIndex = newInstance.index;
anInstanceManager.moveInstance(aFromIndex, aToIndex);
Save and activate the form.
Adding rows dynamically in a table using interactive Adobe Forms
...Previous
REPORT ZOFFLINE_MAT_01.
data:fs_venbank type zwd_mat,it_mat type zwd_t_mat,l_fm_name TYPE rs38l_fnam,l_formname TYPE fpname VALUE'ZOFFLINE_MAT_FORM',fp_docparams TYPE sfpdocparams,
FP_FORMOUTPUT TYPE FPFORMOUTPUT,fp_outputparams TYPE sfpoutputparams.
START-OF-SELECTION.PERFORM get_function_module.
*&---------------------------------------------------------------------* *& Form GET_FUNCTION_MODULE*&---------------------------------------------------------------------*
form GET_FUNCTION_MODULE .CALLFUNCTION'FP_FUNCTION_MODULE_NAME'
EXPORTINGi_name = l_formname
IMPORTINGe_funcname = l_fm_name.
* E_INTERFACE_TYPE =
http://saptechnical.com/Tutorials/AdobeForms/Dynamic/Index.htmhttp://saptechnical.com/Tutorials/AdobeForms/Dynamic/Index.htmhttp://saptechnical.com/Tutorials/AdobeForms/Dynamic/Index.htmhttp://saptechnical.com/Tutorials/AdobeForms/Dynamic/Index.htm -
7/30/2019 Adding Rows Dynamically in a Table Using Interactive Adobe Forms
4/5
* fp_outputparams-nodialog = 'X'.* fp_outputparams-getpdf = 'X'.
CALLFUNCTION'FP_JOB_OPEN'CHANGING
ie_outputparams = fp_outputparamsEXCEPTIONS
cancel = 1usage_error = 2system_error = 3internal_error = 4OTHERS = 5.
IF sy-subrc 0.CASE sy-subrc.
WHENOTHERS.ENDCASE. " CASE sy-subrc
ENDIF.
fp_docparams-langu = 'X'.fp_docparams-country = 'US'.fp_docparams-fillable = 'X'.
fp_docparams-dynamic = 'X'.
CALLFUNCTION l_fm_nameEXPORTING
/1bcdwb/docparams = fp_docparamszmat = it_mat
IMPORTING
/1BCDWB/FORMOUTPUT = FP_FORMOUTPUTEXCEPTIONS
usage_error = 1system_error = 2internal_error = 3OTHERS = 4.
IF sy-subrc 0.CASE sy-subrc.
WHENOTHERS.ENDCASE. " CASE sy-subrc
ENDIF. " IF sy-subrc 0
CALLFUNCTION'FP_JOB_CLOSE'
* IMPORTING* E_RESULT = result
EXCEPTIONSusage_error = 1system_error = 2internal_error = 3OTHERS = 4
.IF sy-subrc 0.
CASE sy-subrc.WHENOTHERS.
ENDCASE. " CASE sy-subrcENDIF. " IF sy-subrc 0.
endform. " GET_FUNCTION_MODULE
-
7/30/2019 Adding Rows Dynamically in a Table Using Interactive Adobe Forms
5/5
Note:To add the rows dynamically in the form, we have to pass the value X toparameterDYNAMIC of the structure/1BCDWB/DOCPARAMS.
Output: execute the program
Now when you click on button Insert, a new row will be added after 3 rows.