cancel
Showing results for 
Search instead for 
Did you mean: 

Function Module for renaming organizational unit

Former Member
0 Kudos

Hello experts,

is there any function module to rename an organizational unit's name? I know org data is stored in table HRP1000 but I assume it is not the correct way to just UPDATE the corresponding column.

In our case the object name of purchasing groups contains the PG's key and the buyer's name (e.g. "123 Mr. Smith"). We want to update this name whenever the backend PG's name changes (table T024 in backend). We don't assign any positions to the PG. Each PG corresponds to exactly one buyer.

regards

José

Accepted Solutions (1)

Accepted Solutions (1)

Former Member

I have found the solution on my own.

It's all about updating the correct infotype by using function module RH_UPDATE_INFTY.

In my case it is the infotype 1000 organizational object.

Short description:

DATA: lt_t024 TYPE TABLE OF ty_t024 WITH KEY ekgrp,
      lv_t024 LIKE LINE OF lt_t024,
      lv_rfc_dest TYPE rfcdest,
      lt_p1000 TYPE TABLE OF p1000,
      lv_p1000 LIKE LINE OF lt_p1000,
      lv_object TYPE hrobject.

1.) Read table T024 in backend to get all purchasing groups

     CALL FUNCTION 'RFC_READ_TABLE' DESTINATION lv_rfc_dest [...]

Loop at lt_t024 into lv_t024

2.) Determine the correspondig orgunits of those purch. groups

    SELECT SINGLE *
      INTO CORRESPONDING FIELDS OF lv_object
      FROM hrv5500a
     WHERE ekgrp = lv_t024-ekgrp
       AND plvar = '01'.

3.) Read the infotype data

      CALL FUNCTION 'RH_READ_INFTY_1000'
      EXPORTING
        plvar         = lv_object-plvar
        otype         = lv_object-otype
        objid         = lv_object-objid
        begda         = sy-datum
        endda         = sy-datum
      TABLES
        i1000         = lt_p1000

4.) Modify the name in infotype

        lv_p1000-stext = lv_name_ekgrp_new.
        MODIFY lt_p1000 FROM lv_p1000.

5.) Update the infotype in buffer

          CALL FUNCTION 'RH_UPDATE_INFTY'
          EXPORTING
            vtask      = 'B' "Buffer

            commit_flg = ' '
            authy      = 'X'
            workf_actv = ' '
          TABLES
            innnn      = lt_p1000.

Endloop.

6.) After all changes are made, write update to the DB

      CALL FUNCTION 'RH_UPDATE_DATABASE'
      EXPORTING
        vtask      = 'S'
        workf_actv = ' '.

Thanks to evertyone who tried to help.

José

Answers (0)