Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

SAPSQL_ARRAY_INSERT_DUPREC while using SUSR_USER_BUFFERS_TO_DB

k_suta
Explorer
0 Kudos

Hi @ all,

I have following problem:

I have tried to add a specific parameter ID to the existing parameter IDs of an user.

The function SUSR_USER_PARAMETERS_PUT seems to work correctly, but when I try to save the parameters with function SUSR_USER_BUFFERS_TO_DB I receive above mentioned error/dump. Have I forgotten some coding?

I want to loop through all affected users and add the missing parameter (if neccessary). Maybe this method is not working, but how should I resolve this Problem.

Thank you very much in advance! Kind regards K.Suta

Please have a look:

LOOP AT lt_return.
READ TABLE userp WITH KEY bname = lt_return-partext.
MOVE 'PER' to lt_return-parid.
MOVE userp-zpernr to lt_return-parva.
APPEND lt_return.
CLEAR lt_return.

CALL FUNCTION 'SUSR_USER_PARAMETERS_PUT'
EXPORTING
USER_NAME = userp-bname
TABLES
USER_PARAMETERS = lt_return.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.

CALL FUNCTION 'SUSR_USER_BUFFERS_TO_DB'
EXCEPTIONS
NO_LOGONDATA_FOR_NEW_USER = 1
NO_INIT_PASSWORD = 2
DB_INSERT_USR02_FAILED = 3
DB_UPDATE_USR02_FAILED = 4
DB_INSERT_USR01_FAILED = 5
DB_UPDATE_USR01_FAILED = 6
DB_INSERT_USR05_FAILED = 7
DB_UPDATE_USR05_FAILED = 8
DB_INSERT_USR21_FAILED = 9
DB_UPDATE_USR21_FAILED = 10
INTERNAL_ERROR = 11
OTHERS = 12
.
IF SY-SUBRC <> 0.
* Implement suitable error handling here
ENDIF.
CLEAR lt_return.

ENDLOOP.

0 REPLIES 0