%data = CORRESPONDING #( EXCEPT TravelID ) " fill in travel container for creating new travel instanceĪPPEND VALUE #( %cid = keys-%cid LOOP AT travel_read_result ASSIGNING FIELD-SYMBOL(). READ ENTITIES OF zrap100_r_traveltp_# IN LOCAL MODE " read the data from the travel instances to be copied READ TABLE keys WITH KEY %cid = '' INTO DATA(key_with_inital_cid). " remove travel instances with initial %cid (i.e., not set by caller API) Travels TYPE TABLE FOR CREATE zrap100_r_traveltp_# ravel. * Instance-bound factory action `copyTravel`: Set the result set in the mapped structure - especially in the internal table mapped-travel for the present example.įor that, replace the current method implementation with the code snippet provided below and replace all occurrences of the placeholder # with your group ID.Ĭopy **************************************************************************.Create new Travel instances with the EML statement MODIFY ENTITIES.CREATE which returns the mapped data.In the present exercise, we will adjust the begin date ( BeginDate ) and the end date ( EndDate ) due to the implemented validation validateDates and set the overall status of new travel instances to Open (O).The component %param-%is_draft indicating the state of the new entity have to be evaluated - and the state of the new instances set accordingly.Fill in a travel container ( itab ) with all the new travel instances to be created.Remove all travel instances with initial ID and read the data from the transferred travel keys to be copied. The logic consists of the following steps: %is_draft = 01 : New instance must be created as draft instance - i.e., will first be only stored in the draft table.%is_draft = 00 : New instance must be created as active instance - i.e., must be persisted.This component can be used by calling EML APIs to indicates the state of the new instance to be created: The implementation method of a factory action imports the parameter structure %param which has the component %is_draft. Implement the factory action copyTravel in the behavior pool class icon ZRAP100_BP_TRAVELTP_#. Static factory actions can be used to create instances with prefilled default values.įurther reading: Actions | CDS BDL - non-standard operations | Implicit Response Parameters | ABAP EML - response_param Instance-bound factory actions can copy specific values of an instance. Factory actions can be instance-bound (default) or static. Static actions are not bound to any instance of a RAP BO entity but relate to the complete entity.įactory actions: Factory actions are used to create RAP BO entity instances. If the optional keyword static is used, the action is defined as static action. An action is related to an instance by default. An action per default relates to a RAP BO entity instance and changes the state of the instance. The custom logic must be implemented in the RAP handler method FOR MODIFY. Non-factory actions: Defines a RAP action which offers non-standard behavior. Two main categories of actions can be implemented in RAP: In the RAP context, an action is a non-standard operation that change the data of a BO instance. Reminder: Do not forget to replace the suffix placeholder # with your chosen or assigned group ID in the exercise steps below. In the present exercise, you will learn how to add factory action. In the previous exercise, you’ve defined and implemented instance action.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |