on 08-18-2022 11:36 AM
Hello All,
We have RAP based unmanaged scenario without draft. Requirement is to put validations in Child entity(object page).
As we cannot have validations defined in behavior definition because it is not Managed scenario or Unmanaged scenario with Draft, we have coded our validations in CHECK_BEFORE_SAVE method of saver class in unmanaged scenario.
Now child entity (on object page), we are editing multiple rows at a time and then saving, something like below. Now there is error in one row, even though we have edited two rows (Say row with col1 = 8 ). We have appended single message in FAILED and REPORTED parameters passing the key field. But the issue is Error is repeating multiple times based on number of rows updated. In this case twice. If three rows are updated and then saved , same error is coming thrice.
We also tried putting validations in UPDATE method, but same result.
Below is code snippet followed
LT_EMP_ENTITY is having all updated records, but only appended to FAILED and REPORTED based on condition.
METHOD check_before_save.
IF reported IS NOT INITIAL.
CLEAR reported-employee.
ENDIF.
IF failed IS NOT INITIAL.
CLEAR failed-employee.
ENDIF.
DATA: lt_emp_leave_details TYPE TABLE OF zhr_absencequota,
lt_emp_entity TYPE TABLE OF lcl_buffer=>ty_emp_entity,
lv_total TYPE ptm_quonum.
lt_emp_entity = lcl_buffer=>gt_buffer_emp.
LOOP AT lt_emp_entity ASSIGNING FIELD-SYMBOL(<ls_emp>).
lv_total = <ls_emp>-quarter1 + <ls_emp>-quarter2 + <ls_emp>-quarter3 + <ls_emp>-quarter4.
IF lv_total > <ls_emp>-balance.
APPEND VALUE #( %key = |{ <ls_emp>-manager_id }{ <ls_emp>-pernr }{ <ls_emp>-pyyear }| ) TO failed-employee.
APPEND VALUE #( %key = |{ <ls_emp>-manager_id }{ <ls_emp>-pernr }{ <ls_emp>-pyyear }|
%msg = new_message( id = 'ZHR_FTA_006'
number = '001'
v1 = <ls_emp>-pernr
severity = if_abap_behv_message=>severity-error ) ) TO reported-employee.
ENDIF.
CLEAR: lv_total.
ENDLOOP.
ENDMETHOD.
This issue is resolved.
This issue is happening only when we are running the application in preview mode from ADT.
Not facing this issue once the App is created in BAS & deployed to On-Premise system. Error is coming only once.
Maybe UI version issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
77 | |
9 | |
7 | |
6 | |
6 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.