abaprap

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?


Solution

  • 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