0

I am working on one of our HR system which have integration with SAP, I am using SAP Connector for Microsoft .NET 3.0 and it's working fine for getting basic employee data using BAPI_EMPLOYEE_GETDATA function module.

I wants to know is there any function module in SAP to get employee transport and accommodation allowances.

Suncatcher
  • 10,355
  • 10
  • 52
  • 90
  • do you know where it is located in SAP? give a screenshot, pls – Suncatcher Jul 21 '22 at 12:58
  • T-Code se37, in function module enter "BAPI_EMPLOYEE_GETDATA " , it will give all details like input, output, tables associated and also you can execute module. – Naseer Ahmed Jul 22 '22 at 06:40
  • I believe @Suncatcher was asking about where in the system you see "transportation and accommodation allowances". The reason is that there are several ways how you could implement such things in SAP, and depending on how it was implemented, you would access it in different ways. – Philipp Jul 22 '22 at 08:51
  • yes, Philip is correct. I know about the `PR05` tcode where travel expenses are recorded, but it has plenty of indicators, so I'm not sure that field I'm thinking about is the exact field you need, that you call "allowance". Do you have an idea idea how this data is stored in SAP or it is a functional question "how to extract and where to find employee allowance in SAP HR?" – Suncatcher Jul 22 '22 at 09:56
  • @Suncatcher, I don't have much idea about SAP, it is more like functional question where should I look in SAP to extract these data. – Naseer Ahmed Jul 25 '22 at 05:27

1 Answers1

0

As far as I know there is no single allowance value for employee in SAP HR. They can be set per diem, per expense type, per country destination, etc.

The most simple and obviuos setting that came to my mind is Define Maximum Rates and Default Values for Expense Types, which is stored in V_T706B2 customizing view

enter image description here

Here you can configure defaults, errors and warnings for expense receipts. Here is the excerpt from help:

In this IMG activity, you define maximum rates depending on the trip provision variant and trip expense type for individual receipts. For the differentiation of maximum rates within a trip expense type, the following parameters are available:
•Statutory and enterprise-specific trip types
•Trip activity type
•Trip country and trip region
•Statutory and enterprise-specific reimbursement group for meals and accommodations

Key piece here is individual receipts, you gotta understand that travel expenses in SAP are settled per trip per destination per receipt. So it may be dozens of receipts in the single trip.

The botton line: the total allowance value per employee (per day/month/year) that you want, may not be available out of the box in SAP ERP and is coded/customized by each client. I saw multiple ways to implement it, but none of them are standard so I will not give them here. In case you are not sure which allowance type do you need, it's better to ask your customer directly about it.

The snippet how to fetch the above Maximum Rates and Default Values for Expense Types is based on standard module RFC_READ_TABLE for querying SAP tabular data.

Here we fetch T706B2 table but I want to highlight it is not equivalent to V_T706B2 view, ideally you must create a database view wrapper for V_T706B2 view and fetch it, however this may not be feasible on your system due to security policy.

The query is context-dependent and here you must know many parameters like travel provision plan MOREI, expense type SPKZL and maybe others. They should be provided by your business analyst, I give this snippet only as a reference (!), it may not be suited for your particular case.

DATA: obj_data   TYPE REF TO data,
      lt_options TYPE TABLE OF rfc_db_opt,
      ls_option  TYPE rfc_db_opt,
      lt_fields  TYPE TABLE OF rfc_db_fld,
      ls_field   TYPE rfc_db_fld,
      lt_entries TYPE STANDARD TABLE OF tab512.

   FIELD-SYMBOLS: <fs_tab> TYPE STANDARD TABLE.

  TRY.

      ls_option-text = ` MOREI = '01' AND SPKZL = 'ABZA' AND BEGDA >= '20220101' AND ENDDA <= '20221231' `.
      APPEND ls_option TO lt_options.
      ls_field-fieldname = 'MOREI'.
      APPEND ls_field TO lt_fields.
      ls_field-fieldname = 'SPKZL'.
      APPEND ls_field TO lt_fields.

      CALL FUNCTION 'RFC_READ_TABLE'
        EXPORTING
          query_table = 'T706B2'
        TABLES
          options     = lt_options
          fields      = lt_fields
          data        = lt_entries.

    CATCH CX_SY_DYNAMIC_OSQL_SYNTAX INTO DATA(oref).
      DATA(text) = oref->get_text( ).
      MESSAGE text TYPE 'E'.
  ENDTRY.

It is an ABAP snippet, to wrap it for SAP .Net Connector check this answer.

Suncatcher
  • 10,355
  • 10
  • 52
  • 90