As a BW Consultant, in your project you may require to enhancement the standard master data info objects as per your business requirements. This happens more often in HR space. Here I am providing you with an example of how easily you can enhance 0EMPLOYEE_ATTR data source with additional attributes.
As you can see from the above pic-1 i would like to enhance 0employee_attr data source with these additional attributes to make the data more meaningful. My scenario is to identify these additional attributes when an employee is acting on a different position (higher duties).
I will not list all the necessary steps involved in this process. but i will provide you a working ABAP user exit code which you can use as a reference in your projects.
I've the requirement to enhance 0EMPLOYEE_ATTR data source in ERP side to extract the following additional information.
Pic-1 - Employee Attributes Data Source |
I wrote my ABAP code in an include program instead of directly in the CMOD include.
*----------------------------------------------------------------------** INCLUDE ZBW_EXIT_0EMPLOYEE_ATTR **----------------------------------------------------------------------*CONSTANTS:c_missing(10) VALUE '-1',c_end_date LIKE sy-datum VALUE '99991231'.DATA: wa_emp LIKE hrms_biw_io_occupancy, "Work areawa_p509 LIKE pa0509,v_sobid LIKE hrp1001-sobid, "Object IDw_hda_exist(1). "HD flagDATA: w_seqno(3) TYPE n,w_salary(5) TYPE p DECIMALS 2,w_ind LIKE p0008-ind01.DATA: w_lga01 LIKE p0008-lga01.* Annual salary wage type detailsDATA: BEGIN OF t_ptbindbw OCCURS 0,seqnr(3) TYPE n.INCLUDE STRUCTURE ptbindbw.DATA: END OF t_ptbindbw.CLEAR: wa_emp.LOOP AT i_t_data INTO wa_emp.l_tabix = sy-tabix.* Clear the HDA exist flagclear: w_hda_exist.* Check if emp has a higher duty entry in PA0509.CLEAR: wa_p509.SELECT SINGLE * FROM pa0509 INTO wa_p509WHERE pernr = wa_emp-pernrAND begda LE wa_emp-enddaAND endda GE wa_emp-endda.IF sy-subrc EQ 0. "Higher Duty existsw_hda_exist = 'X'.* Get company code, controlling area and cost centreSELECT SINGLE bukrs kokrs kostl FROM zhrv1018INTO (wa_emp-zzhdcoid, wa_emp-zzhdkokrs, wa_emp-zzhdkostl)WHERE plvar = '01'AND otype = 'S'AND objid = wa_p509-plansAND subty = ''AND istat = '1'AND dateto = '99991231'.* Get Position's Org unitSELECT SINGLE sobid FROM hrp1001INTO v_sobidWHERE otype = 'S'AND objid = wa_p509-plansAND plvar = '01'AND rsign = 'A'AND relat = '003'AND istat = '1'AND begda LE wa_p509-enddaAND endda GE wa_p509-endda.IF sy-subrc EQ 0.wa_emp-zzhdorgeh = v_sobid(8).ENDIF.* Assign Higher Duty attributes to work areawa_emp-zzhdwerks = wa_p509-werks.wa_emp-zzhdbtrtl = wa_p509-btrtl.wa_emp-zzhdpersg = wa_p509-persg.wa_emp-zzhdpersk = wa_p509-persk.wa_emp-zzhdplans = wa_p509-plans.wa_emp-zzhdtrfar = wa_p509-trfar.wa_emp-zzhdtrfgb = wa_p509-trfgb.wa_emp-zzhdtrfgr = wa_p509-trfgr.wa_emp-zzhdtrfst = wa_p509-trfst.wa_emp-zzhdreacd = wa_p509-reacd.wa_emp-zzhdempct = wa_p509-empct.ENDIF.wa_emp-zzhdansal = w_salary.MODIFY i_t_data FROM wa_emp INDEX l_tabix.CLEAR wa_emp.
ENDLOOP.
No comments:
Post a Comment