Skip to Content
Technical Articles
Author's profile photo Andre Fischer

New version of RAP Generator available

Last weekend I published an update to my openSource project RAP Generator.

The updated version is available at GitHub

https://github.com/SAP-samples/cloud-abap-rap

I have refurbished the UI (still using the Fiori Elements preview) but using more field groups to allow for a more easy navigation.

Open%20RAP%20generator

Open RAP generator

The new version comes with a new UI which let you enter the basic project data upfront, such as the type of the datasource being used (table, cds_view or abstract_entity), the implementation type (managed or unmanaged), the binding type and whether the project shall be draft enabled or not.

In addition you have to provide the name of the data source that is used by the root entity, the name of the package where the repository objects shall be generated and the name of the root entity.

By providing this information upfront the generator is able to determine the abap language version of the datasource and the key layout (uuid or semantic key) so that all this information can be set upfront.Open%20RAP%20Generator

Open RAP Generator

 

The only thing that is then left to do on header level is to provide (optionally) a suffix or a prefix that will be added to the repository object names that are suggested by the RAP generator.

You can then continue to maintain the details of the root entity such as the mapping of those field names to their role in the RAP business objects that the generator was not able to determine automatically.

proposed repository object names and field names

When adding a child node you are asked for the entity name and the name of the datasource so that again determinations can run before you start editing the entity details.

A new feature is also that you are now able to maintain the field names of the entities that are suggested by the generator.

In various customer events I learned that the generator is used by several customers and partners, more than I have been aware about so far.

Feedback is as always welcome and if you don’t mind to share with me that you are using this tool, that would be great as well.

Kind regards,

Andre

 

 

Assigned Tags

      25 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Florian Henninger
      Florian Henninger

      Now, that I can use an 2021 I will have a look at it and looking forward to some great discussions.

      Great work Andre

      Author's profile photo Stephan Heinberg
      Stephan Heinberg

      Thanks, André!

      Will this become "ABAP Platform" Standard or will the “ABAP Platform” Version stay with the ADT UI.

      Best regards,

      Stephan

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      This will not become standard and ABAP Platform will stay with ADT UI!

      This project is meant as a front runner tool and I am working on how these features can be incorporated into the standard ADT based offering.

       

      Author's profile photo Shavneet Singh
      Shavneet Singh

      Hello Andre Fischer :

      White i was traying to pull the changes in an online mode , as explained in the github link , it did not worked and many objects did not got pulled in.

      Is it mandatory that we have to create the package name as zdmo_rap_generator ?? , if not then how does it works.

      Its also written for 2021 s/4 hana on premise release :

      1. Create a package 'TEST_RAP_GENERATOR'.

      This also did not worked with many syntax errors.

       

      We are in S/4 hana Onpremise release . Would you please help in getting this in our system. Basically is there any restriction on package name ? , because all other objects starts with ZDMO in RAP generator.

      Also we had package with names zdmo_rap_generator and zdmo_rap_generator01 , should i delete these packages , they were created 6 months back , so now i want to configure the update on.

      Your help here is appreciated.

       

      Regards ,

      Shavneet Singh

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      Hi Shavneet,

      there is no restriction with regards to the name of the package. The package name has either to start with a "Z" or with "TEST_".

      I personally prefer "TEST_" since there are no transport requests created in this case.

      In the repo I have not stored the package definition so you should be fine to import it into any package in the customer namespace.

      Maybe it is a good idea to start from scratch and to remove all objects that belong to an older version of the generator (that start with ZDMO*).

      Kind regards,

      Andre

       

       

      Author's profile photo Shavneet Singh
      Shavneet Singh

      Thanks for the reply Andre.

      I did removed all objects from the package, and started refresh . We are on the On-premise release 2021. We ended up with a lots of syntax Errorssyntax%20error%20in%20RAP%20generator\.

      syntax error in RAP generator

      Attached is the screenshot.

      Kindly help , as this open source RAP generator is of the upmost importance for our project . WE are building everything on RAP. Looks like the updated version of RAP generator is not working on lower release.

      What other approach i should follow ?

       

      Thanks and Best regards ,

      Shavneet Singh

       

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      Hi Shavneet,

      thanks for pointing me to this issue.

      I have now removed the interface views

      ZDMO_I_RAPG_FieldTP, ZDMO_I_RAPG_LogTP, ZDMO_I_RAPG_NodeTP and ZDMO_I_RAPG_ProjectTP

      from the repository since they have not been used so far.

      In addition I have then changed the abstract entities ZDMO_I_RAP_GEN_PARAM_ADD_NODE, ZDMO_I_RAP_GEN_PARAM_ADD_NODEA, ZDMO_I_RAP_GEN_PARAM_ADD_NODEC and ZDMO_I_RAP_GEN_PARAM_NEW_PROJ and removed a UI annotation that is not supported on 2021.

      Finally I changed the setup class

      zdmo_cl_rap_generator_setup

      that you have to run after having imported the repository such that it again creates a V2 service binding instead of a V4 binding.

      Please note there one small issue left. After you have added a new node using the actions

      you will get an error message: "The requested data was not found"


      Simply navigate back with the back button of your browser

      and you will see the added entity.

      I plan to work on this UI hickup but since it's not a showstopper I hope you will now be able to continue your work.

      Kind regards,

      Andre

       

       

       

       

      Author's profile photo Shavneet Singh
      Shavneet Singh

      Hello Andre ,

      Thank you for updating the repository.

      All the issues are resolved , mass activation worked. Updated version of RAP generator was  configured with V2 binding , tested with a small application , worked perfectly as before .

      Also tested delete repository objects , worked as expected , will play around more with the update version , and will be giving feedback if any.

       

      Thanks again ,

       

      Regards ,

      Shavneet

      Author's profile photo Vincent Desrochers
      Vincent Desrochers

      Thanks, André! After that great hands-on session @SAPTechEd2023 looking forward to try this new version of the RAP generator!

       

      Vincent

      Author's profile photo Dominik Bassing
      Dominik Bassing

      Hello Andre Fischer

      first of all thank you very much for your work and the posts you do!

      We would like to use your generator for some of our projects, but unfortunately the generator is not possible to install on our system (S/4HANA 2021 FPS1)

      On Pulling the repo we get the following errors (tried both online/offline):

      Thanks in advance for your reply!

       

      Best regards

      Dominik

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      I just updated the GitHub repository and removed the interface views that cause the above mentioned error messages .

      Can you please check again?

      cloud-abap-rap/src at on-prem-2021 · SAP-samples/cloud-abap-rap (github.com)

      Author's profile photo Shavneet Singh
      Shavneet Singh

      Hello Andre ,

      I am using RAP generator again , and this is the first time i am trying to create all the boiler plate coding using a CDS view (Previously i had only use DB). I am using a standard SAP CDS view '

      R_RequestForQuotationTP......... Request for quotation.

      While generating i am getting this pop up message.

      Space found , attached is the screen shot. I also found that under the repository  section , few mandatory fields dont get filled automatically , so i filled those.

      Still i am getting the same error.

      Could you please , help and check.

      Regards ,

      Shavneet Singh

       

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      Hi Shavneet,

      I checked with the latest version of my generator in a 2022 system.

      I was able to generate a BO, there are however some error message that required me to fix the generated code manually using ADT.

      So I have to analyze what I need to fix in my generator but you should be able to generate code and go throught the steps shown below to get a working sample.

      Check also the json file below that show what I have entered.

      After having performed the fixes shown below I was able to manually activate all objects and to test the preview. Do not forget to activate all objects (including behavior implementation class) because if you forget the latter you will get a dump.

      I had to uncommend the field FOLLOWONDOCUMENTTYPE in the R_ view and thus also in the C-view, I-View and metadata extension

        FollowOnDocumentCategory as FollowOnDocumentCategory,
      //  FOLLOWONDOCUMENTTYPE as PurgDocFollowOnDocumentType,
        PurContrValidityStartDate as PurContrValidityStartDate,
        PurContrValidityEndDate as PurContrValidityEndDate,
        PurchasingDocumentDeletionCode as PurchasingDocumentDeletionCode,
        IsEndOfPurposeBlocked as IsEndOfPurposeBlocked,
        _RequestForQuotationItem
        
      }
      

       

      In the C- and I-View I had to uncomment a "comma" that my generator has added at the end .

       

        FollowOnDocumentCategory,
      //  PurgDocFollowOnDocumentType,
        PurContrValidityStartDate,
        PurContrValidityEndDate,
        PurchasingDocumentDeletionCode,
        IsEndOfPurposeBlocked
      //  ,
        
        
      }

       

       

       

       

      The json looked like this

      {
      "namespace":"Z",
      "package":"TEST_CDS_02",
      "dataSourceType":"cds_view",
      "bindingType":"odata_v2_ui",
      "implementationType":"unmanaged_semantic",
      "prefix":"",
      "suffix":"_01",
      "draftEnabled":false,
      "multiInlineEdit":false,
      "isCustomizingTable":false,
      "addBusinessConfigurationRegistration":false,
      "transportRequest":"",
      "hierarchy":
      {
       "entityname":"Test",
       "dataSource":"R_REQUESTFORQUOTATIONTP",
       "objectid":"REQUESTFORQUOTATION",
       "uuid":"",
       "parentUUID":"",
       "rootUUID":"",
       "etagMaster":"LASTCHANGEDATETIME",
       "totalEtag":"",
       "lastChangedAt":"",
       "lastChangedBy":"",
       "localInstanceLastChangedAt":"",
       "createdAt":"",
       "createdBy":"",
       "draftTable":"",
       "cdsInterfaceView":"ZI_TestTP_01",
       "cdsRestrictedReuseView":"ZR_Test01TP_01",
       "cdsProjectionView":"ZC_Test01TP_01",
       "metadataExtensionView":"ZC_Test01TP_01",
       "behaviorImplementationClass":"ZBP_R_Test01TP_01",
       "serviceDefinition":"ZUI_Test01_01",
       "serviceBinding":"ZUI_Test01_O2_01",
       "controlStructure":"ZSTest_X_01",
       "customQueryImplementationClass":"",
       "mapping":
       [
        {
         "dbtable_field":"REQUESTFORQUOTATION",
         "cds_view_field":"RequestForQuotation"
        },
        {
      
      Author's profile photo Shavneet Singh
      Shavneet Singh

      Hello Andre ,

      Below are my results , when i am trying to the same in 2021 system.

      as it is a CDS entity , so i choose unmanaged , draft.

       

      Regards ,

      Shavneet

      Author's profile photo Shavneet Singh
      Shavneet Singh

      Hello Andre ,

      Made it Non draft , and it worked .

      REgards ,

      Shavneet

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      Glad to hear that.
      I have to check why draft does not work yet.
      But you maybe able to add draft manually now by changing the BDEF accordingly

      Author's profile photo Shavneet Singh
      Shavneet Singh

      Yes , i thought of similar idea .

      Now i was trying to add two childs also  ,

      R_RequestForQuotationItemTP and

      R_RequestForQuotationBidderTP

      And i ended up with a another pop up error message.

      Just trying out our complete scenario , any help on this ?

      Regards ,

      Shavneet

      Shavneet Singh

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      Hi Shavneet,

      I have published a fixed version of the RAP Generator. I just tested the on-prem-2021 branch. It successfully generated an app with the 3 cds views you mentioned.

      R_REQUESTFORQUOTATIONTP as datasource for the root node

      R_REQUESTFORQUOTATIONITEMTP and R_REQUESTFORQUOTATIONBIDDERTP as datasources for the two child nodes.

      What you have to do manually however is to use the quick fix in the behavior defintion to generate the method

      get_instance_authorizations

      in the behavior implementation class since this method cannot be generated in 2021.

      Otherwise you will get a dump with the following error message.

      Handler not implemented; Method: INSTANCE_AUTHORIZATION, Involved Entities: ZC_ROOTNODETP

      --> Please use issues in GitHub for further error messages and maybe just point to these here in the comment section.

      These are excerpts of the generated code of the generated R_-views:

      define root view entity ZR_ROOTNODETP

      as select from R_REQUESTFORQUOTATIONTP

      composition [0..*] of ZR_ItemNode01TP as _ItemNode

      composition [0..*] of ZR_ItemNode2TP as _ItemNode2

      ....

      define view entity ZR_ITEMNODE01TP

      as select from R_REQUESTFORQUOTATIONITEMTP

      association to parent ZR_RootNodeTP as _RootNode on $projection.RequestForQuotation = _RootNode.RequestForQuotation

      ....

      define view entity ZR_ITEMNODE2TP

      as select from R_REQUESTFORQUOTATIONBIDDERTP

      association to parent ZR_RootNodeTP as _RootNode on $projection.RequestForQuotation = _RootNode.RequestForQuotation

       

       

      Author's profile photo Dominik Bassing
      Dominik Bassing

      Hi,

       we stuck in another error now (2021 on-prem):

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      Try to perform a mass activation.

      As the error message tells you the underlying service definition could not be activated.

      Author's profile photo Arunkumar Subramanian
      Arunkumar Subramanian

      Dear Andre Fischer ,

      First of all thanks for the great work which helps the developer to reduce the effort and start working on the business logic.

      I have a question. I tried using the demo application in BTP and it worked fine. But if I have to enhance with additional entities later on how does this generator support? Once I have generated repository objects I cannot edit the entities anymore. I have a scenario to add further entities later on. Should that be done only manually or is there something I am missing here?

      Author's profile photo Andre Fischer
      Andre Fischer
      Blog Post Author

      After generation you are not able to edit additional entities because the generator does not support this.

      However there is a "Copy Project" button. This allows you to copy the project and to add additional entities to the copied project.

      In addtion it would be possible to delete the repository objects of the first project so that you will be able to generate objects with the same name again.

      The generator will otherwise suggest names that are different to gurantee uniqueness.

      Kind regards,

      Andre

       

      Author's profile photo Arunkumar Subramanian
      Arunkumar Subramanian

      Thanks for your answer. That really helps. It would be good to see in future something like BOPF framework providing easy options to create, delete or modify nodes any point of time in the development even after having a version in production available. With this the data model can keep growing and the developer need not worry about the development efforts. It is just a wish. I do not know if this would be a roadmap for this generator.

      Author's profile photo Pradeep Sankaranarayanan
      Pradeep Sankaranarayanan

      Hi Andre Fischer,

      I used the RAP generator app for both the on-prem 2021 and on-prem 2022 branches V4 services, for both when generating the repository objects only the draft table is getting generated , no other artifact is getting generated. Not sure if i am missing something here.

      Below is the App Logs i am getting , not sure why BDEF is checked in the process as its supposed to be newly created

      Thanks.

      Pradeep

      Author's profile photo Matthias Wagenbreth
      Matthias Wagenbreth

      Hi Andre,

      I just installed the latest version of the RAP generator and facing severe issues: After filling in all the required information (Data source type, implementation type, etc.) the application stucks:

      This screen remains endless. When refreshing the browser (after waiting very long) there is a new project:

       

       

      It is in draft status and it is unnamed. There is no possibility to access it. When clicking on it, it does not open. Refreshing the browser, restarting the application does not help.

      What is the problem causing this issue?

      Best regards,
      Matthias