cancel
Showing results for 
Search instead for 
Did you mean: 

when agent position is vacant Leave worflow shoudl go to HR Administrator

Former Member
0 Kudos

Hi,

We are using standard leave worflow WS12300111 . Our client requiremnt is if Superior position is vacant (Because of resignation or transfer) leave workflow should automatically routed to HR Administrator of employee (HR administrator is Z relationship in Organizational management) . We are not planning to modify the standard workflow . is there any standard setting or any program which we can use to do this? Please advise me on solution;

Thanks,

Shimal

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

As suggested by Arghadip, goto basic data > Version dependent tab of the workflow>Agents tab,

here in the place of Workflow system administrator give a Rule satisfying your conditions to get the respective HR administrator. Your issue will be solved.

Sujatha.

Former Member
0 Kudos

I think for this you have to do some customization. I will suggest you to check maintaining the HR administrator name in the workflow Administrator filed of the Basic Data tab.

Thanks

Arghadip

Former Member
0 Kudos

We have two different hr Administrators and for centain group of employees it should go to one hr administrator when superior position is vacant and for other group it should go to different hr administrator .. kindly suggest

Former Member
0 Kudos

You can use this Function Module and make some changes and use it .

FUNCTION ZGET_AGENT.

*"----


""Local Interface:

*" IMPORTING

*" REFERENCE(LAST_APPROVER) TYPE USR21-BNAME

*" REFERENCE(INITIATOR) TYPE SY-UNAME

*" EXPORTING

*" REFERENCE(ONEUP_MGR) TYPE SWHACTOR

*" REFERENCE(TWOUP_MGR) TYPE SWHACTOR

*" REFERENCE(EMAIL_INI) TYPE ADR6-SMTP_ADDR

*"----


data:

v_name like sy-uname,

v_pernr like usr21-persnumber,

v_addrnumber like usr21-addrnumber,

v_add like adr6-smtp_addr,

v_plvar1 like hrobject-plvar,

v_otype1 like hrobject-otype,

v_objid like hrp1001-objid,

v_sobid like hrp1001-sobid,

v_sobid1 like hrp1001-sobid,

v_sobidtemp like hrp1001-sobid.

data: obj_tab like standard table of hrobject with header line.

data: v_i77pr like standard table of t77pr with header line.

data: leading_pos like standard table of hrobject with header line,

wa_lead_pos like leading_pos.

data: disp_tab like standard table of tree_objec with header line,

wa_disp like disp_tab.

data: relat_tab like standard table of tree_struc with header line.

data: begin of emails1 occurs 0,

email like adr6-smtp_addr,

end of emails1.

data: begin of emails2 occurs 0,

email like adr6-smtp_addr,

end of emails2.

  • data: begin of mgr1 occurs 0,

  • objid like swhactor-objid,

  • end of mgr1.

*

  • data: begin of mgr2 occurs 0,

  • objid like swhactor-objid,

  • end of mgr2.

constants : v_pos(2) type c value 'S'.

  • *check if no agent found.

  • if initiator is initial.

**get the uname for the comp mgr

  • v_name = comp_mgr.

  • endif.

if last_approver = ' ' .

v_name = initiator .

else.

v_name = last_approver.

endif.

*find the email addrs for the initiator.

select single persnumber addrnumber from usr21 into

(v_pernr,v_addrnumber)

where bname = v_name.

if sy-subrc = 0.

select single smtp_addr from adr6 into v_add

where persnumber = v_pernr

and addrnumber = v_addrnumber.

if sy-subrc = 0.

move v_add to email_ini.

endif.

endif.

*Check if 1 up mgr or two up required.

if last_approver = ' '.

*find the initiators org unit id.

call function 'RH_GET_ORG_ASSIGNMENT'

exporting

i77pr = v_i77pr

uname = v_name

tables

obj_tab = obj_tab.

v_objid = obj_tab-objid.

*find the one up org unit (reports to a002)

select single sobid from hrp1001 into v_sobid

where plvar = '01'

and otype = 'O'

and objid = v_objid

and rsign = 'A'

and relat = '002'

and sclas = 'O'

and istat = '1'.

*find the managers in one up org unit

call function 'RH_GET_LEADING_POSITION'

exporting

plvar = '01'

otype = v_pos

sobid = v_sobid

  • DATE = SY-DATUM

  • AUTH = 'X'

  • BUFFER_MODE = ' '

  • CONSIDER_VAC_POS = ' '

tables

leading_pos = leading_pos.

  • EXCEPTIONS

  • no_lead_pos_found = 1.

loop at leading_pos into wa_lead_pos.

*find the holder of the position.

call function 'RH_OM_GET_HOLDER_OF_POSITION'

exporting

plvar = wa_lead_pos-plvar

otype = wa_lead_pos-otype

objid = wa_lead_pos-objid

  • REFRESH = REFRESH

tables

disp_tab = disp_tab

relat_tab = relat_tab.

  • EXCEPTIONS

  • NO_ACTIVE_PLVAR = 1

endloop.

*find the email address for these holders

loop at disp_tab into wa_disp.

select single uname from hrp1001 into v_name

where plvar = '01'

and otype = 'P'

and objid = wa_disp-objid.

move v_name to oneup_mgr-objid.

select single persnumber addrnumber from usr21 into

(v_pernr,v_addrnumber)

where bname = v_name.

if sy-subrc = 0.

select single smtp_addr from adr6 into v_add

where persnumber = v_pernr

and addrnumber = v_addrnumber.

if sy-subrc = 0.

move v_add to emails1-email .

endif.

endif.

endloop.

v_sobidtemp = v_sobid.

else.

*find the two up org unit (reports to a002)

select single sobid from hrp1001 into v_sobid1

where plvar = '01'

and otype = 'O'

and objid = v_sobidtemp

and rsign = 'A'

and relat = '002'

and sclas = 'O'

and istat = '1'.

*find the managers in one up org unit

call function 'RH_GET_LEADING_POSITION'

exporting

plvar = '01'

otype = v_pos

sobid = v_sobid1

  • DATE = SY-DATUM

  • AUTH = 'X'

  • BUFFER_MODE = ' '

  • CONSIDER_VAC_POS = ' '

tables

leading_pos = leading_pos.

  • EXCEPTIONS

  • no_lead_pos_found = 1.

loop at leading_pos into wa_lead_pos.

*find the holder of the position.

call function 'RH_OM_GET_HOLDER_OF_POSITION'

exporting

plvar = wa_lead_pos-plvar

otype = wa_lead_pos-otype

objid = wa_lead_pos-objid

  • REFRESH = REFRESH

tables

disp_tab = disp_tab

relat_tab = relat_tab.

  • EXCEPTIONS

  • NO_ACTIVE_PLVAR = 1

endloop.

*find the email address for these holders

loop at disp_tab into wa_disp.

select single uname from hrp1001 into v_name

where plvar = '01'

and otype = 'P'

and objid = wa_disp-objid.

move v_name to twoup_mgr-objid.

  • append twoup_mgr.

select single persnumber addrnumber from usr21 into

(v_pernr,v_addrnumber)

where bname = v_name.

if sy-subrc = 0.

select single smtp_addr from adr6 into v_add

where persnumber = v_pernr

and addrnumber = v_addrnumber.

if sy-subrc = 0.

move v_add to emails2 .

append emails2.

endif.

endif.

endloop.

endif.

ENDFUNCTION.

BR

Abhijeet Chiitale

former_member185167
Active Contributor
0 Kudos

Hello,

You will have to change the agent assignment, eg create a new rule in PFAC which will do that.

regards

Rick Bakker

Hanabi Technology