SAP Function Modules

GET_MASTER_COST_ASSIGNMENT SAP Function module







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

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


Pattern for FM GET_MASTER_COST_ASSIGNMENT - GET MASTER COST ASSIGNMENT





CALL FUNCTION 'GET_MASTER_COST_ASSIGNMENT' "
  EXPORTING
    employeenumber =            " pernr_d       Personnel Number
*   tripnumber =                " reinr
*   begin_date =                " rebed
*   end_date =                  " reend
*   budat =                     " dats
*   messages_as_warning =       " char1
*   called_in_pbo =             " char1
  TABLES
    konti =                     " ptk17         Assignment Values for HR Objects
    kostr_stamm =               " kostr_stamm   Percent Distribution of Travel Expen.-Master Account Assign.
*   infotyp0001 =               " p0001         Infotype 0001
*   infotyp0017 =               " p0017         Infotype 0017
*   infotyp0027 =               " p0027
*   cobl_messages =             " bapiret2
  EXCEPTIONS
    ERROR_IN_COBL_CHECK = 1     "               Error in check of master account assignment
    INCOMPLETE = 2              "
    INFOTYPE_AMBIGUOUS = 3      "
    NO_MCA_FOUND = 4            "
    .  "  GET_MASTER_COST_ASSIGNMENT

ABAP code example for Function Module GET_MASTER_COST_ASSIGNMENT





The ABAP code below is a full code listing to execute function module GET_MASTER_COST_ASSIGNMENT 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:
it_konti  TYPE STANDARD TABLE OF PTK17,"TABLES PARAM
wa_konti  LIKE LINE OF it_konti ,
it_kostr_stamm  TYPE STANDARD TABLE OF KOSTR_STAMM,"TABLES PARAM
wa_kostr_stamm  LIKE LINE OF it_kostr_stamm ,
it_infotyp0001  TYPE STANDARD TABLE OF P0001,"TABLES PARAM
wa_infotyp0001  LIKE LINE OF it_infotyp0001 ,
it_infotyp0017  TYPE STANDARD TABLE OF P0017,"TABLES PARAM
wa_infotyp0017  LIKE LINE OF it_infotyp0017 ,
it_infotyp0027  TYPE STANDARD TABLE OF P0027,"TABLES PARAM
wa_infotyp0027  LIKE LINE OF it_infotyp0027 ,
it_cobl_messages  TYPE STANDARD TABLE OF BAPIRET2,"TABLES PARAM
wa_cobl_messages  LIKE LINE OF it_cobl_messages .

DATA(ld_employeenumber) = 'Check type of data required'.
DATA(ld_tripnumber) = 'Check type of data required'.
DATA(ld_begin_date) = 'Check type of data required'.
DATA(ld_end_date) = 'Check type of data required'.
DATA(ld_budat) = 'Check type of data required'.
DATA(ld_messages_as_warning) = 'Check type of data required'.
DATA(ld_called_in_pbo) = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_konti to it_konti.

"populate fields of struture and append to itab
append wa_kostr_stamm to it_kostr_stamm.

"populate fields of struture and append to itab
append wa_infotyp0001 to it_infotyp0001.

"populate fields of struture and append to itab
append wa_infotyp0017 to it_infotyp0017.

"populate fields of struture and append to itab
append wa_infotyp0027 to it_infotyp0027.

"populate fields of struture and append to itab
append wa_cobl_messages to it_cobl_messages. . CALL FUNCTION 'GET_MASTER_COST_ASSIGNMENT' EXPORTING employeenumber = ld_employeenumber * tripnumber = ld_tripnumber * begin_date = ld_begin_date * end_date = ld_end_date * budat = ld_budat * messages_as_warning = ld_messages_as_warning * called_in_pbo = ld_called_in_pbo TABLES konti = it_konti kostr_stamm = it_kostr_stamm * infotyp0001 = it_infotyp0001 * infotyp0017 = it_infotyp0017 * infotyp0027 = it_infotyp0027 * cobl_messages = it_cobl_messages EXCEPTIONS ERROR_IN_COBL_CHECK = 1 INCOMPLETE = 2 INFOTYPE_AMBIGUOUS = 3 NO_MCA_FOUND = 4 . " GET_MASTER_COST_ASSIGNMENT
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 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_employeenumber  TYPE PERNR_D ,
it_konti  TYPE STANDARD TABLE OF PTK17 ,
wa_konti  LIKE LINE OF it_konti,
ld_tripnumber  TYPE REINR ,
it_kostr_stamm  TYPE STANDARD TABLE OF KOSTR_STAMM ,
wa_kostr_stamm  LIKE LINE OF it_kostr_stamm,
ld_begin_date  TYPE REBED ,
it_infotyp0001  TYPE STANDARD TABLE OF P0001 ,
wa_infotyp0001  LIKE LINE OF it_infotyp0001,
ld_end_date  TYPE REEND ,
it_infotyp0017  TYPE STANDARD TABLE OF P0017 ,
wa_infotyp0017  LIKE LINE OF it_infotyp0017,
ld_budat  TYPE DATS ,
it_infotyp0027  TYPE STANDARD TABLE OF P0027 ,
wa_infotyp0027  LIKE LINE OF it_infotyp0027,
ld_messages_as_warning  TYPE CHAR1 ,
it_cobl_messages  TYPE STANDARD TABLE OF BAPIRET2 ,
wa_cobl_messages  LIKE LINE OF it_cobl_messages,
ld_called_in_pbo  TYPE CHAR1 .

ld_employeenumber = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_konti to it_konti.
ld_tripnumber = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_kostr_stamm to it_kostr_stamm.
ld_begin_date = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_infotyp0001 to it_infotyp0001.
ld_end_date = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_infotyp0017 to it_infotyp0017.
ld_budat = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_infotyp0027 to it_infotyp0027.
ld_messages_as_warning = 'Check type of data required'.

"populate fields of struture and append to itab
append wa_cobl_messages to it_cobl_messages.
ld_called_in_pbo = '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 GET_MASTER_COST_ASSIGNMENT or its description.