Friday, 28 April 2017

Project Vs Customer Table or ProjectSystem Vs SD or PROJ vs IHPA



PAR2 - Employee List  Tcode

**********************************************

DATA lv_objnr   TYPE proj-objnr.
DATA lv_g21      TYPE char10,
      g21      TYPE char10,

SELECT SINGLE objnr FROM proj INTO lv_objnr WHERE pspnr gv_prps-psphi.

SELECT SINGLE parnr FROM ihpa INTO lv_g21 WHERE objnr lv_objnr AND parvw 'AG' AND obtyp 'PDN'.
      gs_final1-g21 lv_g21.


SELECT SINGLE name1 FROM kna1 INTO gs_final1-g22 WHERE kunnr gs_final1-g21.


*******************************************************



Thursday, 27 April 2017

Project System and HCM Module Integration and Relations Table

HR Tables
T527O - Organizational Key Validation
SELECT
            orgky
            nodty
            text1
            text2
            FROM t527o INTO TABLE it_org_f4 WHERE orgky IN so_org AND hirar '1'.

T500P - Personnel Areas
T001P - Personnel Area/Subarea
T529U - Staus of employee master

SELECT  text1 FROM t529u INTO TABLE it_stat1_f4 WHERE sprsl 'EN'
                AND   statn '2' AND text1 IN so_stat1.
T528T - Position Texts

SELECT SINGLE plstx FROM t528t INTO gs_final1-g15 WHERE sprsl 'EN' AND otype 'S' AND plans lv_p0001-plans.

T530T- Reason for Action Texts
SELECT SINGLE stat1 stat2 massn massg FROM pa0000 INTO lv_stat1,lv_stat2,lv_massn,lv_massg WHERE pernr =  gs_pa0000-pernr "gs_hrp1001-objid
                  AND begda <= so_date-low AND endda >= so_date-high.


SELECT SINGLE mgtxt FROM  t530t INTO gs_final1-g38 WHERE sprsl 'EN' AND massn 'Z3' AND massg lv_massg.


T503T - Employee Subgroup or employee type Table text

SELECT SINGLE ptext FROM t503t INTO gs_final1-g36 WHERE sprsl 'EN' AND persk = wa_p0001-persk.
********************************************************************************


PS TABLES:

Project Allocation Table

SELECT
          otype
          objid
          rsign
          relat
          varyf
          begda
          endda
          sobid
          prozt
          FROM hrp1001
          INTO CORRESPONDING FIELDS OF TABLE gt_hrp1001
          FOR ALL ENTRIES IN gt_pa0000
          WHERE objid gt_pa0000-pernr
          AND begda <= so_date-low AND  ENDDA >= so_date-high
          AND otype 'P'
          AND sclas 'PJ' .



CONCATENATE 'PR' gs_hrp1001-sobid INTO gs_hrp1001-sobid.
      CONDENSE gs_hrp1001-sobid.


 SELECT SINGLE pspnr post1 FROM prps INTO lv_ps_posnr,gs_final1-g19 WHERE objnr gs_hrp1001-sobid.

      CALL FUNCTION 'CJDW_PRPS_SELECT_SINGLE'
        EXPORTING
          posnr             lv_ps_posnr
        IMPORTING
          e_prps            gv_prps
        EXCEPTIONS
          missing_parameter 1
          not_found         2
          OTHERS            3.




*****************************************************************************

1.SELECT-OPTIONSso_emp FOR pa9011-pernr OBLIGATORY ,
*                so_date FOR sy-datum NO INTERVALS NO-EXTENSION OBLIGATORY DEFAULT sy-datum,
                so_date for sy-datum OBLIGATORY ,
                so_org FOR p0001-vdsk1 ,
                so_area FOR t500p-name1,
                so_sarea FOR p0001-btrtl," MATCHCODE OBJECT hrpad_btrtl,
                so_wbs FOR prps-pspnr MATCHCODE OBJECT ash_prpm, " Wbs element
                so_cust FOR kna1-kunnr MATCHCODE OBJECT debi,     " Customer
                so_stat FOR prps-astnr MATCHCODE OBJECT h_tcj05,   " billing status
                so_stat1 FOR t529u-text1." t529t-mntxt." MATCHCODE OBJECT h_t529a. " employee atatus
SELECTION-SCREENEND OF BLOCK b1.



2.Initialization
INITIALIZATION.
* Description for the parameter

SO_DATE-LOW SY-DATUM.
SO_DATE-OPTION 'BT'.
SO_DATE-SIGN 'I'.
SO_DATE-HIGH SY-DATUM.
APPEND SO_DATE.

3.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_org-low.
  CLEAR it_org[].


  SELECT
        orgky
        nodty
        text1
        text2
        FROM t527o INTO TABLE it_org WHERE hirar '1'.
*  SELECT
*        persa
*        name1
*        FROM t500p
*        INTO TABLE it_org.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield    'ORGKY' "'PERSA'
      dynpprog    sy-repid
      dynpnr      sy-dynnr
      dynprofield 'SO_ORG-LOW'
      value_org   'S'
    TABLES
      value_tab   it_org.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_org-high.
  CLEAR it_org[].
  SELECT
        orgky
        nodty
        text1
        text2
        FROM t527o INTO TABLE it_org WHERE hirar '1'.

*  SELECT
*        persa
*        name1
*        FROM t500p
*        INTO TABLE it_org.

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'
    EXPORTING
      retfield    'ORGKY' "'PERSA'
      dynpprog    sy-repid
      dynpnr      sy-dynnr
      dynprofield 'SO_ORG-HIGH'
      value_org   'S'
    TABLES
      value_tab   it_org.





4. To check Authorization for Organization Key : p0001-vdsk1

AT SELECTION-SCREEN.

LOOP AT so_org.
    TRANSLATE so_org-low TO UPPER CASE,
                           so_org-high TO UPPER CASE.
    MODIFY so_org.
  ENDLOOP.


CLEAR g_message_v1,g_message_v2,g_message_v3,g_message_v4.
  IF so_org-low IS NOT INITIAL.
    AUTHORITY-CHECK OBJECT 'P_ORGIN' ID 'VDSK1' FIELD so_org-low.
    IF sy-subrc <> 0.
      CLEAR g_message_v1,g_message_v2,g_message_v3,g_message_v4.
      g_message_v1 'No authorization for'.
      g_message_v2 'Organizational Key - '.
      g_message_v3 so_org-low.
      CONDENSE g_message_v1,g_message_v2,g_message_v3.
      MESSAGE e000(zps_msgWITH g_message_v1 g_message_v2 g_message_v3.
    ENDIF.
  ENDIF.


DATA it_usvalues TYPE TABLE OF usvalues,
       wa_usvalues TYPE usvalues.


IF so_org IS INITIAL.
    lv_org 'X'.
    CLEAR it_usvalues[].
    CALL FUNCTION 'EFG_USER_AUTH_FOR_OBJ_GET'
      EXPORTING
        x_uname     sy-uname
        x_object    'P_ORGIN'
      TABLES
        yt_usvalues it_usvalues.
  ENDIF.


 IF it_usvalues[] IS NOT INITIAL.
    LOOP AT it_usvalues INTO wa_usvalues.
      IF wa_usvalues-field <> 'VDSK1'.
        wa_usvalues-field 'X'.
      ENDIF.
      MODIFY it_usvalues FROM wa_usvalues INDEX sy-tabix TRANSPORTING field.
      CLEAR wa_usvalues.
    ENDLOOP.
    DELETE it_usvalues WHERE field 'X'.
    LOOP AT it_usvalues INTO wa_usvalues.
      so_org-sign 'I'.
      so_org-option 'EQ'.
      so_org-low wa_usvalues-von.
      APPEND so_org.
      CLEAR wa_usvalues.
    ENDLOOP.
  ENDIF.

IF so_org IS NOT INITIAL.
    IF so_org-low '*' OR so_org-high '*'.
      REFRESH so_org.
      SELECT
            orgky
            nodty
            text1
            text2
            FROM t527o INTO TABLE it_org_f4 WHERE orgky IN so_org AND hirar '1'.
    ELSE.
      SELECT
            orgky
            nodty
            text1
            text2
            FROM t527o INTO TABLE it_org_f4 WHERE orgky IN so_org AND hirar '1'.
    ENDIF.
    IF it_org_f4[] IS INITIAL.
      CLEAR g_message_v1,g_message_v2.
      g_message_v1 'Organizational Key'.
      g_message_v2 'Wrong'.
      CONDENSE g_message_v1,g_message_v2.
      MESSAGE e000(zps_msgWITH g_message_v1 g_message_v2.
    ENDIF.
  ENDIF.





Monday, 24 April 2017

small small concepts in ABAP


1. REPLACE

 REPLACE ALL OCCURRENCES OF ',' IN l_fieldcontent WITH space.

2.CONDENSE

CONDENSE l_fieldcontent NO-GAPS.

3.Modify

 MODIFY ct_mapping_result INDEX sy-tabix FROM ca_mapping_result.


4. SPlit

DATA lv_date     TYPE char2,
        lv_month    TYPE char2,
        lv_year     TYPE char4,

        l_fieldcontent      TYPE string.

SPLIT lv_date_field AT '/' INTO lv_month lv_date lv_year.



5. Move

MOVE ls_state_text-sp_st_code TO ca_mapping_result-infty_field_value.

6. To find  string  length and concatenate

    data: lv_date_no  TYPE i,
           lv_mon_no   TYPE i.


lv_date_no strlenlv_date ).
      lv_mon_no strlenlv_month ).
       


if lv_date_no eq 1.
               CONCATENATE '0' lv_date INTO lv_date.
        endif.
        if lv_mon_no eq 1.
               CONCATENATE '0' lv_month INTO lv_month.
        endif.


7. Delete Zeros
data : var(10) type c.
move profit_center to var.

shift var left deleting leading '0'.

8. Obligatory default

parametersp_date type bsid-budat DEFAULT sy-datum obligatory.

9. Translate

TRANSLATE gs_h_det-name1 TO UPPER CASE.

10. Contains any (string Operations).

 IF wa_bsik-zuonr IS NOT INITIAL AND wa_bsik-zuonr CA '0123456789' AND wa_bsik-zuonr CA '.' ).
          CONCATENATE wa_bsik-zuonr+6(4wa_bsik-zuonr+3(2wa_bsik-zuonr+0(2INTO wa_final-bldat.
          if wa_final-bldat ca  '!@#$%^&*(){[]}\|;:",<>/?' .
            wa_final-bldat wa_bsik-bldat.
          endif.
        ELSE.
          wa_final-bldat wa_bsik-bldat.
        ENDIF.


11. No intervals and No extensions

select-optionss_oi for plogi-objid no INTERVALS no-EXTENSION.

Customer / Vendor / GL concepts and Read Text from



T001 - company code table (BUKRS)
T001K-  valuation area (BWKEY) / company code table
T001W - Plant (werks)  /  valuation area or Branches (BWKEY)
BNKA - Bank master record
G/L Concepts and Table

1.  FS10 - Balance Display for G/L
2. Fbl3n -GL Account line item Display

BSIS- Open items G/L table
BSAS- cleared items G/L table
BSEG - Account Document Segmet table (cluster)
BKPF - Account Document Header
Fb03 - To display single posting Document number

Customer Concepts and Table:

1. Xd01 -  to create complete master data for customer ( all views available here)
2.FBl5n - Customer line item dispaly

BSID - Open items for customer
BSAD - cleared items for customers


 KNA1 - Customer Master Table.
VBRK - Billing Document or Invoice Header table
VBRP - Billing Doumnet or Invoice Item Table
 KNBK  -Customer Master (Bank Details)


TVKO - Sales Organisations Master Table
In this table we can take sales Organisation company code and address Number and purchase Organisation and Purchase group and so on.

ADRC - Here we can take all adresses by passing address number


VBKD - Sales Document : BusinessTable

Here we can take customer Purchase Order number and purchase order date


T005U - Region (State, Province, County) text Table

T005T - Country names table

VBPA - Sales Document: Partner

SELECT SINGLE adrnrkunnr FROM vbpa INTO @DATA(gv_vbpa)
        WHERE parvw 'WE' AND vbeln IN SELECT  vgbel FROM vbrp WHERE vbeln @gs_vbrk-vbeln ).


KONV - Conditions type transaction Table.
KONP - Conditions Master table
VBRK-KUNAG =  KNVV-Kunnr

KNVV - Customer Master Sales Data

Here we can fetch Customer group, Sales Office and pricing procedure for customer and so on.

TVKWZ- Allowed Plants per Sales Organization


J_1IMOCOMP - Company and Plant - Excise Additional Data

Here we can fetch VAT ,CST  and PAN and Service Tax number

KNMT - Customer-Material Info Record Data Table

T052  -Terms of Payment
 TVZBT    -   Customers: Terms of Payment Texts
SELECT SINGLE ztag1 FROM t052 INTO @DATA(lv_duedatWHERE zterm IN SELECT zterm FROM vbrk WHERE vbeln @gs_vbrk-vbeln AND rfbsk 'C').
    IF lv_duedat IS NOT INITIAL.
      gv_duedate lv_duedat + gs_vbrk-fkdat.
    ENDIF.

VCUST - Customer List  Tcode.

How to read Item text ?
data:gt_line       TYPE TABLE OF tline,
    gs_line       TYPE  tline.

DATA lv_id       TYPE  thead-tdid,
         lv_language TYPE  thead-tdspras,
         lv_name     TYPE  thead-tdname,
         lv_object   TYPE  thead-tdobject.


REFRESH gt_line[].
  CLEAR lv_id,lv_language,lv_name,lv_object,gs_line.

  lv_id =  
'ZINV'.
  lv_language 'EN'.
  lv_name p_gs_vbrk_vbeln.
  lv_object 'VBBK'

*BREAK testabap.
  CALL FUNCTION 'READ_TEXT'
    EXPORTING
      client                  sy-mandt
      id                      lv_id
      language                lv_language
      name                    lv_name
      object                  lv_object
    TABLES
      lines                   gt_line
    EXCEPTIONS
      id                      1
      language                2
      name                    3
      not_found               4
      object                  5
      reference_check         6
      wrong_access_to_archive 7
      OTHERS                  8.
  IF sy-subrc 0.
    READ TABLE gt_line INTO gs_line INDEX 1.

gs_line-tdline
  ENDIF.

Vendor Concepts and Table
 Xk01 -  to create complete master data for vendors ( all views available here)

LFA1 - Vendor Master (General Section)
LFB1    -  Vendor Master (Company Code)
LFBK     -   Vendor Master (Bank Details)
J_1IMOVEND    -   Vendor Master Excise Additional Data
FIWTIN_TAN_EXEM- Table for mapping TAN and Exemption Number.

Vendor Master Standed Tcode and Table

BSIK -  Vendor Open items Table
BSAK - Vendor Cleared items table

FBL1N - Vendor Line Item Display

FAGLFLEXA   -- General Ledger: Actual Line Items ( for profit Center and Segment)
     





Saturday, 22 April 2017

To find wage type and joining date and Exit date of employee

1. To get Joining Date and Exit Date

CONSTANTS c_join TYPE char2  VALUE 'Z1',         " Date of Join
            c_exit TYPE char2  VALUE 'Z8'.        " Date of Exit


*To get Joining and Exit date
  rp-provide-from-last p0041 space pn-begda pn-endda.
  IF pnp-sw-found 1.
    DO 12 TIMES VARYING lv_datetype FROM p0041-dar01 NEXT p0041-dar02
                VARYING lv_date     FROM p0041-dat01 NEXT p0041-dat02.

      IF lv_datetype c_join.
        MOVE lv_date TO ls_final-join_date.
      ELSEIF lv_datetype c_exit.
        MOVE lv_date TO ls_final-exit_date.
      ENDIF.
    ENDDO.
  ENDIF.



2. Calculate the years, months, days & cal days between 2 dates.

DATAno_cal_day TYPE i,
      no_month   TYPE i,
      no_year    TYPE i.


CALL FUNCTION 'HR_AUPBS_MONTH_DAY'
      EXPORTING
        beg_da     p0000-begda  " HIRE DATE
        end_da     p0015-begda  " LAST WORKING DATE
      IMPORTING
*       NO_DAY     =
        no_month   no_month
        no_year    no_year
        no_cal_day no_cal_day.

3. To find wage type and text

    rp-provide-from-last p0008 space pn-begda pn-endda.
    IF pnp-sw-found '1'.
      DO 40 TIMES VARYING gv_lga01 FROM p0008-lga01 NEXT p0008-lga02
                   VARYING gv_bet01 FROM p0008-bet01 NEXT p0008-bet02
                   VARYING gv_ind01 FROM p0008-ind01 NEXT p0008-ind02 .

        IF gv_ind01 EQ 'I' "FOR INDIRECT EVALUATION
          IF gv_lga01 EQ '1000'.
            gs_ptbindbw-indbw =  gv_ind01.
            gs_ptbindbw-lgart =  gv_lga01.
            APPEND gs_ptbindbw.

            CLEAR gs_ptbindbw.
            CALL FUNCTION 'RP_FILL_WAGE_TYPE_TABLE_EXT'
              EXPORTING
*               APPLI  = 'E'
                begda  pn-endda "'00000101'
                endda  pn-endda "'99991231'
                infty  '0008'
*               OBJPS  = '  '
*               TCLAS  = 'A'
                pernr  pernr-pernr
*               SEQNR  = '   '
*               SUBTY  = '0   '
*               DLSPL  = 'X'
*               MSGFLG = ''
*               NORDCT = ''
*               CONV_CURR                          = 'X'
*               FLAG_NO_DB_READ                    =
              TABLES
                pp0001 p0001
                pp0007 p0007
                pp0008 p0008
                ppbwla gs_ptbindbw
*               PP0014 =
*               PP0015 =
*               PP0052 =
*               PP0230 =
*               PP0267 =
*  EXCEPTIONS
*               ERROR_AT_INDIRECT_EVALUATION       = 1
*               OTHERS = 2
              .
            IF sy-subrc 0.
              READ TABLE gs_ptbindbw INTO gs_ptbindbw WITH KEY lgart '1000'.
              IF sy-subrc EQ 0.
                gv_basic gs_ptbindbw-betrg .
                EXIT.
              ENDIF .
            ENDIF.
*
          ENDIF.
        ENDIF.

      ENDDO.

    ENDIF.

Friday, 21 April 2017

IN HR employee designation Text and Status text

1. To get Employee Designation


rp-provide-from-last p0000 space pn-begda pn-endda.
  IF pnp-sw-found EQ '1'.
    status p0000-stat2.
  ELSE.
    REJECT.
  ENDIF.

  rp-provide-from-last p0001 space pn-begda pn-endda.
  IF pnp-sw-found 1.

    CALL FUNCTION 'HR_READ_FOREIGN_OBJECT_TEXT'
      EXPORTING
        otype                   'S'
        objid                   p0001-plans
        status                  '1'
        begda                   pn-begda
        endda                   pn-endda
        langu                   sy-langu
      IMPORTING
        object_text             desig
      EXCEPTIONS
        nothing_found           1
        wrong_objecttype        2
        missing_costcenter_data 3
        missing_object_id       4
        OTHERS                  5.
    IF sy-subrc <> 0.
* Implement suitable error handling here
    ENDIF.


2. To get Employee status Text

SELECT SINGLE text1 FROM t529u INTO status_text WHERE statn '2' AND  statv status AND sprsl 'E'.

HR related shortcut Function module and logical database PNP related queries


1. To Calculate yearsmonthsdays & calender days between given dates

    call function 'HR_SGPBS_YRS_MTHS_DAYS'
      exporting
        beg_da     wa_final-duedate
        end_da     p_date
      importing
*       NO_DAY     =
*       NO_MONTH   =
*       NO_YEAR    =
        no_cal_day w_days
* EXCEPTIONS
*       DATEINT_ERROR       = 1
*       OTHERS     = 2
      .
    if sy-subrc <> 0.
* Implement suitable error handling here
    endif.


2. To get month name 

data: emonth_name TYPE t247-ktx,

CALL FUNCTION 'ISP_GET_MONTH_NAME'
      EXPORTING
        date        exit_date
        language    'E'
      IMPORTING
        shorttext   emonth_name
      EXCEPTIONS
        calendar_id 1
        date_error  2
        not_found   3
        wrong_input 4
        OTHERS      5.
    IF sy-subrc <> 0.
* Implement suitable error handling here
    ENDIF.

3. To find HR joining Date and leaving date



CALL FUNCTION 'HR_ENTRY_DATE'                                             "TO FIND EMPLOYEE JOIN DATE
    EXPORTING
      persnr               pernr-pernr
      begda                '18000101'
      endda                '99991231'
    IMPORTING
      entrydate            entry_date
    EXCEPTIONS
      entry_date_not_found 1
      pernr_not_assigned   2
      OTHERS               3.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.


CALL FUNCTION 'HR_LEAVING_DATE'                                                   "TO READ EMPLOYEE EXIT DATE
    EXPORTING
      persnr                 pernr-pernr
      begda                  '18000101'
      endda                  '99991231'
    IMPORTING
      leavingdate            exit_date
    EXCEPTIONS
      leaving_date_not_found 1
      pernr_not_assigned     2
      OTHERS                 3.
  IF sy-subrc <> 0.
*** Implement suitable error handling here
  ENDIF.


4.To find Employee country Group


  CALL FUNCTION 'HR_COUNTRYGROUPING_GET'
    EXPORTING
      pernr     pernr-pernr
      tclas     'A'
      begda     '18000101'
      endda     '99991231'
    IMPORTING
      molga     g_molga
    EXCEPTIONS
      not_found 1
      OTHERS    2.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.


5. To read data from logical database


rp-provide-from-last p0185 '02' pn-begda pn-endda.                    "TO READ PAN NUMBER
  IF pnp-sw-found EQ '1'.
    wa_final-pannum  p0185-icnum.
  ENDIF.


02 -> suptype for infotype 0185

rp-provide-from-last p0008 space pn-begda pn-endda.
  IF pnp-sw-found EQ '1'.
    wa_final-grade p0008-trfgr.
  ENDIF.

space -> no suptype for infotype 0008.




7.To fill the Wagetype Table

START-OF-SELECTION.

************************************************************************
************************GET PERNR***************************************
************************************************************************
  GET pernr.
PROVIDE FROM p0008 BETWEEN pn-begda AND pn-endda.
  ENDPROVIDE.
  CALL FUNCTION 'RP_FILL_WAGE_TYPE_TABLE_EXT'                                     "TO FILL THE WAGE TYPE TABLE
    EXPORTING
      begda                        p0008-begda
      endda                        p0008-endda
      infty                        '0008'
      tclas                        'A'
      pernr                        pernr-pernr
    TABLES
      pp0001                       p0001
      pp0007                       p0007
      pp0008                       p0008
      ppbwla                       it_pbwla
    EXCEPTIONS
      error_at_indirect_evaluation 1
      OTHERS                       2.
  IF sy-subrc <> 0.
* Implement suitable error handling here
  ENDIF.

  READ TABLE it_pbwla WITH KEY lgart '1000'.                             "BASIC
  IF sy-subrc 0.
    g_bet it_pbwla-betrg * 12.
  ENDIF.
  wa_final-basic g_bet.
  CLEAR g_bet.
  READ TABLE it_pbwla WITH KEY lgart '1001'.                           "HRA
  IF sy-subrc 0.
    g_bet it_pbwla-betrg * 12.
  ENDIF.
  wa_final-hra g_bet.
  CLEAR  g_bet.

  READ TABLE it_pbwla WITH KEY lgart '1002'.                           "TRANSPORT ALLOWANCE
  IF sy-subrc 0.
    g_bet it_pbwla-betrg * 12.
  ENDIF.
  wa_final-ta g_bet.
  CLEAR g_bet.

  READ TABLE it_pbwla WITH KEY lgart '1003'.                          "SPECIAL ALLOWANCE
  IF sy-subrc 0.
    g_bet it_pbwla-betrg * 12.
  ENDIF.

  wa_final-sa g_bet.
  CLEAR g_bet.

  READ TABLE it_pbwla WITH KEY lgart '1004'.                          "STATUTORY BONUS
  IF sy-subrc 0.
    g_bet it_pbwla-betrg * 12.
  ENDIF.
  wa_final-sbonus g_bet.
  CLEAR g_bet.

**  READ TABLE it_pbwla WITH KEY lgart = '1005'.                         "EMPLOYER PROVIDENT FUND
**  IF sy-subrc = 0.
**    g_bet = it_pbwla-betrg * 12.
**  ENDIF.
**  wa_final-epf = g_bet.
**  CLEAR g_bet.

  READ TABLE it_pbwla WITH KEY lgart '1006'.                         "MEDICAL
  IF sy-subrc 0.
    g_bet it_pbwla-betrg * 12.
  ENDIF.
  wa_final-medallow  g_bet.
  CLEAR g_bet.


**  READ TABLE it_pbwla WITH KEY lgart = '2001'.                         "LANGUAGE ALLOWANCE
**  IF sy-subrc = 0.
**    g_bet = it_pbwla-betrg.
**  ENDIF.
**
**  wa_final-lallow = g_bet.
**  CLEAR g_bet.

  rp-provide-from-last p9012 space pn-begda pn-endda.
  IF pnp-sw-found EQ '1'.
    wa_final-epf p9012-emp_pf.
    wa_final-lallow p9012-lng_alw.
  ENDIF.


  wa_final-ctcg wa_final-basic + wa_final-hra + wa_final-ta + wa_final-sa
                + wa_final-sbonus + wa_final-medallow.  "CTC GROSS
  wa_final-ctct wa_final-ctcg + wa_final-epf.                                                            "CTC TOTAL

APPEND wa_final TO it_final.
  CLEAR wa_final.


END-OF-SELECTION.

  PERFORM fieldcatalog.

  PERFORM layout.

  PERFORM display_alv.