Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
rakesh_m2
Contributor
4,939

Hi All,

Just wanted to share a requirement which I recently worked on using different master pages and then need to use different master pages dynamically, based on some conditions.  But we cannot generally hide a master page, so taught of so many ways and finally came up with this idea. Here is the step by step procedure, which I followed to achieve this

  1. Create a variable (which triggers master page) in interface

  2. Create a table with one field in it, in Code initialization part of interface

3. Then we need to create number of tables in global data section according to the number of master pages needed, i.e. If you have 2 master pages, then we need to create 2 tables.

4. Code Initialization: Place below logic
Populate it_vbap table // Some Data
wa_mast
-t1 = '1'.
IF trigger = 1. // If trigger is 1, then it triggers first master page, else second
APPEND wa_mast to it_master1.
ELSE.
APPEND wa_mast to it_master2.
ENDIF.

5. Now create a form using this interface

6. Design two master pages

7. Create a subform.  Set it properties as 'flowed'.  Bind it to one of the tables, say itab_master1.  Set maximum repetition to 1 and remove minimum(which will be set by default)

8. In pagination set the properties, such that it is on master page 1 (Page1 in our case)

9. Now copy first subform and paste again.  In second subform bind it to other internal table and in pagination set to page 2

10. Activate it and execute it. If trigger is '1', then it will trigger first master page

if trigger <> 1, then it triggers second master page.

Hope this helps.

1 Comment
Labels in this area