SAP Function Modules

RH_GENERATE_POSITION_AT_ORG SAP Function module







RH_GENERATE_POSITION_AT_ORG is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name RH_GENERATE_POSITION_AT_ORG into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: RHW0_EC
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM RH_GENERATE_POSITION_AT_ORG - RH GENERATE POSITION AT ORG





CALL FUNCTION 'RH_GENERATE_POSITION_AT_ORG' "
  EXPORTING
*   act_holder_type = 'US'      " hrobject-otype
*   act_holder = SY-UNAME       "
    act_orgunit =               " hrobject-objid
*   act_plvar =                 " hrobject-plvar  Plan Version
*   act_begda = SY-DATUM        " objec-begda
*   act_endda = '99991231'      " objec-endda
*   act_job =                   " hrobject-objid
*   is_manager =                " flag
*   new_org_stext =             " objec-stext
*   new_org_short =             " objec-short
*   position_id = '00000000'    " objec-objid
*   commit_flg = 'X'            " hrrhap-commit_flg
*   workf_actv = 'X'            " hrrhap-workf_actv  Event creation switch for updating database
  IMPORTING
    act_position =              " hrobject-objid
    new_org_id =                " hrobject-objid
* TABLES
*   neworg_innnnexp =           "
*   newpos_innnnexp =           "
  EXCEPTIONS
    ORGUNIT_NOT_VALID = 1       "
    HOLDER_NOT_VALID = 2        "
    NO_ACTIVE_PLVAR = 3         "
    ERROR_TO_GET_NEW_NUMBER = 4  "
    ERROR_DURING_INSERT = 5     "               Error writing to the database
    HOLDER_ALREADY_ASSIGNED = 6  "
    ENQUEUE_ERROR = 7           "               Locking Error
    .  "  RH_GENERATE_POSITION_AT_ORG

ABAP code example for Function Module RH_GENERATE_POSITION_AT_ORG





The ABAP code below is a full code listing to execute function module RH_GENERATE_POSITION_AT_ORG including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
ld_act_position  TYPE HROBJECT-OBJID ,
ld_new_org_id  TYPE HROBJECT-OBJID ,
it_neworg_innnnexp  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_neworg_innnnexp  LIKE LINE OF it_neworg_innnnexp ,
it_newpos_innnnexp  TYPE STANDARD TABLE OF STRING,"TABLES PARAM
wa_newpos_innnnexp  LIKE LINE OF it_newpos_innnnexp .


DATA(ld_act_holder_type) = some text here
DATA(ld_act_holder) = 'some text here'.

DATA(ld_act_orgunit) = Check type of data required

DATA(ld_act_plvar) = some text here

DATA(ld_act_begda) = 20210129

DATA(ld_act_endda) = 20210129

DATA(ld_act_job) = Check type of data required
DATA(ld_is_manager) = 'Check type of data required'.

DATA(ld_new_org_stext) = some text here

DATA(ld_new_org_short) = some text here

DATA(ld_position_id) = Check type of data required

DATA(ld_commit_flg) = some text here

DATA(ld_workf_actv) = some text here

"populate fields of struture and append to itab
append wa_neworg_innnnexp to it_neworg_innnnexp.

"populate fields of struture and append to itab
append wa_newpos_innnnexp to it_newpos_innnnexp. . CALL FUNCTION 'RH_GENERATE_POSITION_AT_ORG' EXPORTING * act_holder_type = ld_act_holder_type * act_holder = ld_act_holder act_orgunit = ld_act_orgunit * act_plvar = ld_act_plvar * act_begda = ld_act_begda * act_endda = ld_act_endda * act_job = ld_act_job * is_manager = ld_is_manager * new_org_stext = ld_new_org_stext * new_org_short = ld_new_org_short * position_id = ld_position_id * commit_flg = ld_commit_flg * workf_actv = ld_workf_actv IMPORTING act_position = ld_act_position new_org_id = ld_new_org_id * TABLES * neworg_innnnexp = it_neworg_innnnexp * newpos_innnnexp = it_newpos_innnnexp EXCEPTIONS ORGUNIT_NOT_VALID = 1 HOLDER_NOT_VALID = 2 NO_ACTIVE_PLVAR = 3 ERROR_TO_GET_NEW_NUMBER = 4 ERROR_DURING_INSERT = 5 HOLDER_ALREADY_ASSIGNED = 6 ENQUEUE_ERROR = 7 . " RH_GENERATE_POSITION_AT_ORG
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 2. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 3. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 4. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 5. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 6. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 7. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_act_position  TYPE HROBJECT-OBJID ,
ld_act_holder_type  TYPE HROBJECT-OTYPE ,
it_neworg_innnnexp  TYPE STANDARD TABLE OF STRING ,
wa_neworg_innnnexp  LIKE LINE OF it_neworg_innnnexp,
ld_new_org_id  TYPE HROBJECT-OBJID ,
ld_act_holder  TYPE STRING ,
it_newpos_innnnexp  TYPE STANDARD TABLE OF STRING ,
wa_newpos_innnnexp  LIKE LINE OF it_newpos_innnnexp,
ld_act_orgunit  TYPE HROBJECT-OBJID ,
ld_act_plvar  TYPE HROBJECT-PLVAR ,
ld_act_begda  TYPE OBJEC-BEGDA ,
ld_act_endda  TYPE OBJEC-ENDDA ,
ld_act_job  TYPE HROBJECT-OBJID ,
ld_is_manager  TYPE FLAG ,
ld_new_org_stext  TYPE OBJEC-STEXT ,
ld_new_org_short  TYPE OBJEC-SHORT ,
ld_position_id  TYPE OBJEC-OBJID ,
ld_commit_flg  TYPE HRRHAP-COMMIT_FLG ,
ld_workf_actv  TYPE HRRHAP-WORKF_ACTV .


ld_act_holder_type = some text here

"populate fields of struture and append to itab
append wa_neworg_innnnexp to it_neworg_innnnexp.
ld_act_holder = 'some text here'.

"populate fields of struture and append to itab
append wa_newpos_innnnexp to it_newpos_innnnexp.

ld_act_orgunit = Check type of data required

ld_act_plvar = some text here

ld_act_begda = 20210129

ld_act_endda = 20210129

ld_act_job = Check type of data required
ld_is_manager = 'Check type of data required'.

ld_new_org_stext = some text here

ld_new_org_short = some text here

ld_position_id = Check type of data required

ld_commit_flg = some text here

ld_workf_actv = some text here

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name RH_GENERATE_POSITION_AT_ORG or its description.