We came across a requirement where there was a need to integrate FI-HR
payroll based on Wage types. But we didn’t found any standard Data source for
this. So we went ahead with the approach shown below to achieve this.
Hope it helps anyone who have to deal with such scenario.
Our client required details of all the Ad-hoc documents which are posted in
FI based on posting made in Payroll Wage types.
According to the requirement, based on Country Grouping (MOLGA) and Wage
Type(LGART), Symbolic Account(SYMKO) needs to be fetched from Wage types table
T52EL. Now the Symbolic Account which we receive from wages table needs to be
passed on to Accounts Table(T030) and compared with Valuation Grouping Code by
providing Cost Centers and Transition Key selections.
Accounts table will give us the GL accounts based on Wage Type and Country
Grouping by above requirement. Now the task is to get the Documents from the GL
Accounts which we receive from Accounts table. Further GL accounts identified
from Accounts table can be passed onto BSEG/BKPF table to get the required
Accounting Document Number.
To accomplish the above requirement where FI and Payroll tables are required
to be mapped, we have to search for an extractor which matches the fields from
Wage and Accounts table, but we don’t have any such data source. So we went
ahead for below options:
1) Creating Custom DS based on View for T52EL and T030 tables.
Not Possible cause T030 is not a transparent table.
2) Creating Custom DS based on FM for T52EL and T030 tables.
Not allowed again since we need to use join operation from these table in FM
coding which again stopped us since T030 is not a transparent table.
3) Creating 3 Custom DS and apply Lookup between them to get the output.
Possible, but we went with a simpler way:
4) Using Payroll Data Standard DS (0HR_PY_1_CE) and enhancing it for fields
GL Account (ZZ_KONTS) and Symbolic Account (ZZ_SYMKO).
Now based on the requirement, we have a standard Data source which we can use
to map our HR table which is T52EL and table in which FI posting are being made
which is T030.
The next task is to create logic for the enhanced fields:
TYPES: BEGIN OF ty_t52el,
molga TYPE molga,
lgart TYPE lgart,
symko TYPE P_KOMOK40,
END OF ty_t52el.
DATA: it_t52el TYPE STANDARD TABLE OF ty_t52el,
wa_t52el type ty_t52el.
TYPES: BEGIN OF ty_t030,
ktopl TYPE ktopl,
ktosl TYPE ktosl,
bwmod TYPE bwmod,
konts type SAKNR,
END OF ty_t030.
DATA: it_t030 TYPE STANDARD TABLE OF ty_t030,
wa_t030 type ty_t030.
FIELD-SYMBOLS: <fs_0HR_PY_1_CE> TYPE HRCCE_HRMS_BIW_PY1.
select molga lgart symko from t52el
into table it_t52el where
molga = ‘AE’ and
lgart like ‘2%’.
select ktopl ktosl bwmod konts
from t030 into table it_t030
where ( ktosl = ‘HRC’ or
ktosl = ‘HRF’ )
and ktopl = ‘1000’.
LOOP AT c_t_data ASSIGNING <FS_0HR_PY_1_CE>.
READ TABLE it_t52el INTO wa_t52el WITH KEY molga = <FS_0HR_PY_1_CE>-molga
lgart = <FS_0HR_PY_1_CE>-lgart.
IF sy-subrc = 0.
<FS_0HR_PY_1_CE>-zz_symko = wa_t52el-symko.
LOOP AT it_t030 into wa_t030 where bwmod = <FS_0HR_PY_1_CE>-zz_symko.
IF sy-subrc = 0.
<FS_0HR_PY_1_CE>-zz_konts = wa_t030-konts.
<FS_0HR_PY_1_CE>-zz_ktosl = wa_t030-ktosl.
Create a DSO based on the 0HR_PY_1_CE Data source which will provide us the
required GL accounts based on T52EL and T030 tables.
We need to get Accounting Document Number from the identified GL accounts from
BSEG table, so we can do a lookup based on Info providers on top of 0FI_GL_40
DS which takes postings from BSEG table.
Providing the lookup logic below:
types: begin of ty_/BIC/AZFI_O6940,
comp_code type /BI0/OICOMP_CODE,
gl_account type /BI0/OIGL_ACCOUNT,
co_area type /BI0/OICO_AREA,
costcenter type /BI0/OICOSTCENTER,
end of ty_/BIC/AZFI_O6940.
DATA: it_ty_/BIC/AZFI_O6940 type standard table of ty_/BIC/AZFI_O6940,
wa_ty_/BIC/AZFI_O6940 type ty_/BIC/AZFI_O6940.
DATA: itab_target type standard table of _ty_s_TG_1,
wa_target type _ty_s_TG_1.
GL_ACCOUNT co_area costcenter
FOR ALL ENTRIES IN
GL_ACCOUNT = RESULT_PACKAGE-GL_ACCOUNT.
LOOP AT RESULT_PACKAGE ASSIGNING <RESULT_FIELDS>.
READ table it_ty_/BIC/AZFI_O6940 into wa_ty_/BIC/AZFI_O6940 with
GL_ACCOUNT = <RESULT_FIELDS>-GL_ACCOUNT.
IF sy-subrc = 0.
<RESULT_FIELDS>-GL_ACCOUNT = wa_ty_/BIC/AZFI_O6940-GL_ACCOUNT.
append <RESULT_FIELDS> to itab_target.
RESULT_PACKAGE = itab_target.
In this way we can achieve the required Accounting Document Number.