SAP details:     Events  -  News -   Training  -  World wide sites  -  Sap Labs   -   SAP Magazine  -   SAP Screen saver -   Stock Price

Download ABAP source code

Program name  Program function  Author Date Added 
Z_Update_annual_salary
Version: 4.0 & above
Update annual salary - Infotype 0008 
Module: HR
   
 

REPORT Z_Update_annual_salary  NO STANDARD PAGE HEADING.
TABLES: PERNR, PA0008.
INFOTYPES: 0000, 0001, 0002, 0008.


PARAMETERS: P_REPYY LIKE P0002-GBJHR DEFAULT SY-DATUM+0(4).

DATA: BEGIN OF FROM_YEAR,
                 YY LIKE P0002-GBJHR,
                 MM LIKE P0002-GBMON,
                 DD LIKE P0002-GBTAG.
DATA: END OF FROM_YEAR.

DATA: BEGIN OF TO_YEAR,
              YY LIKE P0002-GBJHR,
              MM LIKE P0002-GBMON,
              DD LIKE P0002-GBTAG.
DATA: END OF TO_YEAR.

DATA: V_ANSAL1 LIKE P0008-ANSAL.
DATA: V_ANSAL LIKE P0008-ANSAL.
DATA: V_WAGETYPE LIKE P0008-LGA01.
DATA: V_WT_AMT LIKE P0008-BET01.

START-OF-SELECTION.

   FROM_YEAR-YY = P_REPYY.
   FROM_YEAR-MM = '01'.
   FROM_YEAR-DD = '01'.

  TO_YEAR-YY = P_REPYY.
  TO_YEAR-MM = '12'.
  TO_YEAR-DD = '31'.

GET PERNR.

   PERFORM PROCESS_0008_INFOTYPE.
END-OF-SELECTION.

*****************  PROCESS_0008_INFOTYPE  **************************
FORM PROCESS_0008_INFOTYPE.

    DATA: V_ANSAL_NUM(14) TYPE N.
    DATA: BEGIN OF V_ANSAL_IN_DEC,
                         AMT(12) TYPE N,
                         DEC(2) TYPE N.
     DATA: END OF V_ANSAL_IN_DEC.
   LOOP AT P0008.
           DO 10 TIMES
                 VARYING V_WAGETYPE FROM P0008-LGA01 NEXT P0008-LGA02
                 VARYING V_WT_AMT FROM P0008-BET01 NEXT P0008-BET02.
                IF V_ANSAL IS INITIAL.
                     IF NOT V_WT_AMT IS INITIAL.
                         V_WT_AMT = V_WT_AMT * 12.
                         UNPACK V_WT_AMT TO V_ANSAL_NUM.
                             
                         IF V_ANSAL_NUM+12(2) > 0.
                             V_ANSAL_IN_DEC = V_ANSAL_NUM.
                             IF V_ANSAL_IN_DEC-DEC >= 50.
                                   ADD 1 TO V_ANSAL_IN_DEC-AMT.
                                   V_ANSAL = V_ANSAL_IN_DEC-AMT.
                              ENDIF.
                          ENDIF.
                          
                          SELECT SINGLE * FROM PA0008
                                  WHERE PERNR = P0008-PERNR
                                  AND BEGDA = P0008-BEGDA
                                  AND ENDDA = P0008-ENDDA.

                                  UPDATE PA0008
                                            SET PA0008-ANSAL = V_ANSAL
                                        WHERE PERNR = P0008-PERNR
                                        AND BEGDA = P0008-BEGDA
                                        AND ENDDA = P0008-ENDDA.
                                   WRITE : / PA0008-PERNR, PA0008-BEGDA, PA0008-ENDDA,
                                                         PA0008-ANSAL.
                                  EXIT.
                     ENDIF.
                  ENDIF.
          ENDDO.
    ENDLOOP.

    RP-PROVIDE-FROM-LAST P0008 0 '18000101' '99991231'. "sbty 0 only
    WRITE: / PERNR-PERNR, P0008-ANSAL.

    SELECT * FROM PA0008
          WHERE PERNR = P0008-PERNR.
          UPDATE PA0008
                      SET PA0008-ANSAL = 0
               WHERE PERNR = P0008-PERNR.
     ENDSELECT.
ENDFORM.

 

 

 
 









   
 
PlanetSAP.com

Home     Post a article   Suggestion   Contact  

Disclaimer    Copyright; 1998-2001 Softron Systems, Inc. All rights reserved.