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

Problem with Function Module to Get Managers

Former Member
0 Likes
2,183

Hi All,

We have some developed applications in which we need to get line managers for approval processing. For that we are using

the standard Function Module : HR_ASR_GET_LEADER. As we have HR Structural Authorizations maintained, this function module is not displaying Line Managers for some employees (even SAP_ALL is there)as it is performing authorization checks on structural profiles.

So we have developed a custom FM : ZGetApprs in which are retrieving Line managers from the table HRP1001.

We need to get clarification on the following:

1) In future if upgrades are done, will this custom Function module will affect in any areas.

2) Is there any function module like HR_ASR_GET_LEADER which will not perfrom unnecessary checking on structural profiles for simply getting Line managers.

Mustafa

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,821

Hi Shareef,

Use one of below given FM according to your convenience... Give necessary inputs.. One is get the chief position and one is to get the immediate supervisor.

RH_ACT_LEADING_POSITION

SWX_GET_MANAGER

Cheers,

Sanil

11 REPLIES 11
Read only

Former Member
0 Likes
1,822

Hi Shareef,

Use one of below given FM according to your convenience... Give necessary inputs.. One is get the chief position and one is to get the immediate supervisor.

RH_ACT_LEADING_POSITION

SWX_GET_MANAGER

Cheers,

Sanil

Read only

0 Likes
1,821

Hi Sanil,

Can u please be more clear about the parameters we have to pass to the above function modules to get the line managers of the particular employee?

I tried but it is giving null results and unable to pass the input parameters.

Thanks

Shareef

Read only

0 Likes
1,821

Hi mustafa,

If you are enhancing the standard function module or trying to change the authorizations in you function module , then there is a chance of affect during upgrades, otherwise as Azam mentioned there will not be any affect unless you are trying to change even HRP1001 structure of the table. Simply retrieving has no affect.

Rgds,

Surya

Read only

0 Likes
1,821

Hi

Use this code

FUNCTION ZWF_FIND_USERS.
*"-----------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      ACTOR_TAB STRUCTURE  SWHACTOR
*"      AC_CONTAINER STRUCTURE  SWCONT
*"  EXCEPTIONS
*"      NOAGENT_FOUND
*"-----------------------------------------------------------  INCLUDE <CNTN01>.
  DATA : POSITION_ID LIKE ZBUSAREA-OBJID,
         LT_HOLDERS TYPE STANDARD TABLE OF SWHACTOR,
         LWA_HOLDERS TYPE SWHACTOR,
         LWA_USERS TYPE STANDARD TABLE OF HRP1001,
         WA_USERS TYPE  HRP1001,
         NUM_LINES TYPE I.
*Read values assigned to the rule criteria
  SWC_GET_ELEMENT AC_CONTAINER 'POSITION_ID' POSITION_ID.  SELECT * FROM HRP1001 INTO table LWA_USERS
  WHERE OBJID = POSITION_ID.
  IF NOT LWA_USERS IS INITIAL.
    REFRESH LT_HOLDERS[].    loop at LWA_USERS into WA_USERS.      Condense WA_USERS-SOBID.
      LWA_HOLDERS-OTYPE = 'US'.
      LWA_HOLDERS-OBJID = WA_USERS-SOBID.
      APPEND LWA_HOLDERS TO LT_HOLDERS.
      APPEND LINES OF LT_HOLDERS TO ACTOR_TAB.
    endloop.  ENDIF.
  DESCRIBE TABLE ACTOR_TAB LINES NUM_LINES.
  IF NUM_LINES IS INITIAL.
    RAISE NOAGENT_FOUND.
  ENDIF.ENDFUNCTION.

Regards

vijay

Read only

0 Likes
1,821

Hi vijay,

We have already developed the custom fucntion module using the table HRP1001 to retreive the line managers.

We only want to know wat is the effect of using this custom develop function module during an upgrade.

We want to know is there any standard function module which will not perform the authorizations on the structual profiles.

Thanks

Mustafa

Read only

0 Likes
1,821

Hi

SWX_GET_MANGER wont do authorization check. i have used this only in my project. Use the same thing.

Regards

vijay

Read only

azam_uddin
Explorer
0 Likes
1,821

Hi Mustafa,

1. Z function module will not effect anything during upgrades as I have developed so many custom function modules and infotypes in our organization to meet the requirements.

The Standard fucntion module also retreive the data from the Table HRP1001, therefore it will not have any negative impact on the system during upgrades.

2.As per my knowledge there is no such standard function module which will not check the structural authorizations to get the data from the organization structure.

Best Regards

Azam uddin

Read only

Former Member
0 Likes
1,821

Hello Musthafa,

future upgradation won't affect your developed function module or your system ,as it is a z development.

Regards

Abdul Hameed Hussain

Read only

Former Member
0 Likes
1,821

Hi Shareef,

Check in forum or just try like below given... check in PPOM_OLD transaction and find out the org structure.

The table AC_CONTAINER needs to filled and passed.

ELEMENT = ORG_OBJECT

TAB_INDEX = 000001

ELEMLENGTH = 012(Length of User Id concatenated with US in front)

TYPE = C

VALUE = US concatenated with User ID

The table ACTOR_TAB will contain the output.

Cheers,

Sanil

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,821

Check this link:[http://sapprograms.blogspot.com/]

Just hit ctrl+F and find for "get manager details"

Read only

Former Member
0 Likes
1,821

Solved by writing the custom code