on 2023 Feb 06 8:49 PM
Good evening,
I have a question about static factory actions in RAP. In our managed RAP application, we have a root and 1 child node. For the child entity, we want to implement a static factory action with a popup for the barcode and then let the action create the child with the necessary data.
In the behavior definition, we've defined the static factory action ScanBarcode for our child:
static factory action ScanBarcode parameter ZSD_I_SCL_BARCODE_INPUT [1];<br>
But now, when we want to create the child entity, we don't seem to have access to the parent key? The method only receives 1 parameter: keys. This parameter only contains the %CID of the child entity and %PARAM with the fields of the abstract entity.
METHODS scanbarcode FOR MODIFY
IMPORTING keys FOR ACTION sampleloanitem~scanbarcode.
METHOD scanbarcode.
LOOP AT keys ASSIGNING FIELD-SYMBOL(<fs_instance>).
MODIFY ENTITY ztest IN LOCAL MODE
CREATE BY \_Child
SET FIELDS WITH VALUE #( (
%cid_ref = ?????
%target = VALUE #(
( %cid = <fs_instance>-%cid
Barcode = <fs_instance>-%param-barcode
.... ) )
))
FAILED failed
REPORTED reported
MAPPED mapped.
ENDLOOP.
ENDMETHOD.
<br>
Is there a way to get the key of the parent entity, so that we can link this child to the right parent?
What am I doing wrong or are static factory actions not supported for child entities?
Request clarification before answering.
Hi Liesbeth,
I'm got a similar scenario here. Were you able to find a workaround for this?
I thought of placing this action at parent entity instead and refreshing the association with a side effect, but then I'm unable to find ways to put the button on the right spot (alongside with the child table).
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Liesbeth,
Have you solve the problem.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
i usually use a action on parent level to create childs:
at defining Behavior definition:
action ( features : instance ) AddProject parameter ZDIAMOND_I_INPUT_ADDPROJECT result [1] entity ZDIAMOND_I_PROJECT_M;
on Projection Behavior Definition:
use action AddProject result entity ZDIAMOND_C_PARTNER_PROJECT_M;
I hope it helps.
best regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Has anyone found solution for this? Maybe we are trying wrong approach? Does someone know how to make child entity with action (pre-field data), not with create and user input? andre.fischer maybe you could help us out what would be correct aprouch for this scenariou?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I have the same issue, did you find any ansewr for that?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
You can use Read by association to get information about parent node.
" Read all parent UUIDs
READ ENTITIES OF /DMO/R_Travel_D IN LOCAL MODE
ENTITY Booking BY \_Travel
FIELDS ( TravelUUID )
WITH CORRESPONDING #( keys )
RESULT DATA(travels).
Best wishes
Ramjee Korada
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
30 | |
10 | |
8 | |
8 | |
7 | |
7 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.