Professional Documents
Culture Documents
Calculate Grosspay Sap Dev Edition
Calculate Grosspay Sap Dev Edition
*Time Tracking:
*Implement a simple time tracking system to record employee working hours.
(create an activity program with selection screen to insert working hours into
database and bind it to tcode ACTIVITY)
*Create a custom time entry screen for employees to record working hours.
*Store the time entries in a separate database table.
*Record the working hours of employees for each task.
*Keep track of time spent on sales, warehouse activities, and deliveries.(1
kilometer costs 0.09 $)
* retreive sales order ID, driver ID and driver fullname and distance from TM
table --> check the personal ID from zhcm_T_employees
INCLUDE zhcmrpayrolltop.
INITIALIZATION.
p_rate = `0.09`.
pbt = 'Calculate Grosspay'.
DATA(instance) = NEW lcl_payroll( ).
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF screen-group1 = '3D'.
screen-display_3d = 1.
MODIFY SCREEN.
ENDIF.
IF screen-group1 = 'DIS'.
screen-input = 0.
MODIFY SCREEN.
ENDIF.
ENDLOOP.
SELECT id,
distance,
personal_id,
driver
FROM ztm_t_shipments INTO TABLE @DATA(it_shipments).
ls_mapping-fldname = 'F0001'.
ls_mapping-dyfldname = 'P_ID'.
APPEND ls_mapping TO it_mapping.
ls_mapping-fldname = 'F0002'.
ls_mapping-dyfldname = 'P_DSTAN'.
APPEND ls_mapping TO it_mapping.
ls_mapping-fldname = 'F0003'.
ls_mapping-dyfldname = 'P_PERID'.
APPEND ls_mapping TO it_mapping.
ls_mapping-fldname = 'F0004'.
ls_mapping-dyfldname = 'P_PNAME'.
APPEND ls_mapping TO it_mapping.
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'CLK'.
instance->calculate_grosspay(
lv_id = p_id
lv_perid = p_perid
lv_pname = p_pname
lv_dstan = p_dstan
lv_rate = p_rate
).
WHEN OTHERS.
ENDCASE.
START-OF-SELECTION.
END-OF-SELECTION.
IF lv_dstan GT 0.
instance->check_calculated( ).
ls_payroll-order_id = lv_id.
ls_payroll-id = lv_perid.
ls_payroll-fullname = lv_pname.
ls_payroll-grosspay = CONV int1( lv_dstan ) * lv_rate.
ENDIF.
ELSE.
MESSAGE |distance can't be null or negative| TYPE 'E'.
ENDIF.
ENDMETHOD.
METHOD check_calculated.
ENDCLASS.
================================================================
*&---------------------------------------------------------------------*
*& Include ZHCMRPAYROLLTOP
*&---------------------------------------------------------------------*
SELECTION-SCREEN: BEGIN OF BLOCK blk1 WITH FRAME TITLE TEXT-001.
PARAMETERS: p_id TYPE zsd_t_salesorder-id MODIF ID 3d OBLIGATORY,
p_perid TYPE zhcm_t_employees-id MODIF ID 3d,
p_pname TYPE zhcm_t_employees-fullname MODIF ID 3d,
p_dstan TYPE ztm_t_shipments-distance MODIF ID 3d,
p_rate TYPE p DECIMALS 4 MODIF ID dis.
SELECTION-SCREEN: END OF BLOCK blk1.
DATA:
it_return TYPE TABLE OF ddshretval,
it_mapping TYPE TABLE OF dselc,
ls_mapping TYPE dselc.
DATA:
ls_salesorder TYPE zsd_t_salesorder,
ls_shipment TYPE ztm_t_shipments,
ls_payroll TYPE zhcm_t_employees.
METHODS:
calculate_grosspay IMPORTING lv_id TYPE ztm_t_shipments-id
lv_perid TYPE ztm_t_shipments-personal_id
lv_pname TYPE ztm_t_shipments-driver
lv_dstan TYPE ztm_t_shipments-distance
lv_rate LIKE p_rate,
check_calculated.
PROTECTED SECTION.
PRIVATE SECTION.
ENDCLASS.