Skip to Content
Technical Articles

How to use the RAP Generator

In this blog I would like to provide a short click-trough so that you know how to generate a RAP BO using the RAP Generator.

This is the short version

  • Log on to a trial system
  • Create a package (e.g. ZRAP_####)
  • Add the package ZRAP_GENERATOR to your Favorite Packages.
  • Duplicate the class ZCL_RAP_GENERATOR and create your own class ZCL_RAP_GENERATOR_#### in your package
  • Replace the string <enter your json string here> with the json code you find in the GitHub repository json_managed_uuid_table_demo
  • Replace the hash tags in the following parameters in the JSON file so that they fit your needs
    • suffix
    • package
  • Run your class using F9
  • Check content of your package

Prerequisites

Be sure to have set the preferences in the ABAP Editor as described in my blog

How to wrap long strings automatically in ADT

so that the JSON file will be wrapped and escaped when being copied into the code of your class in ADT.

ABAP%20Editor%20preferences

ABAP Editor preferences

 

This is the click through

  1. Right click on the folder Favorite Packages and choose Add Package from the context menu.

 

  • Search for the package ZRAP_GENERATOR

  • Expand the folder Source Code Library and then Classes and right-click on ZCL_RAP_GENERATOR and choose Duplicate.
  • Enter the name of your package (e.g. ZRAP_0042) and change the name by adding a suffix (e.g. ZCL_RAP_GENERATOR_0042).
  • Select a transport request
  • Select a json template from the GitHub repositoryThe simplest one is this one that simply uses two tables ZRAP_TRAVEL_DEMO and ZRAP_BOOK_DEMO with UUID based keys that are provided in the package ZRAP_GENERATOR.

    https://github.com/SAP-samples/cloud-abap-rap/blob/master/json_templates/json_managed_uuid_table_demo.txt 

 

  • In the editor of your choice replace the values for following parameters to your needs
    • suffix
    • package

    • Copy the content of the JSON file in your class and replace the string
      <enter your JSON string here>.
    • When you have set the preferences for your ABAP editor in ADT as described in my blogthe result will look like follows:
    • Press F9 to start the console application
    • And check the content of your console tab

 

  • and then the content of your package

 

Editor Preferences

Window –> Preferences

Be the first to leave a comment
You must be Logged on to comment or reply to a post.