Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calling ABAP RAP methods from old ABAP program

Tags:

abap

rap

I have a FIORI app developed with ABAP RAP .

Now I need to create an ALV with old ABAP style.

Can I call the ABAP RAP methods (CREATE, READ, DELETE, etc) from the old ABAP?

like image 269
I.B.N. Avatar asked Dec 31 '25 06:12

I.B.N.


2 Answers

You can call READ, CREATE, UPDATE, DELETE of RAP business objects using ABAP EML (Entity Manipulation Language), with key words like READ ENTITIES (for read), MODIDFY ENTITIES (for create, update, delete). Also note that you need to call COMMIT ENTITIES for updating the buffer to database tables.

If you want to display the RAP business object data in ALV, you can use READ ENTITIES, fill an internal table with that data and then pass the data to ALV functions like you do normally.

The syntax for executing action of a RAP business object from normal ABAP is as below.

MODIFY ENTITY XXX_rap_business_object
EXECUTE XXX_action_name FROM VALUE #( ( id = XXX ) )
FAILED DATA(failed)
REPORTED DATA(reported).

COMMIT ENTITIES
RESPONSE OF XXX_rap_business_object
FAILED DATA(commit_failed)
REPORTED DATA(commit_reported).

Additional info link: https://learning.sap.com/learning-journeys/acquire-core-abap-skills/using-the-entity-manipulation-language_b378f225-0471-45bf-8b7a-f48d00e1bccb

like image 162
Satish Kumar Avatar answered Jan 04 '26 12:01

Satish Kumar


You can call the oData service with a http request call like described in the following blog post: https://community.sap.com/t5/technology-blogs-by-members/consume-odata-service-in-abap-cl-http-client-gt-create-by-destination-http/ba-p/13228831

Or thus the RAP model is always setup on an CDS view, you can use the IDA alv class to display the values of the RAP model:

cl_salv_gui_table_ida=>create_for_cds_view( 'Z_I_CDS_View' )->condition_factory( )->fullscreen( )->display( )
like image 35
Christian Avatar answered Jan 04 '26 13:01

Christian



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!