Skip to Content
0
Former Member
Jun 15, 2011 at 12:55 PM

Update non-editable field Start date which is calculated from other context

62 Views

I had created some custom date fields(model, bol entity) in component ICCMP_BTSHEAD. We are calculating Start date based on the new input value into receiving date in the other context node.

so, for this i get the value on controller class(_IMPL). and pass the same value in the GET method of Start date.

But, Problem is Start date is the non-editable field so SET method will not be trigger as expected. so the same i used the DO_PREPARE_OUTPUT method but it's called and update the value when we press the enter. IF directly we click on the "SAVE" button then it' trigger but value is not updating in the database.

Please, find the below piece of code for the same. can u please anybody help me that how can i achieve this requirement.

DATA: l_recieve_date TYPE crmt_date_timestamp_from,

lr_current TYPE REF TO cl_bsp_wd_mixed_node,

lr_col TYPE REF TO cl_bsp_wd_collection_wrapper.

DATA: lv_date TYPE d,

lv_time TYPE t,

lv_date_temp TYPE sydatum.

IF iv_first_time EQ abap_false. "avoid for first tile load

  • Read the value of btreceivedate-TIMESTAMP_FROM.

lr_col = me->ztyped_context->btreceivedate->get_collection_wrapper( ).

IF lr_col IS BOUND.

lr_current ?= lr_col->get_current( ).

IF lr_current IS BOUND.

lr_current->if_bol_bo_property_access~get_property_as_value( EXPORTING iv_attr_name = 'TIMESTAMP_FROM'

IMPORTING ev_result = l_recieve_date ).

ENDIF.

ENDIF.

IF l_recieve_date IS NOT INITIAL.

CONVERT TIME STAMP l_recieve_date TIME ZONE sy-zonlo

INTO DATE lv_date TIME lv_time.

  • Check day is working day - if not, correct to previous working day

IF lv_date IS NOT INITIAL.

lv_date_temp = lv_date.

CALL FUNCTION 'DATE_CONVERT_TO_FACTORYDATE'

EXPORTING

correct_option = '-'

date = lv_date

factory_calendar_id = 'GB'

IMPORTING

date = lv_date_temp

EXCEPTIONS

date_after_range = 1

date_before_range = 2.

IF sy-subrc IS INITIAL.

lv_date = lv_date_temp.

ENDIF.

ENDIF.

CONVERT DATE lv_date TIME lv_time

INTO TIME STAMP l_recieve_date TIME ZONE sy-zonlo.

ENDIF.

lr_col = me->ztyped_context->btstart->get_collection_wrapper( ).

IF lr_col IS BOUND.

lr_current ?= lr_col->get_current( ).

IF lr_current IS BOUND.

lr_current->if_bol_bo_property_access~set_property(

iv_attr_name = 'APPT_TYPE' "#EC NOTEXT

iv_value = 'ZSTWTIME0001' ).

lr_current->if_bol_bo_property_access~set_property(

iv_attr_name = 'TIMESTAMP_FROM' "#EC NOTEXT

iv_value = l_recieve_date ).

ENDIF.

ENDIF.

ENDIF.

could you please help me?