Copyright 2024 - BV TallVision IT

Partnerships between object ID's are described in infotype 1001 and 1055, which can be found in tables HRP1001 and HRP1055. This article shows how these tables can be manupilated.

Function module RH_INSERT_INFTY can do the task, with a little care and preperation. Here's an example:

DATA: BEGIN OF lw_vdata,
        type(2),
        id(8),
        chara(4),
        exper(2),
      END OF lw_vdata,
      lt_pplog TYPE STANDARD TABLE OF pplog,
      lw_pplog TYPE pplog.

    lw_pplog-plvar = co_planvariant.
    lw_pplog-otype = co_qualification_bundle.
    lw_pplog-objid = qualification_bundle.
    lw_pplog-infty = '1055'.
    lw_pplog-istat = co_planningstatus.
    lw_pplog-aedtm = sy-datum.
    lw_pplog-uname = sy-uname.

    lw_pplog-begda = gw_record-effdate.
    lw_pplog-endda = co_end_of_times.

* Compose the vdata key, as a character string:
    CLEAR: lw_vdata.
    lw_vdata-type = qmotype.
    lw_vdata-id = qmobjid.
    lw_vdata-chara = lv_chara.
    lw_vdata-exper = lv_exper.
    lw_pplog-vdata = lw_vdata.
    CLEAR: lt_pplog[].
    APPEND lw_pplog TO lt_pplog.

      CALL FUNCTION 'RH_INSERT_INFTY'
        EXPORTING
          vtask  = 'S'
        TABLES
          innnn  = lt_pplog
        EXCEPTIONS
          OTHERS = 4. 

The constants that were used here are for a relation from Bundle (QB) to the qualification (Q)

CONSTANTS: co_end_of_times TYPE hrp1000-endda VALUE '99991231',
           co_planvariant TYPE plvar VALUE '01',
           co_planningstatus TYPE istat_d VALUE '1', "Active
           co_qualification_bundle TYPE otype VALUE 'QB',
           co_qualification TYPE otype VALUE 'Q '.

Relations can just as easily be broken via RH_DELETE_INFTY and if a new bundle or qualification needs to be created first, use HRIQ_OBJECT_CREATE.

For 1001 relations the function module RH_RELATION_WRITE can be used. In the example below the existance of the relation is first checked after which the relation is created:

* populate the fields on lw_hri1001 ...
* Check whether such relation is aready available:
    SELECT SINGLE objid FROM hrp1001 INTO lw_hri1001-objid
      WHERE otype = lw_hri1001-otype AND
            objid = lw_hri1001-objid AND
            plvar = lw_hri1001-plvar AND
            rsign = lw_hri1001-rsign AND
            relat = lw_hri1001-relat AND
            istat = lw_hri1001-istat AND
            priox = lw_hri1001-priox AND
            begda = lw_hri1001-begda AND
            endda = lw_hri1001-endda AND
            varyf = lw_hri1001-varyf AND
            seqnr = lw_hri1001-seqnr.
    IF sy-subrc = 0.
      MESSAGE 'Relation already available' TYPE 'S'. 
    ELSE.
      APPEND lw_hri1001 TO lt_hri1001.
      CALL FUNCTION 'RH_RELATION_WRITE'
        EXPORTING
          vtask                = 'D'
        TABLES
          relation             = lt_hri1001
        EXCEPTIONS
          no_authority         = 1
            ....
          OTHERS               = 8.
    ENDIF.