SAP TRM: How to prefill a table form when creating a tax return
SAP TRM customers sometimes have the requirement to prefill the content of a form bundle when creating a tax return in the Taxpayer Overview.
Event P320 is used for that purpose and changes form bundle data during form bundle creation.
The form bundle header data (collected from initial screen), the default forms, the empty form data (derived from customizing) is then available for further processing.
However there is no structure available in the interface of P320 to prefill a table form of the form bundle, with line items of the preceding period for instance.
Table forms are also not part of the BRFplus context and cannot be prefilled with activity 21.
To prefill a table form, it is important not to update table form data directly. Instead, the table form data must be accessed via the form data manager using methods from class cl_fmca_tf_form_data.
Step 1 – In transaction FQEVENTS, go to event P320 “TRM Form Processing: Derive Data from Initial Screen” and create an installation-specific function module
Caution: do not forget to add the coding of standard function module FMCA_EVENT_P320_BRFP so that content of other forms are also prefilled by BRFplus.
Step 2 – Prepare/Derive records to prefill the table form in a local table e.g. LT_Z001_LINES of type ZDFMCA_TF_Z001_L (this is the transparent table for the line items assigned to the table form in customizing)
Key fields of table form line item table must also be provided:
ls_Z001_line-form_guid = ct_form_data[ 1 ]-case_guid. ls_Z001_line-data_version = '00001'. ls_Z001_line-line_no = lv_line_no. ls_Z001_line-ranking_order = '99'.
A similar approach is required to prepare the header data of the table form.
Step 3 – Prefill the table form (header and line items)
lr_formdata_mgr = cl_fmca_cockpit_formdata_mgr=>get_instance( ). IF lr_formdata_mgr IS BOUND. lr_formdata_tf ?= lr_formdata_mgr->do_read_cache( ct_form_data[ 1 ]-case_guid ). lr_formdata_tf->get_head_data_ui( IMPORTING es_head_data = ls_z001_header ). lr_formdata_tf->set_head_data( is_head_data = ls_output_header ). lr_formdata_tf->set_line_items( it_line_items = lt_output_lines ). ENDIF.
Remark: OSS note 1847620 must be implemented to avoid (re-)initialization of table form data