The common problem while using the template for address or header information is that when the data is not available for that particular column the line appears blank. This problem can be avoided as seen in SAP SCRIPTS by using SCRIPT CONTROL COMMAND <IF>…<END IF>.Unfortunately the same cannot be done while designing TEMPLATES in SMART FORMS.
One way to avoid this is by using TABLES without data option i.e. by UN-checking the Internal table option as shown below in the screenshot.
By doing so our table becomes and behaves like a dynamic template.
Steps to Design Dynamic Template.
Step-1. Create a sample smart form & add the interface fields as shown below.
Step-2. Create a secondary window to place your dynamic template as shown below.
Step-3. Create LINE TYPES with required columns to be displayed. Shown below is the dynamic template created for testing.
Step-4. Provide conditions in Conditions Tab as shown below.
Step-5 Wrap the fields and map the corresponding values to line types.
Execute the SMART FORM after mapping. The interface values are passed as shown below.
TEST-1. Passing all values to the interface parameters and then execute.
Test-2. Passing empty values to the interface parameter LINE3_DATA and then execute.
Output :- As you can see in the Dynamic template the LINE3_DATA value was empty. As per the condition provided the Line type has not appeared and the space has been automatically adjusted WHEREAS in Static template the line appears even when no data is passed.
Please find the attached sample program for better understanding.