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

Creating relationship between org unit and position

Former Member
0 Likes
905

Hi Gurus,

i was tasked with the request to create a relation between org unit and position. i have tried the bapi RH_RELATION_MAINTAIN

to create the relationship. but it comes with the error that: Object 01 0 10003839 does not exist. below is how i used the bapi:

data:lc_plvar type plvar value '01',

lc_postype type otype value 'S',

lc_stat type ISTAT_D value '1',

lc_endda type datum value '99991231',

lc_histo type histo,

lc_short type p1000-short,

lc_stext type p1000-stext.

*..aproover define.

data: lc_sclas type p1001-sclas value 'S', "Type of related Object

plans type plans,

sobid type p1001-sobid.

select single * from t777e

where clas1 = 'O'

and relat = relats

and clas2 = 'S'

and rsign = codes.

if sy-subrc = 0.

*..set the org unit..

move 'O' to parent_pos-otype.

CALL FUNCTION 'RH_RELATION_MAINTAIN'

EXPORTING

ACT_FCODE = 'INSE'

ACT_PLVAR = parent_pos-plvar

ACT_OTYPE = parent_pos-otype

ACT_OBJID = other_pos

ACT_ISTAT = parent_pos-istat

ACT_RSIGN = codes

ACT_RELAT = relats

ACT_SCLAS = lc_sclas

ACT_SOBID = cord_pos

ACT_BEGDA = sy-datum

ACT_ENDDA = lc_endda

EXCEPTIONS

MAINTAINANCE_FAILED = 1

OTHERS = 2.

endif.

can you guys tell me what i may be doing wrong? or is something i need to do before i can the bapi? please help....

Thanks in advance

Themba

1 ACCEPTED SOLUTION
Read only

mvoros
Active Contributor
0 Likes
758

Hi,

first, RH_RELATION_MAINTAIN is not BAPI. Anyway, it looks like you get that message after call of FM RH_READ_OBJECT. 01 is plan version, 0 is object type and 10003839 is object key. Just try to debug this FM to see where you are getting an error. It looks like an issue with your data.

Cheers

Hi Gurus,

i was tasked with the request to create a relation between org unit and position. i have tried the bapi RH_RELATION_MAINTAIN

to create the relationship. but it comes with the error that: Object 01 0 10003839 does not exist. below is how i used the bapi:

data:lc_plvar type plvar value '01',

lc_postype type otype value 'S',

lc_stat type ISTAT_D value '1',

lc_endda type datum value '99991231',

lc_histo type histo,

lc_short type p1000-short,

lc_stext type p1000-stext.

*..aproover define.

data: lc_sclas type p1001-sclas value 'S', "Type of related Object

plans type plans,

sobid type p1001-sobid.

select single * from t777e

where clas1 = 'O'

and relat = relats

and clas2 = 'S'

and rsign = codes.

if sy-subrc = 0.

*..set the org unit..

move 'O' to parent_pos-otype.

CALL FUNCTION 'RH_RELATION_MAINTAIN'

EXPORTING

ACT_FCODE = 'INSE'

ACT_PLVAR = parent_pos-plvar

ACT_OTYPE = parent_pos-otype

ACT_OBJID = other_pos

ACT_ISTAT = parent_pos-istat

ACT_RSIGN = codes

ACT_RELAT = relats

ACT_SCLAS = lc_sclas

ACT_SOBID = cord_pos

ACT_BEGDA = sy-datum

ACT_ENDDA = lc_endda

EXCEPTIONS

MAINTAINANCE_FAILED = 1

OTHERS = 2.

endif.

can you guys tell me what i may be doing wrong? or is something i need to do before i can the bapi? please help....

Thanks in advance

Themba

3 REPLIES 3
Read only

mvoros
Active Contributor
0 Likes
759

Hi,

first, RH_RELATION_MAINTAIN is not BAPI. Anyway, it looks like you get that message after call of FM RH_READ_OBJECT. 01 is plan version, 0 is object type and 10003839 is object key. Just try to debug this FM to see where you are getting an error. It looks like an issue with your data.

Cheers

Read only

Former Member
0 Likes
758

Hi,

Please try.


  DATA: lt_hrp1001 TYPE STANDARD TABLE OF P1001.

  DATA: lw_hrp1001        TYPE p1001.

  lw_hrp1001-mandt = sy-mandt.
  lw_hrp1001-plvar = parent_pos-plvar.
  lw_hrp1001-otype = parent_pos-otype.
  lw_hrp1001-objid = other_pos.
  lw_hrp1001-istat = parent_pos-istat.
  lw_hrp1001-begda = sy-datum.
  lw_hrp1001-endda = lc_endda.

  lw_hrp1001-infty = '1001'.
  lw_hrp1001-aedtm = sy-datum.
  lw_hrp1001-uname = sy-uname.
  lw_hrp1001-rsign = codes.
  lw_hrp1001-relat = relats.
  lw_hrp1001-sclas = lc_sclas.
  lw_hrp1001-sobid = cord_pos.
  append lw_hrp1001 to lt_hrp1001.


      CALL FUNCTION 'RH_INSERT_INFTY'
        EXPORTING
          fcode               = 'INSE'
          vtask               = 'S'
          commit_flg          = 'X'
        TABLES
          innnn               = lt_hrp1001
        EXCEPTIONS
          no_authorization    = 1
          error_during_insert = 2
          repid_form_initial  = 3
          corr_exit           = 4
          begda_greater_endda = 5
          OTHERS              = 6.

Hope this helps.

regards,

Xiang Li

Read only

Former Member
0 Likes
758

Thanks actually both of the response they are correct. Thanks for the effort. i will locate points accordingly.