Show TOC

Example: Creating a Generation StyleLocate this document in the navigation structure

Use

With the example below, you create the new generation style ZMYGENMOBILE with the class CL_ITS_GENERATE_HTML_MOBILE as a template for the generator. You then use this new style instead of the default generation style Mobile Devices to address your own generator when creating templates.

Step 1: Derive Your Own Class from CL_ITS_GENERATE_HTML_MOBILE

  1. Call transaction SE80 and select Class/Interface from the drop-down list.

  2. In the input field, enter the name of the class that you want to create (such as ZCL_MY_HTML_MOBILESTYLE), and press enter.

  3. Choose Yes to the prompt "Do you want to create a new class?".

    The dialog box for creating the class appears.

  4. Now choose the Create Inheritance icon next to the Class field, and enter CL_ITS_GENERATE_HTML_MOBILE as the superclass in the field that appears.

  5. Enter a description for the class.

  6. Then select the instantiation PUBLIC and the class type Usual ABAP Class.

  7. Save your entries.

Step 2: Create a Constructor

  1. Navigate from your class ZCL_MY_HTML_MOBILESTYLE to the superclass CL_ITS_GENERATE_HTML_MOBILE Methods.

  2. Double-click the Constructor method and copy the source code of the constructor.

  3. Return to your class by double-clicking the appropriate name in the tree, switch to change mode, and choose Start of the navigation path Edit Next navigation step Create Constructor End of the navigation path.

  4. In the table on the right, double-click the Constructor method, insert the copied source code in your constructor definition, and change the template_service to ZMYGENMOBILE.

    After these changes, your constructor should look something like this:

                  
    METHOD constructor. super->constructor( ). _template_service = 'ZMYGENMOBILE'. _template_theme = '99'. ENDMETHOD.
                      
  5. Save your entries.

Step 3: Overwrite Generation Style

  1. From your class ZCL_MY_HTML_MOBILESTYLE, navigate to the interface IF_ITS_GENERATE_TEMPLATE by choosing Start of the navigation path Methods Next navigation step Inherited Methods End of the navigation path.

  2. Select the method DESCRIPTION_TEXT, copy its content, right-click and choose Redefine from the context menu.

    A Redefinition folder appears lower in the tree.

  3. In the Redefinition folder, double-click the IF_ITS_GENERATE_TEMPLATE~DESCRIPTION_TEXT entry, and insert the original content into the definition from the clipboard.

  4. Change the WHEN-MOBILE branch appropriately.

    You will add the key word ZMYMOBILE to the table W3GENSTYLES later.

    After these changes, the method should look something like this:

                  
    METHOD if_its_generate_template~description_text. CASE pi_style. WHEN 'ZMYMOBILE'. pe_description = 'Mein Mobile HTML Generator'(001). WHEN OTHERS. pe_description = 'Unbekannter Stil'(002). ENDCASE. ENDMETHOD.
                      
  5. Check your changes and activate the changed class.

Step 4: Create a Service and Copy the Original Templates

  1. In the Object Navigator (transaction SE80), select the Internet service ITSGENMOBILE.

  2. Select the service and choose Copy from the context menu.

  3. Enter your service ZMYGENMOBILE as the target service, select all options, and save your entries.

  4. Switch to your service ZMYGENMOBILE and publish the entire service to the Internal site.

Step 5: Enter a New Generation Style

  1. Switch to transaction SE16.

  2. Enter W3GENSTYLES as the table name and choose Start of the navigation path Table Next navigation step Create Entries End of the navigation path.

  3. Specify ZMYMOBILE as the style (see the query in step 3: WHEN 'ZMYMOBILE').

  4. Enter your class ZCL_MY_HTML_MOBILESTYLE as the generation class.

    You can enter any description you want.

  5. Save your entries.

Step 6: Test the New Generation Style

  1. Call transaction SE80 and switch to your application.

  2. Select a screen and choose Create Template from the context menu (if necessary, through More Functions).

  3. Specify an Internet service for an application, such as ZMYAPPLICATION, and for the generation style, select your newly-generated style, for example My Mobile HTML Generator.

  4. Choose Save to start the generation of the template with your generator.

  5. If the first generation was successful, you can start to modify the templates in the generation service ZMYGENMOBILE and therefore to adjust the generation of the templates to your requirements.

    Note

    Note that your changes to the templates only become active when you publish the changed generation templates. Note also that the generator replaces the "GEN_" variables in the templates during generation.

Result

You have created your own generation style with the class CL_ITS_GENERATE_HTML_MOBILE as a template for your generator. You then use this new style instead of the default generation style Mobile Devices to address your own generator when creating templates.