When we try to update the Nomination using the Function Module OIJ_NOM_MAINTAIN_MULTIPLE, we get an Error Message ‘Update was terminated for xyz user’.
The following screenshots are from SM13 Transaction Code:
After debugging the standard Function Module, we found out it is due to insertion of repeated records.
In the above piece of code (SAP standard Function Module), the Internal Table is not sorted and in READ statement, BINARY SEARCH is used. This is causing the problem.
Hence, we sorted the Internal Table by NOMTK , NOMIT and then passed to the Function Module OIJ_NOM_MAINTAIN_MULTIPLE which resolved the issue.
SORT l_t_nomi BY nomtk nomit.
CALLFUNCTION'OIJ_NOM_MAINTAIN_MULTIPLE'
EXPORTING
it_nom_header = p_l_t_headerdata
it_nom_item = p_l_t_nomi
iv_update_worklist = c_on
iv_update_stockproj = c_on
iv_add_to_log = c_on
iv_internal = c_on
iv_lock = c_off
iv_application = 'NOMINATION'
IMPORTING
et_return = l_t_return
EXCEPTIONS
nomination_locked = 1
error_phase_01 = 2
error_phase_02 = 3
OTHERS = 4.