I.B.N.
I.B.N.

Reputation: 1034

Calling ABAP RAP methods from old ABAP program

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?

Upvotes: 3

Views: 819

Answers (2)

Satish Kumar
Satish Kumar

Reputation: 253

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

Upvotes: 2

Christian
Christian

Reputation: 19

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( )

Upvotes: 0

Related Questions