0% found this document useful (0 votes)
23 views3 pages

Calculate Grosspay Sap Dev Edition

Uploaded by

starboynanda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views3 pages

Calculate Grosspay Sap Dev Edition

Uploaded by

starboynanda
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

*&---------------------------------------------------------------------*

*& Report ZHCM_R_PAYROLL


*&---------------------------------------------------------------------*
*&
*&---------------------------------------------------------------------*
REPORT zhcm_r_payroll.

*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.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_id.

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.

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'


EXPORTING
retfield = 'ID'
dynpprog = sy-repid
dynpnr = sy-dynnr
dynprofield = 'P_ID'
value_org = 'S'
TABLES
value_tab = it_shipments
return_tab = it_return
dynpfld_mapping = it_mapping
EXCEPTIONS
parameter_error = 1 " Incorrect parameter
no_values_found = 2 " No values found
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.

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.

CLASS lcl_payroll IMPLEMENTATION.


METHOD calculate_grosspay.

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.

INSERT zhcm_t_employees FROM ls_payroll.


IF sy-subrc EQ 0.

MESSAGE |gross pay's calculated successfully| TYPE 'S'.

ENDIF.
ELSE.
MESSAGE |distance can't be null or negative| TYPE 'E'.
ENDIF.
ENDMETHOD.

METHOD check_calculated.

SELECT SINGLE order_id


FROM zhcm_t_employees
INTO @DATA(lv_calculated)
WHERE order_id EQ @p_id.
IF sy-subrc EQ 0.

MESSAGE |employee grosspay's already calculated| TYPE 'E'.


ENDIF.
ENDMETHOD.

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.

SELECTION-SCREEN: PUSHBUTTON 10(20) pbt USER-COMMAND clk.

DATA:
it_return TYPE TABLE OF ddshretval,
it_mapping TYPE TABLE OF dselc,
ls_mapping TYPE dselc.

CLASS lcl_payroll DEFINITION.


PUBLIC SECTION.

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.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy