cancel
Showing results for 
Search instead for 
Did you mean: 

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

Former Member
0 Kudos

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?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

I assume your BTSTART is a custom context node. When you create the context node with the wizard, did you also create the relationship to the date set?

The easy way to check is to see if the ON_NEW_FOCUS method is being implemented. If yes, you can check the source in the method and see if the relationship is being implemented correctly. You can compare the code with the one in the BTDATEORDERPLANNED.

Former Member
0 Kudos

If directly Save is clicked after user changes the date, the Save method will be called first. The changes are saved to the database.

Do_prepare_output (and your code) is executed before displaying the UI and not before Save method.

You need to move your code to do_handle_data or do_handle_event.

Also check the lock method to confirm whether you can update the Date entity.

Thanks,

Alwyn

Former Member
0 Kudos

Hi,

Thanks for your reply,

yes, i checked the same thing also. But DO_HANDLE_DATA is called before the SET method of receiving date and in that case we are getting the old value in DO_HANDLE _DATA and source and Target fields both are not updating.

I checked, if, i'll change the input field then set method of input field and then EH_ON_SAVE is called directly.

i think, if i'll do the same modification in the EH_ON_SAVE method as i did in the DO_PREPARE_OUTPUT then it can be updated but i don't want to change the EH_ON_SAVE at this moment.

is there any other way to update the START DATE(Display mode in the screen) which is calculate from the other context node field receiving date.

former_member191572
Contributor
0 Kudos

check it in do_init_context method