Application Development and Automation 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: 
Read only

handling authorization error while updating infotype

Former Member
0 Likes
474

I am calling function module to add the record in info type, i want to set a returncode if user is not authorized to access infotype

but nothing has come in wa_return even the infotype is not getting updated

data: wa_return type bapiret1.

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '9077'

number = wa_p9077-pernr

validityend = wa_p9077-endda

validitybegin = wa_p9077-begda

record = wa_p9077

operation = 'INS'

IMPORTING

return = wa_return.

please guide

2 REPLIES 2
Read only

Former Member
0 Likes
389

Try this code

constants: insert type pspar-actio value 'INS'.

"This code is requred and locks the record ready for modification

CALL FUNCTION 'HR_EMPLOYEE_ENQUEUE'

EXPORTING

number = p_pernr.

validitybegin = p_record-begda.

validityend = p_record-endda.

p_record-pernr = p_pernr.

p_record-begda = pn-begda.

p_record-endda = validityend.

p_record-subty = p_subty. "subtype of new entry

p_record-scref = p_subty. "subtype of new entry

"plus populate any other fields you need to update

CALL FUNCTION 'HR_INFOTYPE_OPERATION'

EXPORTING

infty = '0071'

subtype = p_record-subty

number = p_record-pernr "employeenumber

validityend = validityend

validitybegin = validitybegin

record = p_record

operation = insert

nocommit = nocommit

dialog_mode = '0'

IMPORTING

return = return_struct

key = personaldatakey

EXCEPTIONS

OTHERS = 0.

Read only

Former Member
0 Likes
389

Resolved