Giter Site home page Giter Site logo

sap-samples / cloud-abap-rap Goto Github PK

View Code? Open in Web Editor NEW
207.0 34.0 59.0 3.83 MB

This repository contains several examples how to develop with the ABAP RESTful Application Programming Model (RAP) in SAP BTP, ABAP environment.

License: Apache License 2.0

sample sample-code abap abap-environment abap-restful rap odata sap-btp sap-btp-abap

cloud-abap-rap's Introduction

REUSE status

Description

The basic idea behind the RAP Generator is to ease the life of the developer since it helps you to create most of the boiler plate coding that is needed to implement a RAP business object using the ABAP RESTful Application Programming Model (RAP) so that you as a developer can start more quickly to implement the business logic.
As of SAP S/4HANA 2022 and in the ABAP environements of SAP S/4HANA Cloud and SAP BTP ABAP Environment there is also an ADT-based generator available which currently only supports one table but will be optimized in future releases.

RAP generates RAP
Technically the RAP Generator consists out of a RAP business object ZDMO_R_RAPG_ProjectTP that is used to generate other RAP business objects.
The RAP Generator works similar like the well known Key user tools in SAP S/4HANA and uses a Fiori Elements UI. The Fiori Elements UI can be started from within ADT by opening the service binding ZDMO_UI_RAPG_PROJECT_O2. There you have to double-click on the entitiy Project which starts the Fiori Elements UI without the need to install any additional tool.

The SAP Fiori elements preview based UI provides value helps for the data that has to be entered and it provides validations and determinations that provide the heavy lifting of specifying which table field is used for which purpose (for example, a field called local_last_changed_at or a field based on the data element abp_locinst_lastchange_tstmpl will be proposed by the RAP Generator to be used as the etag of an entity).

Once the repository objects are generated, the UI offers an ADT link that lets you conveniently navigate back into ADT to continue to work on your objects.

What's New

  • The RAP Generator allows to generate a basic I-view layer beneath the R-view layer as being used in SAP S/4HANA
  • The generation and deletion process now leverages the background processing framework (BGPF)
  • You can now generate extensible RAP business objects
    • The generator generates the required additional repository objects (include structure, extension include view, ...)
    • The generator performs the required C0- and C1-release state
  • The generator creates SAP object types and SAP object node types

Requirements

This sample code does currently work in:

  • SAP BTP, ABAP environment
  • SAP S/4HANA, ABAP environment
  • SAP S/4HANA 2023
  • SAP S/4HANA 2022
  • SAP S/4HANA 2021

How to Guides

Download and Installation

How to Install the RAP Generator

SAP BTP ABAP Environment and SAP S/4HANA Cloud ABAP Environment

  1. Create a package 'ZDMO_RAP_GENERATOR'.
  2. Link this package with the URL of the RAP Generator repository https://github.com/SAP-samples/cloud-abap-rap.
  3. Use the branch abap-environment.
  4. Pull changes.
  5. Use mass activation to activate the objects that have been imported in step 3.
  6. Publish the service binding ZDMO_UI_RAPG_PROJECT_O2.

SAP S/4HANA 2021, 2022 or 2023

  1. Create a package 'TEST_RAP_GENERATOR'.
  2. Start the report ZABAPGIT_STANDALONE. You might have to download the source code of this open source tool.
  3. Create an an online repository with the package and with the URL of the RAP Generator repo https://github.com/SAP-samples/cloud-abap-rap or create an offline repository and download the source code as a ZIP file from https://github.com/SAP-samples/cloud-abap-rap. Make sure that you use the appropriate branch on-prem-2022, on-prem-2021 or on-prem-2023.
  4. Pull changes.
  5. Use mass activation to activate the objects that have been imported in step 3.
  6. Publish Service binding ZDMO_UI_RAPG_PROJECT_O2

Known Issues

The sample code is provided "as-is".

Known issues are listed here: Issues

SAP BTP ABAP Environment, SAP S/4HANA ABAP environment and on premise releases

...

on_premise_2021

  • When using the RAP Generator in on-premise systems, you have to make sure that the latest SAPUI5 libraries are installed. If you don’t have the latest version of the SAPUI5 libraries installed you will get no dialogue when choosing the New Project button in the RAP Generator. If the latest SAPUI5 libraries cannot be installed, you can use an implicit enhancement in method get_sapui5core_resources_url( ) of class CL_ADT_ODATAV4_FEAP as described in the following blog post.

How to Obtain Support

If you have problems or questions, you can post them in the SAP Community using either the primary tag or "ABAP RESTful Application Programming Model".

Contributing

You can add proposals for enhancements as issues.

License

Copyright (c) 2023 SAP SE or an SAP affiliate company. All rights reserved. This file is licensed under the Apache Software License, version 2.0 except as noted otherwise in the LICENSE file.

cloud-abap-rap's People

Contributors

anfisc avatar btbernard avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloud-abap-rap's Issues

Error following RAP generator installation, generator setup

Stuck on step 6. "Run the class zdmo_cl_rap_generator_setup. This class generates the following objects"

I get a message
image

Check the class texts - they appear missing
image

Tried re-pulling the repo a few times with no luck. Can you advise on the class texts I need for ZDMO_CL_RAP_GENERATOR_SETUP?

2021 on Premise Class Name mismatch?

Hello,

This generator was of great help in BTP ABAP environment. I am trying to use this for a 2021 on premise and noticed that one of the filenames references a different class.

I could get it to work after changing the name. ZDMO_CL_RAP_GEN_ENV_ON_PREM ===> zdmo_cl_rap_xco_on_prem_lib

image

Also noticed that 2021 did not support keyword "transactional_interface" in Proj view ZDMO_I_RAPG_ProjectTP .

image

This is an FYI post because fixing these made it work.

Error on importing objects on OnPrem 2020 FPS01

Hi @anfisc,
got following errors importing the objects from On-Premise-2020 branch with ababGit
System is S/4HANA On Premise 2020 FPS01:

Object Type not supported

image

Error on activating behavior definition

draft determine action Prepare
{
determination ( always ) createJSONString;
validation ( always ) check_json_string;
validation ( always ) mandatory_fields_check; }

image

Can i help you with more?

Property 'TimeStamp' has invalid value '20240427044960 '

Service Information

Service Namespace /SAP/
Service Name ZDMO_UI_RAPG_PROJECT_O2
Service Version 0001
Group ID
Service Repository
Destination

Error Context

–ERROR_CONTEXT
ERROR_INFO Property 'TimeStamp' has invalid value '20240427044960 '
–ERROR_RESOLUTION
SAP_NOTE See SAP Note 1797736 for error analysis
LINK_TO_SAP_NOTE https://service.sap.com/sap/support/notes/1797736
BATCH_SAP_NOTE See SAP Note 1869434 for details about working with $batch
LINK_TO_BATCH_SAP_NOTE https://service.sap.com/sap/support/notes/1869434

Syntax errors in zdmo_cl_fe_travel_generator

The class zdmo_cl_fe_travel_generator contains several 'typo' errors in the name of the following attribute:
mo_draft_tabl_put_operation

In several places, it is written as:
mo_draft_tabl_put_opertion
(without the letter 'a' instead of operAtion)

The problem is in all of the 3 branches:
abap-environment
on-prem-2021
on-prem-2022

Issues when using the option "customizing table"

  1. Changes in generated BDEF code needed

Since unmanaged save is used the BDEF need to use a central BIL.

So the generated code for the BIL has to be changed as follows:

managed implementation in class ZBP_R_Holiday_STP_01 unique;

When the project is generated one currently sees an error message in the BDEF

"Operations need to be implemented for the behavior definition, which means an implementation class needs to be specified."

  1. Behavior for using a customizing transport needs to be checked.

Hint:
In 2022 and SAP BTP ABAP Environment one can already use the new ADT based generator for customizing table UIs:

Create a SAP Fiori based Table Maintenance app with SAP BTP, ABAP Environment | Tutorials for SAP Developers.

2022 branch - Table is inactive

I'm trying to create a new project, in a package defined as "ABAP for Cloud Development" but it fails because it determines that the table is not active
image

The table is active, but XCO determines the table doesn't exist
image

This is because XCO is applying a filter to check if the table is released
image

While trying to preview the generated Travel v4 odata service an error appears on the browser

After generating the RAP artifacts in the eclipse ABAP cloud project and publishing ODATA V4/V2 services when you click the preview for Travel v4 odata service, the Fiori app preview is supposed to load but actually, the following error appears on the browser:

Application could not be started due to technical issues.Prop. 'DISTANCE' has unit amount conver. and EDM type 'Int32' without decimals

More information and possible ideas on how to fix in the following thread:
https://answers.sap.com/questions/13750416/sap-abap-cloud-trial.html

Unit Test run error

We receive unit Test errors from the ABAP UNIT RUNNER.

image

One of them is an exception from the xco lib

LTC_RAP_NODE GET_FIELDS_FROM_ABSTRACTENTITY Exception Error <CX_XCO_NEWS_EXCEPTION>

ENDTRY.

TRY.
    mo_cut->set_is_root_node(  ).
    mo_cut->set_implementation_type( zdmo_cl_rap_node=>implementation_type-unmanaged_semantic ).
    mo_cut->set_data_source_type( zdmo_cl_rap_node=>data_source_types-cds_view ).
    mo_cut->set_entity_name(  gc_root_entity_name ).
    mo_cut->set_object_id( CONV #( gc_abstract_entity_object_id ) ).
    mo_cut->set_field_name_etag_master( gc_abstract_entity_etag_master ).
    "ZDMO_agency
      **mo_cut->set_cds_view( CONV #( lv_view_name ) ).**
    mo_cut->get_fields( ).
    DATA(lt_fields) = mo_cut->lt_fields.
    "cl_abap_unit_assert=>fail( msg = 'Exception ZDMO_cx_rap_generator=>root_cause_exception not raised' ).
    cl_abap_unit_assert=>assert_not_initial(

METHOD if_xco_dtel_read_accessensure_existence.
IF if_xco_ad_read_access
exists( ) EQ abap_false.
RAISE EXCEPTION TYPE cx_xco_news_exception
MESSAGE e282(sxco) WITH ms_target-object_name.

ENDIF.

ro_me = me.

ENDMETHOD.

Message is:
Data element TRKORR does not exist for the provided read state and origin.
Test 'LTC_RAP_NODE->GET_FIELDS_FROM_ABSTRACTENTITY' in Main Program 'ZDMO_CL_RAP_NODE==============CP'

View in Question is
gc_abstract_entity_name TYPE string VALUE 'D_SELECTCUSTOMIZINGTRANSPTREQP ',

It seems that the data type TRKORR is not accessible through the library - maybe because feature toggle A4C_OLD_REPOSITORY_APIS has not status released

Kind regards,
Christian

Read me file: Link Correction

Hi Andre, thanks for your amazing rap generator. I noticed a little mistake. These links not work,

Not work:
"And for on premise systems you have to use the appropriate branch on-premise-2020 https://github.com/SAP-samples/cloud-abap-rap/tree/On-Premise-2020 or on-premise-2021 https://github.com/SAP-samples/cloud-abap-rap/tree/On-Premise-2020"

Correct:

And for on premise systems you have to use the appropriate branch on-premise-2020 https://github.com/SAP-samples/cloud-abap-rap/tree/on-premise-2020 or on-premise-2021 https://github.com/SAP-samples/cloud-abap-rap/tree/on-premise-2021

Records are not getting saved in Custom TR.

I created the project with Customizing record button checked.
When i am trying to create the entry in the table, the select transport button is visible, it is even fetching all the custom TR but once i select a TR and create the record, then the record is not getting captured in that Custom TR. However the record is getting created in the database table but it is not recorded in the TR.

N.B.: Application is created on On-Prem 21

zdmo_cl_rap_generator_setup doesn't exist

I pulled the project to SAP S/4HANA Cloud but after that I check the class zdmo_cl_rap_generator_setup doesn't exist in branch abap-enviroment.

How should I proceed?

Fiori Preview Issue

Hi,

I haven't used the RAP generator for a while and it used to work fine.

I can still start the app via Fiori Preview and it shows me the existing projects, but i can no longer navigate to the Object Page of the projects. When I click on a record then nothing happens. I can't see any related errors in the console. I'm using chrome and I also tried a different browser. Any idea?
I have this issue on two different BTP ABAP Environments instances.

Thanks,

Nicolas

zdmo_cl_rap_generator_setup code error in on-premise 2020

The code in CREATE_SERVICE_BINDING in zdmo_cl_rap_generator_setup on-premise 2020 is commented out.
So, if I uncomment and activate the code, an error occurs in the code below.
DATA(specification_srvb) = mo_srvb_put_operation->for-srvb->add_object( service_binding_name )->set_package( package_name_of_rap_generator )->create_form_specification( ).
Error Text
"FOR" is not a reference variable.

When I looked at TS_API among the variable definitions of IF_XCO_GEN_O_MASS_PUT, it was as follows.
BEGIN OF ts_api, bdef TYPE REF TO if_xco_gen_bdef_o_m_put_sctn, clas TYPE REF TO if_xco_gen_clas_o_m_put_sctn, ddls TYPE REF TO if_xco_gen_ddls_o_m_put_sctn, ddlx TYPE REF TO if_xco_gen_ddlx_o_m_put_sctn, doma TYPE REF TO if_xco_gen_doma_o_m_put_sctn, dtel TYPE REF TO if_xco_gen_dtel_o_m_put_sctn, intf TYPE REF TO if_xco_gen_intf_o_m_put_sctn, srvd TYPE REF TO if_xco_gen_srvd_o_m_put_sctn, tabl TYPE ts_tabl, ttyp TYPE REF TO if_xco_gen_ttyp_o_m_put_sctn, END OF ts_api.

Augmented Texts for Customizing Tables

Hello Andre,
I am using Your generator to generate customizing tables in Fiori successfully. Thanks for Your efforts. I saw more arrived in terms of functionality, and would like to put here another new feature request :). This is about the augmentation feature. My use case is simple, I would like to edit language dependent texts, like it is happenning in SM30 on the user logon language on top of a maintenance view (constructed from a basic and a text table assigned).

So we have code-text pairs, like in SM30, and the text can be edited on the user logon language, for example English

  • InPr - In Process
  • Fin - Finished

So when the user logs on in German to the system we want to maintain the texts in German and be saved it to the text table

  • InPr - In Prozess
  • Fin - Fertig

I assume the augmentation feature could become here handy, to solve this. Implementing all the time the same in the augment method in the behaviour definition is time consuming.
I would like to save that effort :).

What do You think, makes that sense ?

Thank you
Attila

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.