on 10-18-2021 3:54 PM
Is there a standard function module or class method I can use to assign Employees to a Work Center? (Work center HR assignment)
Responding to Oscar Del Castillo: Yes that's exactly what I mean. Like going to CR02 -> Scheduling -> Capacity -> HRMS. I want to be able to do this programmatically.
The function module to do this is ‘CR_CAPACITY_PERSON_REL_WRITE’. You need to know the Capacity ID of the Work Center and the Personnel Number of the user you want to assign.
Here is an example of the FM below:
DATA: lv_capacity_id type kapid.
" Get Work Center Capacity ID
select single kapid
from crhd
into lv_capacity_id
where werks = 'AB01' " Plant
and arbpl = '01AB'. " Work Center
" Assign resource (person) to a Work Center
call function 'CR_CAPACITY_PERSON_REL_WRITE'
exporting
in_datum_bis = sy-datum " End Date
in_datum_von = sy-datum " Start Date
in_kapid = lv_capacity_id " Capacity ID
in_otype = 'P' " Object Type
in_pernr = '00011122' " Personnel Number
vtask = 'S' " Update (B=Buffer,D=Online,V=Update,S=Sync)
commit_flg = 'X'
exceptions
capacity_not_existent = 1
insert_error = 2
no_integration = 3
person_not_activ = 4
relation_existent = 5
time_range_incorrect = 6
others = 7.
if sy-subrc <> 0.
* Implement suitable error handling here
endif
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for closing your question. This will help me out too.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
98 | |
9 | |
7 | |
6 | |
4 | |
3 | |
3 | |
3 | |
3 | |
2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.