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: 

Creating new position

Former Member
0 Kudos

Hello All,

Is there a function module available that creates a new position in an organization?

I would appreciate your responses.

~Mark

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Mark,

Try using F.M. RH_GENERATE_POSITION_AT_ORG

It will create the position with user assigned to it in Org unit which you will pass to this F.M.

Hope this serves the purpose.

Rgeards,

Akshay

P.S. : Pls. reward with points if answer is helpful / solves the problem.

63 REPLIES 63

former_member188685
Active Contributor
0 Kudos

RH_CREATE_POSITIONS

0 Kudos

I would rather use the Maintain Object Transaction 'PP01'

or 'PP03'.

Regards,

Suresh Datti

0 Kudos

Hi Suresh,

I need to do it through an RFC. So I can pass in the orgUnit ID underwhich I want to create a new position and thats why I am looking for a function Module.

~Mark

0 Kudos

THIS is a RFC <b>RH_CREATE_POSITIONS</b>

you can very well use this..

vijay

0 Kudos

Hi Mark

if you see this FM attributes ...

<b>RHGB Company Organization Structure</b>

and It Is RFC enabled..

CALL FUNCTION 'RH_CREATE_POSITIONS'
  EXPORTING
    ACT_ORG_OBJID            = 'TEST'
   ACT_JOB_OBJID            =
   ACT_POSITION_COUNT       = 1
   ACT_PLVAR                = ' '
   ACT_BEGDA                = SY-DATUM
  ACT_ENDDA                = '99991231'
   ACT_ISTAT                = '3'
 EXCEPTIONS
  ORG_UNIT_NOT_VALID       = 1
   STATUS_CONFLICT          = 2
   OTHERS                   = 3
          .
IF SY-SUBRC <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

0 Kudos

You need to pass the correct info to this then it will create. this is the RFC you are looking for i guess.

please let me know if you have any doubts..

regards

vijay

0 Kudos

Does this function return the ID of the new position created?

Regards,

~Mark

0 Kudos

Hi Mark,

This function module will creat positions but will not give you the Object IDs of the created positions. YOu will have to pass the following parameters. And a successful retune code tells you that the posiiotns were created. You will hav eto look in HRP1001 either under Org Unit or job to get the psotion IDs.

ACT_ORG_OBJID 00000000 " Org Unit ID

ACT_JOB_OBJID 00000000 "Job id optional

ACT_POSITION_COUNT 00000001 "No of posns to be created

ACT_PLVAR '01'

ACT_BEGDA 12/19/2005

ACT_ENDDA 12/31/9999

ACT_ISTAT 1

Regards,

Suresh Datti

0 Kudos

Thanks Suresh,

So when I look in HRP1001, how do I know which positions are just being created?

Thanks,

~Mark

0 Kudos

Hi Mark,

If you want look up directly in the system, use Transaction PP01,select the Org Unit and enter the id you passed to the function module and lcikc on relationships.. all the positions that are under the Org Unit will be shown under the 'incorporated by' relationship(B003). If you want to do it programmatically, you can do it with following SELECT statement.

data: begin of itab occurs 0,

sobid type sobid,

end of itab

select sobid into table itab

from hrp1001

where otype = 'O'

and plvar = '01'

and objid = 'XXXXXXXX' "Org Unit id

and istat = 1

and rsign = 'B'

and relat = '003'

and begda = act_begda

and endda = act_endda.

endselect.

if sy-subrc eq 0.

  • itab will be filled with the newly created position ids.

endif.

Regards,

Suresh Datti

0 Kudos

Hi Suresh,

I have tried selecting from HRP1001 but it does not return me anything. Do you have any idea what might be wrong?

~Mark

0 Kudos

what is the select query you are using,

can you show the code..

vijay

0 Kudos

Hi,

Is there a better function module to create the postions? The problem is that I need to know which position ID was created for the new position. I can search the table HRP1001 with beg and end dates but that leads to problems when I create positions with future starting dates.

Regards,

~Mark

0 Kudos

Hi Mark,

If you problem is with the SELECT on HRP1001, pl paste the code..

Regards,

Suresh Datti

0 Kudos

hi

i will get back to you with some more info...

vijay

Message was edited by: Vijay Babu Dudla

0 Kudos

Hi Mark,

You can also use the function module 'RH_OBJECT_CREATE'. Give the OTYPE = 'S' ,PLVAR = '01', BEGDA & ENDDA. The result will give you the new position id created. Lateron in PP01,Pl be sure to maintain the appropriate relationships for the newly created positions, otherwise, you will not be able to use them.

Regards,

Suresh Datti

0 Kudos

Thanks Suresh,

Is there a way to mantain the relationships in PP01 through a function call as well?

I am trying to create positions without the need to login to SAP GUI.

Thanks,

Mark

0 Kudos

I'm back with some useful stuff.

CALL FUNCTION 'RH_PNNNN_MAINTAIN'

EXPORTING

act_fcode = 'INSE'

act_plvar = act_pnnnn-plvar

act_otype = act_pnnnn-otype

act_objid = act_pnnnn-objid

act_infty = act_pnnnn-infty

act_pnnnn = act_pnnnn

suppress_dialog = '2'

IMPORTING

act_ok_code = act_ok_code

act_pnnnn_out = act_pnnnn_out

act_mess_info = act_mess_info

EXCEPTIONS

infty_not_valid = 1

no_plvar = 2

object_not_defined = 3

otype_not_valid = 4

no_authority = 5

action_rejected = 6

no_gdate = 7

fcode_not_supported = 8

OTHERS = 9.

try this...

vijay

0 Kudos

Hi Mark,

I doubt if you can maintain the relationships via a function module. What exactly are you trying to do? Normally, a position will have the following relationships.

A003 - belongs to an Org Unit

A002 - reports to a higher level position

B007 - is described by a Job

A008 - holder of the position

A012 - Manages an Org Unit

B002 - is line Supervisor of a Position

Your best bet will be to use the RH_CREATE_POSITIONS function module,pass the Org Unit & Job ids and leave the rest for the HR Business Anlysts to mainatin the relevant relationships.

Hope this helps.

Regards,

Suresh Datti

0 Kudos

Hi Suresh,

Here is the bigger picture of what I am trying to do. I have an application that displays the org structures graphically. I have created a function module that spits out the whole org structure and I can successfully display it in the graphical application.

Now if I create a new position in the graphical application, I want to send this information back to SAP via a function call. I basically want to create a position in SAP under a given org unit. For now, it does not need to have a job or a position holder. I can, probably, create more function modules to do that. But for now I am looking for a way to just create a position under an org unit. This will serve as a prototype so I can show that pushing data back to SAP via a third party application is possible.

I hope I have not confused you even more

Regards,

~Mark

0 Kudos

Hi Mark,

In that case, you should stick with RH_CREATE_POSITIONS. Let us go back to the HRP1001 issue; Pl paste your SELECT statement.

Regards,

Suresh Datti

0 Kudos

Let me ask you one more question before we try to resolve the select statemnet issue.

If I create a position that would start in a future date, then how would I get that position ID if I do a select on all the newly created positions?

~Mark

0 Kudos

Hi Mark,

You can pass the date range for begda and need not look for a specific start date in HRP1001 / HRP1000. Alternately, you can use the AEDTM anf go by the date on which the Position was created.

Regards,

Suresh Datti

0 Kudos

below is the select statement that I am using:

select sobid into z_tab

from hrp1001

where otype = 'O'

and plvar = '01'

and objid = '60000252' "Org Unit id

and istat = 1

and rsign = 'B'

and relat = '003'

and aedtm = '12/27/2005'.

  • and begda = '06/01/2005'

  • and endda = '12/31/9999'.

ENDSELECT.

0 Kudos

What is the structure of z_tab? it can be

data: begin of Z_tab occurs 0,

sobid type sobid,

end of z_tab.

select sobid into table z_tab

from hrp1001

where otype = 'O'

and plvar = '01'

and objid = '60000252' "Org Unit id

and istat = 1

and rsign = 'B'

and relat = '003'

and aedtm = '12/27/2005'

and uname = 'XXXXXX". "the user who created the posn

if sy-subrc eq 0.

  • z_tab should have the position ids

endif.

0 Kudos

I have declared Z_TAB as a structure

SOBID SOBID CHAR 45 0 ID of Related Object

I still dont get anything from the query...:(

~Mark

0 Kudos

Mark,

Were you able to see nay entries for the same criteria via SE16 in HRP1001 table? also try this change..

AEDTM = '2001227'.

Regards,

Suresh Datti

0 Kudos

Yes, I do see the entries in the table. Also, AEDTM is the date the postion was "last changed". So wouldn't it also return the old postions that just have been updated?

Regards,

~Mark

0 Kudos

that is the reason I put the UNAME ( User id ) in the where condition.. to be doubly sure you can also pass the BEGDA & ENDDA. Did the SELECT statement work?

Suresh

0 Kudos

No, the select statement does not return anything from that table for some reason...

0 Kudos

the following piece of code works perfect for me...


report  zicn1                                   .

data: begin of z_itab occurs 0,
       sobid type sobid,
      end of z_itab.
select sobid into table z_itab from hrp1001
             where otype = 'O'
               and objid = '01002336'
               and plvar = '01'
               and istat = 1
               and rsign = 'B'
               and relat = '003'
               and aedtm = '20051219'
               and uname =  'SXD0KA1'.
if sy-subrc eq 0.
  loop at z_itab.
    write:/ z_itab-sobid.
  endloop.
endif.

0 Kudos

Hi

check this FM RH_PNNNN_MAINTAIN

this will create positions...

vijay

0 Kudos

Hello suresh

Please tell me if i am wrong.

Actually we can also use PP02 (expert mode) or we can use SAP provided program RHPLOGI for creating new position.

Thanking you

regards

vj

0 Kudos

Hi vj,

You are correct.. but if you read the post from the beginning, you will note that the requirement was to create the Positions from an external system via an RFC call.. the sample report I posted was to demonstrate the functionality of the two function modules.

Regards,

Suresh Datti

0 Kudos

hello suresh

Yeah i saw the post. but i was just checking it.

Thanking you

regards

vj

0 Kudos

Hi

I need to update infotype 1001.

the data I am receiving is from flat file spreadsheet.

For this I am using rh_pnnnn_maintain.

Can you send some sample code How I can pass the values to the above function module.

in the flat file i have a record with the following fields

plvar otype objid infty subty istat begda endda sclas sobid.

thanks

former_member188685
Active Contributor
0 Kudos
FU RH_CREATE_POSITIONS
Functionality
Dialog: positions can be created and assigned to a specified organizational unit. At the same time, the positions can be assigned to a describing job.




Parameters
ACT_ORG_OBJID
ACT_JOB_OBJID
ACT_POSITION_COUNT
ACT_PLVAR
ACT_BEGDA
ACT_ENDDA
ACT_ISTAT

Former Member
0 Kudos

Hi Mark,

Try using F.M. RH_GENERATE_POSITION_AT_ORG

It will create the position with user assigned to it in Org unit which you will pass to this F.M.

Hope this serves the purpose.

Rgeards,

Akshay

P.S. : Pls. reward with points if answer is helpful / solves the problem.

0 Kudos

Hi Akshay,

One of the parameters to this function is the Position_ID. I want to create a new position so how would I give a position ID as the parameter?

Regards,

~Mark