cancel
Showing results for 
Search instead for 
Did you mean: 

Postion creation

Former Member
0 Kudos

Is there any function which can create positions and return position number, so that I will use that position for creating others relationships like org unit, report to, job, cost center, 1002, 1007, 1008, 9103 and 9106?

One action has configured using PP03 to create the above PD infotypes, but the above custom infotype (9106) is dependent on 1007..As Batch input will not create a position for the above action until the end of action..9106 is not properly triggering..

That is why we need some function which can create 1000 and return the position number…

Please throgh the if any one has idea how to do it..

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hi,

just write a BDC code for creating a position through PP02 and once the position is creation BDC is done just write the following code.

DATA : WA_OPTS TYPE CTU_PARAMS.

WA_OPTS-DEFSIZE = 'X'.

WA_OPTS-DISMODE = 'N'.

WA_OPTS-UPDMODE = 'S'.

CALL TRANSACTION 'PP02' USING I_BDCDATA

OPTIONS FROM WA_OPTS

MESSAGES INTO I_BDCMSGCOLL.

SORT I_BDCMSGCOLL BY DYNAME DYNUMB MSGID MSGNR MSGV1 MSGV3.

READ TABLE I_BDCMSGCOLL WITH KEY DYNAME = 'MP100000'

DYNUMB = '2000'

MSGID = '5A'

MSGNR = '035'

MSGV1 = '01'.

IF SY-SUBRC = 0.

V_NEWPOS = I_BDCMSGCOLL-MSGV3.

ENDIF.

so in v_newpos field the newly created positiuon will get populated.

Thanks,

Aditya

suresh_datti
Active Contributor
0 Kudos

Hi Anji,

You can use 'RH_OBJECT_CREATE' to create a new position & 'RH_RELATION_MAINTAIN' to create relationships for that Position.

Regards,

Suresh Datti

suresh_datti
Active Contributor
0 Kudos

here is a sample program that uses the above two function modules..


*&---------------------------------------------------------------------*
*& Report  ZINC1                                                       *
*&                                                                     *
*&---------------------------------------------------------------------*
*&                                                                     *
*&                                                                     *
*&---------------------------------------------------------------------*

report  zinc1.

data: w_objid type hrobjid,
      w_sobid type sobid value '01002533'.
      
call function 'RH_OBJECT_CREATE'
  exporting
    plvar               = '01'
    otype               = 'S'
    stext               = 'TEST'
    begda               = sy-datum
    endda               = '99991231'
  importing
    objid               = w_objid
  exceptions
    text_required       = 1
    invalid_otype       = 2
    invalid_date        = 3
    error_during_insert = 4
    error_ext_number    = 5
    undefined           = 6
    others              = 7.
if sy-subrc eq 0.
  call function 'RH_RELATION_MAINTAIN'
    exporting
      act_fcode           = 'INSE'
      act_plvar           = '01'
      act_otype           = 'S'
      act_objid           = w_objid
      act_rsign           = 'A'
      act_relat           = '003'
      act_sclas           = 'O'  "Obj Type of Orgn Unit
      act_sobid           = w_sobid
    exceptions
      maintainance_failed = 01.

  if sy-subrc = 0.
* relationship mainatined
    write:/ 'Position:', w_objid, 'was created under Org Unit:', w_sobid.
  else.
* relationship wasn't created.

Regards,

Suresh Datti

Former Member
0 Kudos

Thanks Suresh..I have follwed your suggestion it is working fine..

suresh_datti
Active Contributor
0 Kudos

Hi Anji,

Glad I could be of help.. PL mark the thread closed if your question has been completely anwsered... there is no need to award any more points to me...

Regards,

Suresh Datti