This is a test message to test the length of the message box.
Login
|
ABAP RAP Deep Table Action
Created by Software-Heroes

RAP - Deep Table Action

9357

Is it currently possible to pass tables to actions in RAP? This article is intended to provide a better insight into the topic.

Advertising


Last year we wrote about Deep Actions in OData v4 and looked at an implementation of how you can call an action with deep structures from outside. The question of how deep table actions can be implemented came up via Marian Zeis.

 

Introduction

Deep Actions is about wanting to pass a nested structure to the action. For example, we can not only pass a document, but also the table of the various positions and other additional data in the same structure. Since we are working with deep structures here, we can provide different information at different levels.

 

Implementation

Let's look at an implementation in our application for the complex entity and what you should pay attention to.

 

Extension

To do this, we extend our API "ZBS_API_RAPC_INVOICE_O4" from the blog mentioned above. In the first step, we need a new action. This is basically structured like the other action, except that the keyword TABLE must be added.

static action CreateMultipleInvoices deep table parameter ZBS_S_RAPCreateInvoice;

 

This changes the parameter from a structure to a table. This means we can now pass a table directly to the object.

 

Problem

However, there is now an error in the OData service when we try to access it. When we call the service binding, however, we receive an error message "Error in entity 'ZBS_C_RAPCINVOICE(CDS)': 'T' is not a valid value of the enumeration type 'TY_ACTION_PARAMETER_DEPTH'.":

 

Via me.sap.com you can also find a corresponding question in the SAP Community on the topic. You won't find an answer from SAP there, but the developer had already debugged through the SADL framework and found the commented-out section plus the comment.

 

Hint: We checked this status in the ABAP environment, so the deep table does not seem to be supported in OData at the moment.

 

EML

However, the example still works with the RAP business object in EML. We can prepare the corresponding data for this.

DATA lt_document TYPE tt_document.

INSERT VALUE #( %cid = xco_cp=>uuid( )->value ) INTO TABLE lt_document REFERENCE INTO DATA(lr_new_item).

lr_new_item->%param = VALUE #( Partner = '1000000004'
                               ( Document  = 'TEST'
                                 _position = VALUE #( Unit     = 'ST'
                                                      Currency = 'EUR'
                                                      ( Material = 'F0001' Quantity = '2' Price = '13.12' )
                                                      ( Material = 'H0001' Quantity = '1' Price = '28.54' ) ) )
                               ( Document  = 'TEST2'
                                 _position = VALUE #( Unit     = 'ST'
                                                      Currency = 'USD'
                                                      ( Material = 'G0001' Quantity = '2' Price = '17.12' )
                                                      ( Material = 'Z0001' Quantity = '1' Price = '29.55' ) ) ) ).

 

We then call our action via EML and pass the two documents to the statement. We can then test the action.

MODIFY ENTITIES OF ZBS_R_RAPCInvoice
       ENTITY Invoice
       EXECUTE CreateMultipleInvoices FROM lt_document
       FAILED DATA(ls_failed_deep)
       REPORTED DATA(ls_reported_deep).

 

If we now set a breakpoint in the action and look at the payload, we receive our sent data as a table.

 

Workaround

There is currently a workaround for the problem. You can use the structure as a dummy and append the table at the next level. In the article you will learn more about the use and implementation in a Fiori app. You can take a closer look at the topic in our article on Deep Action. There we explain the call from outside and the use as EML.

However, the use of tables in Fiori Elements applications (Actions) is still not supported; here you can only use flat structures.

 

Complete example

The adjustments and resources shown can be found on GitHub in the repository. The changes were made via the following commit.

 

Conclusion

Currently you can only use the DEEP TABLE PARAMETER function to a limited extent in the EML environment and not directly in the service. However, the workaround using the dummy structure can help to avoid throwing the whole idea out the window.

 

Source:
SAP Help - Modeling Parameters for Non-Standard Operations


Included topics:
RAPBTPActionDeepREX2
Comments (0)



And further ...

Are you satisfied with the content of the article? We post new content in the ABAP area every Tuesday and Friday and irregularly in all other areas. Take a look at our tools and apps, we provide them free of charge.


RAP - Hybrid Pattern

Category - ABAP

Let's take a look at the hybrid pattern in the development of RAP objects. Who is this scenario intended for, how does it work, and what basic components are needed?

06/19/2026

BTP - Connect On-Prem (SQL Service)

Category - ABAP

How can we connect an on-premise SQL service to our ABAP environment, and what advantages does this offer? Let's take a technical deep dive.

05/29/2026

RAP - Implement Change Documents (native)

Category - ABAP

If you have the appropriate release, you can now implement change documents natively in RAP without much manual implementation. Let's look at the different steps.

04/24/2026

RAP - Auxiliary Class

Category - ABAP

As the implementation grows in the behavior implementation of a RAP object, what options do you still have for clean encapsulation? Let's look at this in detail.

04/17/2026

RAP - Implement Change Documents (Manual)

Category - ABAP

This article delves into the manual implementation of change documents in our RAP object and examines the various integration steps. The goal is to generate change documents automatically.

04/14/2026