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?