Hello gurus,
I created a component ZBOOKING with RAD Tool and will fill booking detail table with initial data during a creation of new booking objekt.
My Booking component looks like on the picture below. It was created with Rapid Application Tool and is based on one ZBOOKING Table with was created in CRM Backend and one “Booking details” Table with was created with Rapid Application.
My Question is how should I populate initial Template-Data to this dependent “booking details” Table wenn I will create a new booking object.
Web UI of ZBooking component
Component structure of ZBooking
I have tried to do sample implementation in do_init_context method of ZACL_CLASS00000C_IMPL class to fill ZBOOKING_DETAILS with some data.
method DO_INIT_CONTEXT.
CALL METHOD SUPER->DO_INIT_CONTEXT.
DATA: lr_col TYPE REF TO if_bol_bo_col,
lr_valuenode TYPE REF TO cl_bsp_wd_value_node,
lr_template TYPE REF TO ZBOOKING_DETAIL.
CREATE DATA lr_template.
CREATE OBJECT lr_valuenode
EXPORTING
IV_DATA_REF = lr_template.
if lr_valuenode is BOUND.
lr_valuenode->SET_PROPERTY_AS_STRING(
iv_attr_name = 'ZZVISITDATE' "#EC NOTEXT
iv_value = '01.01.2014'
).
ENDIF.
CREATE OBJECT lr_col TYPE cl_crm_bol_bo_col.
lr_col->ADD(
exporting
iv_entity = lr_entity
IV_SET_FOCUS = ABAP_TRUE
).
me->TYPED_CONTEXT->ZBOOKING_DETAIL->SET_COLLECTION( lr_col ).
endmethod.
After this implementation the initial data is displayed in “Booking details”.
However if I press an Edit-List-button (Assignment block) I get an error “CUST Operation”.
May be I should fill this depented table ZBOOKING_DETAILS without cl_bsp_wd_value_node?
Where should I implement logic if I want to fill initial data just during creation of booking object and not every
time when the booking object is called or initialized?
Regards Dmitry