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: 
anjan_paul
Active Contributor
11,627

SAP RAP (ABAP RESTful Application Programming Model) has two main flavors: managed and unmanaged. Let's focus on the unmanaged version.

Unmanaged SAP RAP refers to a development approach where developers have more control over the data persistence and business logic compared to the managed approach. Here are some key aspects:

  1. Custom Logic: In unmanaged RAP, developers write their own custom logic for handling data retrieval, manipulation, and persistence. This gives more flexibility in how data is processed and stored.
  2. Direct Database Access: Developers can directly access the database tables and define their own data models using Core Data Services (CDS) views or ABAP classes.
  3. Explicit Service Definition: Unlike managed RAP, where service definitions are automatically generated based on annotations, unmanaged RAP requires developers to explicitly define service implementations and behaviors.
  4. Manual CRUD Operations: CRUD (Create, Read, Update, Delete) operations need to be implemented explicitly in unmanaged RAP, giving full control over how data is managed.
  5. Integration with Existing Systems: Unmanaged RAP is often used when integrating with existing systems or when there is a need for complex business logic that cannot be easily handled by the managed approach.
  6. Flexibility: Developers have more freedom to implement complex validation rules, authorization checks, and other custom requirements directly in the application logic.

Overall, unmanaged SAP RAP provides a more hands-on approach to application development compared to the managed approach, allowing developers to leverage their expertise in ABAP programming and database handling while building modern RESTful APIs.

Top of Form

anjan_paul_0-1720068224622.png

 

 

 

In this example, we will show a simple application for Employee build with RAP Unmanaged flavors.

 

Development steps.

 

To be summarized below object will be created for Unmanaged scenario.

anjan_paul_1-1720068224631.png

 

 

Table ZT01_EMPLOYEE

 

anjan_paul_2-1720068224632.png

 

 

Base CDS View Z_I_EMPLOYEES_U

 

anjan_paul_3-1720068224633.png

 

 

Consumption CDS view  Z_C_EMPLOYEES_U

 

anjan_paul_4-1720068224639.png

 

 

 

 

Behavior Definition

 

anjan_paul_5-1720068224640.png

 

Bottom of Form

 

Behavior  definition

anjan_paul_6-1720068224641.png

 

 

Implement the Create  method

anjan_paul_7-1720068224644.png

 

 

Implement Update Method

anjan_paul_8-1720068224646.png

 

Implement Delete Method

anjan_paul_9-1720068224649.png

 

 

Implement Adjust_Numbers method.

anjan_paul_10-1720068224652.png

 

Implement Save method.

anjan_paul_11-1720068224652.png

 

 

Test

  1. Open the Application.

 

anjan_paul_12-1720068224655.png

 

 2. Click on Create. Give Input value and Create.

 

anjan_paul_13-1720068224657.png

 

3. New Record got created.

 

anjan_paul_14-1720068224660.png

 

4. Select any Row , click on Edit.

 

anjan_paul_15-1720068224662.png

 

5. Change the value and Save.

anjan_paul_16-1720068224664.png

 

6. Record will be updated.

 

anjan_paul_17-1720068224666.png

7. Select the Rows and click on Delete.

 

anjan_paul_18-1720068224668.png

 

8. Records will be deleted.

 

anjan_paul_19-1720068224670.png

 

9. In the Database table also you can see the records.

 

anjan_paul_20-1720068224671.png

 

 

So, all the  CRUD operation is successful using RAP Unmanaged flavors.

 

 

 

 

 

 

6 Comments
Andre_Fischer
Product and Topic Expert
Product and Topic Expert

In my opinion you describe the option of "unmanaged" in a too positive way.  

I wouldn't formulate it like this:   

"... allowing developers to leverage their expertise in ABAP programming and database handling while building modern RESTful APIs."   

but more "... forces developers to handle database access themselves which only makes sense when dealing with legacy API's".  

But even then developers should check if it is not possible to use a managed approach with an unmanaged save since this way lots of the implementations you described above are not necessary. 

Managed with unmanaged save is the recommended option. Unmanaged is the last resort.

Kind regards,

Andre

 

Sandra_Rossi
Active Contributor

Is there a reason to post code as image rather than text? Code as image discourages people from trying by themselves.

anjan_paul
Active Contributor
0 Kudos

@Andre_Fischer   Thanks for your valuable opinion. Totally agree Unmanaged is the next option after Managed with Unmanaged Save.

 

@Sandra_Rossi  Thought of Code collection is very small. Might be User can just see and write the code help them to practice more. In case of lots of line of code definitely will give the code snippet.

 

Thanks,

Anjan Paul

myhoa_pham
Discoverer
0 Kudos

Hello Anjan, 
Thanks for your helpful blog post.
I'm newbie in RAP development and currently practicing your sample. Could you please share me where lcl_buffer is initialized? 
Thanks.

rcaziraghi
Participant
0 Kudos

@anjan_paulgreat work! It's really interesting. However, we are missing the lcl_buffer implementation. I'm really curious about it.
@Andre_Fischerone question about the managed vs. unmanaged scenario: Is there a scenario where unmanaged would be preferred? It looks like managed is preferable in almost all cases, so there should be very few situations where we would go with unmanaged. Maybe custom/abstract entities would be cases where unmanaged would be preferable?

Jayasurya11
Newcomer
0 Kudos

Hello anjan,

Thanks for your helpful blog post,

I am currently working on an ABAP class implementation and encountered an issue with the type LCL_BUFFER being unknown. I understand that the lcl_buffer class or type needs to be defined, but I am not sure how to proceed with this. Could you please provide guidance on how to define the lcl_buffer class and implement the necessary logic for handling the creation values?

Thank you for your assistance.

 

Labels in this area