SAP Function Modules

HR_BG_FROM_COSTCENTER SAP Function module







HR_BG_FROM_COSTCENTER 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 HR_BG_FROM_COSTCENTER into the relevant SAP transaction such as SE37 or SE80.

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


Pattern for FM HR_BG_FROM_COSTCENTER - HR BG FROM COSTCENTER





CALL FUNCTION 'HR_BG_FROM_COSTCENTER' "
  EXPORTING
    co_object =                 " ptdb1
    angest =                    " xfeld
    azubi =                     " xfeld
    begda =                     " begda
*   endda = DEFAULT_ENDDA       " endda
  IMPORTING
    v0bg =                      " hrpayde_v0bg
    id =                        " p01b_bauid
    nr =                        " p01b_baunr
    txt =                       " p01b_ktext
  EXCEPTIONS
    BAUST_NO_RELEVANT_KEY = 1   "
    BAUST_NO_ENTRY_T5DB4 = 2    "
    BAUST_NO_ENTRY_T5DB5 = 3    "
    BAUST_NO_ENTRY_T5DB6 = 4    "
    BAUST_NO_ENTRY_PRPS = 5     "
    BAUST_NO_ENTRY_AUFK = 6     "
    BAUST_NO_ENTRY_VBUK = 7     "
    BAUST_NO_ENTRY_CKPH = 8     "
    BAUST_UNKNOWN_ERROR = 9     "
    NO_ENTRY_T5D3P = 10         "
    MISSING_BG_DATA_T5D3P = 11  "
    MISSING_BG_DATA_T5DB4 = 12  "
    .  "  HR_BG_FROM_COSTCENTER

ABAP code example for Function Module HR_BG_FROM_COSTCENTER





The ABAP code below is a full code listing to execute function module HR_BG_FROM_COSTCENTER 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_v0bg  TYPE HRPAYDE_V0BG ,
ld_id  TYPE P01B_BAUID ,
ld_nr  TYPE P01B_BAUNR ,
ld_txt  TYPE P01B_KTEXT .

DATA(ld_co_object) = 'Check type of data required'.
DATA(ld_angest) = 'Check type of data required'.
DATA(ld_azubi) = 'Check type of data required'.
DATA(ld_begda) = 'Check type of data required'.
DATA(ld_endda) = 'Check type of data required'. . CALL FUNCTION 'HR_BG_FROM_COSTCENTER' EXPORTING co_object = ld_co_object angest = ld_angest azubi = ld_azubi begda = ld_begda * endda = ld_endda IMPORTING v0bg = ld_v0bg id = ld_id nr = ld_nr txt = ld_txt EXCEPTIONS BAUST_NO_RELEVANT_KEY = 1 BAUST_NO_ENTRY_T5DB4 = 2 BAUST_NO_ENTRY_T5DB5 = 3 BAUST_NO_ENTRY_T5DB6 = 4 BAUST_NO_ENTRY_PRPS = 5 BAUST_NO_ENTRY_AUFK = 6 BAUST_NO_ENTRY_VBUK = 7 BAUST_NO_ENTRY_CKPH = 8 BAUST_UNKNOWN_ERROR = 9 NO_ENTRY_T5D3P = 10 MISSING_BG_DATA_T5D3P = 11 MISSING_BG_DATA_T5DB4 = 12 . " HR_BG_FROM_COSTCENTER
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 ELSEIF SY-SUBRC EQ 8. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 9. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 10. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 11. "Exception "Add code for exception here ELSEIF SY-SUBRC EQ 12. "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_v0bg  TYPE HRPAYDE_V0BG ,
ld_co_object  TYPE PTDB1 ,
ld_id  TYPE P01B_BAUID ,
ld_angest  TYPE XFELD ,
ld_nr  TYPE P01B_BAUNR ,
ld_azubi  TYPE XFELD ,
ld_txt  TYPE P01B_KTEXT ,
ld_begda  TYPE BEGDA ,
ld_endda  TYPE ENDDA .

ld_co_object = 'Check type of data required'.
ld_angest = 'Check type of data required'.
ld_azubi = 'Check type of data required'.
ld_begda = 'Check type of data required'.
ld_endda = 'Check type of data required'.

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 HR_BG_FROM_COSTCENTER or its description.