Thursday, December 12, 2013

Deductions

Enhancement code

ENHANCEMENT 1  ZDECLARE.    "active version
******** "HERE WRITE THE CODE
  DATA:  B 
TYPE T706V-BETFA,
         
C TYPE T706V-BETFA,
         A 
TYPE T706V-BETFA,
         D 
TYPE T706V-BETFA,
         E 
TYPE T706V-BETFA.


DATA: WA_T706V_CONST 
TYPE T706_CONST,
      IT_T706_CONST 
TYPE TABLE OF T706_CONST.

DATA: WA_ABZUG 
TYPE PTK04,
      WA_VPFPA 
TYPE PTK23,
      WA_VPFPS 
TYPE PTK22.

DATA: COUNTT    
TYPE I, "T706T TABLE SCHEM IN ('20','21','22','23').
      COUNTTT   
TYPE I, "T706T TABLE SCHEM IN ('22','23').
      COUNTTTT  
TYPE I, "T706T TABLE SCHEM IN ('20','21').
      COUNTX    
TYPE I, "T706X TABLE BEREI IN ('F').
      COUNTXX   
TYPE I, "T706X TABLE BEREI IN ('O').
      COUNTXXX  
TYPE I. "T706X TABLE BEREI IN ('O')

**********************************************************************
* GETTING THE B VALUE OVER HERE
**********************************************************************
SELECT SINGLE FROM T706_CONST  INTO WA_T706V_CONST WHERE KONST = 'ZGMRT'.
IF SY-SUBRC EQ 0.
 B = WA_T706V_CONST-KWERT.
ENDIF.

**********************************************************************
* GETTING THE E VALUE OVER HERE
**********************************************************************
SELECT SINGLE FROM T706_CONST  INTO WA_T706V_CONST WHERE KONST = 'ZICFL'.
IF SY-SUBRC EQ 0.
 E = WA_T706V_CONST-KWERT.
ENDIF.
********************************************************************************
*****CONUS OFF Base and OCONUS OFF Base: ***************************************
*CHECK THE TABLE T706T WHERE MOREI = '10' AND SCHEM 20 AND 21 AND 22 AND 23.
*CHECK THE TABLE T706X WHERE BEREI = 'F'.
*****************OR**************************************************************
******CONUS ON Base**************************************************************
*CHECK THE TABLE T706T WHERE MOREI = '10' AND SCHEM 20 AND 21.
*CHECK THE TABLE T706X WHERE BEREI = 'O'.
*********************************************************************************
SELECT COUNT(*) FROM T706T INTO COUNTT WHERE MOREI EQ '10'
                    
AND SCHEM IN ('20','21','22','23'). "CONUS OFF Base and OCONUS OFF Base:
SELECT COUNT(*) FROM T706T INTO COUNTTTT WHERE MOREI EQ '10'
                    
AND SCHEM IN ('20','21').           "CONUS ON Base:

  
IF COUNTT EQ 4.
*  BREAK-POINT.
  
SELECT COUNT(*) FROM T706X INTO COUNTX WHERE MOREI EQ '10'
                    
AND BEREI IN ('F').
  
SELECT COUNT(*) FROM T706X INTO COUNTXXX WHERE MOREI EQ '10'
                    
AND BEREI IN ('O').

*      BREAK-POINT.
      
IF COUNTX GE OR COUNTXXX GE 1.
*        CODE FOR REIMBURSE AMOUNT
        
IF ABZUG[] IS NOT INITIAL AND VPFPA[] IS NOT INITIAL.
            
LOOP AT ABZUG INTO WA_ABZUG.
                          
READ TABLE VPFPA INTO WA_VPFPA WITH KEY DATV1 = WA_ABZUG-ABDAT.

                         
IF WA_ABZUG-FRSTK EQ 'X' AND WA_ABZUG-MITAG EQ 'X' AND WA_ABZUG-ABEND EQ 'X'"IF SELECT ALL CHECK BOXS
                           D = WA_VPFPA-BETKU.
                           WA_VPFPA-BETFA = D.
                           
MODIFY TABLE VPFPA FROM WA_VPFPA.
                           CLEAR: D, WA_VPFPA.

                         
ELSEIF WA_ABZUG-FRSTK EQ 'X' OR WA_ABZUG-MITAG EQ 'X' OR WA_ABZUG-ABEND EQ 'X'."IF SELECT ANY ONE OR TWO CHECK BOXS
                           A = ( WA_VPFPA-BETFA - WA_VPFPA-BETKU ).
                           
= ( A + B ) / 2.
                           D = 
+ WA_VPFPA-BETKU.

                           WA_VPFPA-BETFA = D.
                           
MODIFY TABLE VPFPA FROM WA_VPFPA.
                         ENDIF.
                        CLEAR: A, C, D, WA_VPFPA.
            ENDLOOP.
        ENDIF.

      
IF ABZUG[] IS NOT INITIAL AND VPFPA[] IS NOT INITIAL.
        
LOOP AT ABZUG INTO WA_ABZUG.

                
READ TABLE VPFPS INTO WA_VPFPS WITH KEY DATV1 = WA_ABZUG-ABDAT.

                 
IF WA_ABZUG-FRSTK EQ 'X' AND WA_ABZUG-MITAG EQ 'X' AND WA_ABZUG-ABEND EQ 'X'"IF SELECT ALL CHECK BOXS
                   D = WA_VPFPS-BETKU.
                   WA_VPFPS-BETFA = D.
                   
MODIFY TABLE VPFPA FROM WA_VPFPA.
                   CLEAR: D, WA_VPFPA.
                
ELSEIF WA_ABZUG-FRSTK EQ 'X' OR WA_ABZUG-MITAG EQ 'X' OR WA_ABZUG-ABEND EQ 'X'."IF SELECT ANY ONE OR TWO CHECK BOXS
                    A = ( WA_VPFPS-BETFA - WA_VPFPS-BETKU ).
                    
= ( A + B ) / 2.
                    D = 
+ WA_VPFPS-BETKU.
                    WA_VPFPS-BETFA = D.
*                    *WA_VPFPs-BETFz = D.
                    
MODIFY TABLE VPFPS FROM WA_VPFPS.
                ENDIF.

                  CLEAR: A, C, D, WA_VPFPS.
        ENDLOOP.
      ENDIF.
*        END OF CODE FOR REIMBURSE AMOUNT
    ENDIF.
  ENDIF.

********************************************************************************
*****OCONUS ON Base: ***************************************
*CHECK THE TABLE T706T WHERE MOREI = '10' AND SCHEM 22 AND 23.
*CHECK THE TABLE T706X WHERE BEREI = 'O'.
*********************************************************************************
SELECT COUNT(*) FROM T706T INTO COUNTTT WHERE MOREI EQ '10'
                    
AND SCHEM IN ('22','23').
BREAK-POINT.
    
IF COUNTT NE AND COUNTTT EQ 2.
      
SELECT COUNT(*) FROM T706X INTO COUNTXX WHERE MOREI EQ '10'
                    
AND BEREI IN ('O').

      BREAK-POINT.
      
IF COUNTXX GE 1.
        
IF ABZUG[] IS NOT INITIAL AND VPFPA[] IS NOT INITIAL.
            
LOOP AT ABZUG INTO WA_ABZUG.
                          
READ TABLE VPFPA INTO WA_VPFPA WITH KEY DATV1 = WA_ABZUG-ABDAT.

                          
IF WA_ABZUG-FRSTK EQ 'X' OR WA_ABZUG-MITAG EQ 'X' OR WA_ABZUG-ABEND EQ 'X'.
                           A = ( WA_VPFPA-BETFA - WA_VPFPA-BETKU ).
                           
= ( A + B ) / 2.
                           D = 
+ E.

                           WA_VPFPA-BETFA = D.
                           
MODIFY TABLE VPFPA FROM WA_VPFPA.
                         ENDIF.
                        CLEAR: A, C, D, WA_VPFPA.

*                         IF WA_ABZUG-FRSTK EQ 'X' AND WA_ABZUG-MITAG EQ 'X' AND WA_ABZUG-ABEND EQ 'X'. "IF SELECT ALL CHECK BOX
*                           D = WA_VPFPA-BETKU.
*                           WA_VPFPA-BETFA = D.
*                           MODIFY TABLE VPFPA FROM WA_VPFPA.
*                         ENDIF.
*                        CLEAR: D, WA_VPFPA.


            ENDLOOP.
        ENDIF.

      
IF ABZUG[] IS NOT INITIAL AND VPFPA[] IS NOT INITIAL.
        
LOOP AT ABZUG INTO WA_ABZUG.

                
READ TABLE VPFPS INTO WA_VPFPS WITH KEY DATV1 = WA_ABZUG-ABDAT.

                  
IF WA_ABZUG-FRSTK EQ 'X' OR WA_ABZUG-MITAG EQ 'X' OR WA_ABZUG-ABEND EQ 'X'.
                    A = ( WA_VPFPS-BETFA - WA_VPFPS-BETKU ).
                    
= ( A + B ) / 2.
                    D = 
+ E.

                    WA_VPFPS-BETFA = D.
*                    *WA_VPFPs-BETFz = D.

                    
MODIFY TABLE VPFPS FROM WA_VPFPS.
                  ENDIF.

*                  IF WA_ABZUG-FRSTK EQ 'X' AND WA_ABZUG-MITAG EQ 'X' AND WA_ABZUG-ABEND EQ 'X'. "IF SELECT ALL CHECK BOX
*                   D = WA_VPFPS-BETKU.
*                   WA_VPFPs-BETFA = D.
**                    *WA_VPFPs-BETFz = D.
*                    MODIFY TABLE VPFPs FROM WA_VPFPs.
*                  ENDIF.

                  CLEAR: D, WA_VPFPS.
        ENDLOOP.
      ENDIF.
*        END OF CODE FOR REIMBURSE AMOUNT
    ENDIF.


    ENDIF.


*********************************************************************
* GETTING THE A VALUE OVER HERE
*********************************************************************
*IF ABZUG[] IS NOT INITIAL AND VPFPA[] IS NOT INITIAL.
*LOOP AT ABZUG INTO WA_ABZUG.
*
*READ TABLE VPFPA INTO WA_VPFPA WITH KEY DATV1 = WA_ABZUG-ABDAT.
*
*IF WA_ABZUG-FRSTK EQ 'X' OR WA_ABZUG-MITAG EQ 'X' OR WA_ABZUG-ABEND EQ 'X'.
*A = ( WA_VPFPA-BETFA - WA_VPFPA-BETKU ).
*C = ( A + B ) / 2.
*D = C + WA_VPFPA-BETKU.
*
*WA_VPFPA-BETFA = D.
*
*
*MODIFY TABLE VPFPA FROM WA_VPFPA.
*ENDIF.
*
*CLEAR: A, C, D, WA_VPFPA.
*ENDLOOP.
*ENDIF.
*
*********Raj********
*
*
*IF ABZUG[] IS NOT INITIAL AND VPFPA[] IS NOT INITIAL.
*LOOP AT ABZUG INTO WA_ABZUG.
*
*READ TABLE VPFPS INTO WA_VPFPS WITH KEY DATV1 = WA_ABZUG-ABDAT.
*IF WA_ABZUG-FRSTK EQ 'X' OR WA_ABZUG-MITAG EQ 'X' OR WA_ABZUG-ABEND EQ 'X'.
*A = ( WA_VPFPS-BETFA - WA_VPFPS-BETKU ).
*C = ( A + B ) / 2.
*D = C + WA_VPFPS-BETKU.
*
*WA_VPFPs-BETFA = D.
**WA_VPFPs-BETFz = D.
*
*
*MODIFY TABLE VPFPs FROM WA_VPFPs.
*ENDIF.
*
*CLEAR: A, C, D, WA_VPFPs.
*ENDLOOP.
*ENDIF.
******Raj*********

ENDENHANCEMENT.




Per Diem Calculation for CONUS and OCONUS region.

CONUS                                                                                                                      OCONUS

ON/OFF Base                                                                                     OFF Base                                           ON Base
 


Per Diem Calculation
Per Diem+Incidental
T706V-BETFA (reimbursement Amount + T706V-BETKU (Customer Amount)
                                                                                                                                                                                                                                                                                                                                                                                                                  Per Diem Calculation
                                                                                                                                                            Per Diem-Incidental+Flatrate
      Combination of T706V-BETFA - T706V-BETKU + V_T706_CONST (value of    
     “KONST= ZICFL” i.e. T706_CONST-KWERT.  (line no : 838, line no : 877)              

Deductions
Following are the detailed specification of deductions for CONUS and OCONUS Locations
  1. If employee selects 1 or 2 of the meals (breakfast, lunch, dinner), then the employee only receives Proportional Meal Rate + Incidentals.
    1. The Proportional Meal Rate (PMR) is in the per diem files, however it looks like it can also be a calculated field. The calculation is:

      1. Local meal rate + GMR (Government Meal Rate)
      2. Divide by 2 (rounded-up to the nearest dollar)
      3. Add Incidental Amount
LOGIC
T706V-BETFA (reimbursement Amount) - T706V-BETKU (Customer Amount) + V_T706_CONST (value of   “KONST= GMRTA” i.e. T706_CONST-KWERT divided by TWO + T706V-BETKU (Customer Amount)
NOTE: - Refer the below table for combinations and logic of the deductions (Breakfast-Lunch-Dinner)
  1. If employee selects all 3, then the employee receives only the incidentals amount.
                                                T706V-BETKU (Customer Amount)

Deductions Combination
Options
Breakfast
Lunch
Dinner
Description
1
x
PMR+incidental


2
x
3
x
4
x
x
5
x
x
6
x
x
7
x
x
x
Only Incidental Amount (T706V-BETKU (Customer Amount)
8
Blank
Blank
Blank
Per diems+incidental (T706V- BETFA: Reimbursement Amount) CONUS ON/OFF Base


user exits:
------------

GOS_SRV_SELECT

FAGL_DERIVE_SEGMENT
FAGL_DERIVE_PSEGMENT
CHECK_COBL_ADDON

No comments: