SAP R/3 форум ABAP консультантов
Russian ABAP Developer's Club

Home - FAQ - Search - Memberlist - Usergroups - Profile - Log in to check your private messages - Register - Log in - English
Blogs - Weblogs News

Taxability of Wage Types



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR
View previous topic :: View next topic  
Author Message
admin
Администратор
Администратор



Joined: 01 Sep 2007
Posts: 1639

PostPosted: Thu Feb 19, 2009 3:16 pm    Post subject: Taxability of Wage Types Reply with quote

Code:
report zpy_wage_type_taxability line-count 65 line-size 132
        no standard page heading.

***********************************************************************
* Description : Taxability of Wage Types
* AUTHOR      : Clay Molinari
* DATE        : 03/01/2007
*           CREATED FOR HR EXPERT
*           READERS ARE GRANTED RIGHTS TO USE THIS CODE AS IS OR TO
*           EXPLOIT THE CODE IN ANY MANNER. THE AUTHOR DOES NOT EXTEND
*           ANY WARRANTY AS TO THE RELIABILITY OF THIS CODE. IT IS
*           PROVIDED AS AN ILLUSTRATION ONLY.
*----------------------------------------------------------------------
* DESCRIPTION :
* This program creates a report showing the taxability for each tax
* authority and tax type per wage type. This tool is used for validation
* and examination of the tax configuration.
***********************************************************************
* DESCRIPTION OF SELECTION SCREEN FIELDS
* 1. DATE: The effective date on which tables are read
* 2. WAGE TYPE: Limit selection by wage type
* 3. TAX CLASS: Limit selection by tax class
* 4. R/W/U: Limit selection by residence, work or unemployment taxes
* 5. TAX TYPE: Limit selection to certain tax types
* 6. TAX AUTHORITY: Limit selection by tax authority
* 7. TAX MODEL: Limit selection to certain tax models
* 8. TAX COMBO: Limit selection to certain tax type combos
* 9. HIDE LOCAL: Prevents local tax authorites (lower level than state)
*    from being included in the output
*10. WT/TAXCLASS: This radio button group allows the user to choose a
*    view of all wage types or a summarized view that shows only one
*    entry per tax class because all wage types of that tax class will
*    share common taxability.
*----------------------------------------------------------------------
* MODIFICATION LOG (latest change first):
*----------------------------------------------------------------------
************************************************************************
* AUTHOR      :
* DATE        : 
* Description : 
*             : 
************************************************************************

tables: t5ute, t5utm, t5uty, t512w, t512t, t52d2.

data: true type boolean value 'X',
      false type boolean value ' ',
      t_lgart like t512w-lgart,
      this_lgart like t512w-lgart,
      this_taxau like t5ute-taxau,
      this_rswrk like t5utm-rswrk,
      this_txbcl like t5utm-txbcl,
      vklas like t512w-vklas,
      pvalu like t52d2-prclv.

data: begin of lgart_table occurs 0,
  lgart like t512w-lgart,
  lgtxt like t512t-lgtxt,
  taxau like t5ute-taxau,
  rswrk like t5utm-rswrk,
  txmod like t5utm-txmod,
  txbmd like t5ute-txbmd,
  txbcl like t5utm-txbcl,
  tycmb like t5uty-tycmb,
  taxty like t5uty-taxty,
  txtxt like t512t-lgtxt,
  txbl  like t5uty-txbl,
end of lgart_table.

data:  line1(150),
       line2(150),
       line3(150).
data: tab_stop like sy-linsz,
      len like sy-linsz.


selection-screen begin of block b1 with frame title text-001.
parameters: p_begda type dats obligatory.
select-options s_lgart for t512w-lgart.
select-options s_prclv for t52d2-prclv.
select-options s_rswrk for t5utm-rswrk.
select-options s_taxty for t5uty-taxty.
select-options s_taxau for t5ute-taxau.
select-options s_txbmd for t5utm-txbmd.
select-options s_tycmb for t5utm-tycmb.
parameters: p_local as checkbox default 'X'.
parameters: p_wt radiobutton group r1 default 'X'.
parameters: p_pcl71 radiobutton group r1.
selection-screen end of block b1.

initialization.
  p_begda = sy-datum.

top-of-page.
  write p_begda mm/dd/yyyy to line1.
  concatenate 'Rules Effective On'
                 line1
                 into line2 separated by space.
  line1 = 'Wage Type Taxability Report'.
  clear: line3.

  perform header using line1 line2 line3.

  write:/ 'Wage Type',
         40 'Auth',
         47 'R/W/U',
         57 'Modifier',
         70 'Model',
         80 'Class',
         90 'Combo',
        100 'Tax Type'.
  uline.

start-of-selection.

  if p_wt eq true.
    perform select_by_wage_type.
  else.
    perform select_by_pcl71.
  endif.


end-of-selection.
  clear: this_lgart, this_taxau, this_rswrk.
  if p_wt eq true.
    sort lgart_table.
  else.
    sort lgart_table by taxau txbcl rswrk taxty.
  endif.
  loop at lgart_table.
    if lgart_table-taxau eq 'FED' or
       p_local ne true or
       lgart_table-taxau+2(2) is initial.
      if p_wt eq true.
        if ( this_lgart ne lgart_table-lgart or
           this_taxau ne lgart_table-taxau or
           this_rswrk ne lgart_table-rswrk ) and
           not this_lgart is initial.
          skip.
        endif.
      else.
        if ( this_taxau ne lgart_table-taxau or
           this_txbcl ne lgart_table-txbcl ) and
           not this_rswrk is initial.
          skip.
        endif.
      endif.
      write: / lgart_table-lgart,
             7 lgart_table-lgtxt,
            40 lgart_table-taxau,
            50 lgart_table-rswrk,
            60 lgart_table-txmod,
            70 lgart_table-txbmd,
            80 lgart_table-txbcl,
            90 lgart_table-tycmb,
           100 lgart_table-taxty,
           103 lgart_table-txtxt.
    endif.
    this_lgart = lgart_table-lgart.
    this_taxau = lgart_table-taxau.
    this_txbcl = lgart_table-txbcl.
    this_rswrk = lgart_table-rswrk.
  endloop.
  if sy-subrc ne 0.
    write: / 'No Data Found'.
  endif.

*&---------------------------------------------------------------------*
*&      Form  header
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      -->VALUE(P_LINE1)  text
*      -->VALUE(P_LINE2)  text
*----------------------------------------------------------------------*
form header  using    value(p_line1)
                      value(p_line2)
                      value(p_line3).

  len = sy-linsz.
  tab_stop = sy-linsz - 17.

  write: at /(len) p_line1 centered.
  write: 1 'System: ', sy-sysid, at tab_stop 'Page:    ', sy-pagno.
  write: at /(len) p_line2 centered.
  write: 1 'Date  : ', sy-datum, at tab_stop 'Time: ', sy-uzeit.
  write: at /(len) p_line3 centered.
  write: 1 'Program: ', sy-repid.
  uline.

endform.                    " header

*&---------------------------------------------------------------------*
*&      Form  select_by_wage_type
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form select_by_wage_type.
  select        * from  t512w
         where  molga eq '10'
         and    lgart in s_lgart
         and    endda ge p_begda
         and    begda le p_begda.
    select        * from  t512t
           where  sprsl eq sy-langu
           and    molga eq t512w-molga
           and    lgart eq t512w-lgart.
      lgart_table-lgtxt = t512t-lgtxt.
    endselect.

** After-tax deductions will not affect taxable wages
** regardless of the value stored in PCL71
    clear: vklas, pvalu.
    call function 'HRGB_READ_T512W_VKLAS'
      exporting
        molga                = '10'
        lgart                = t512w-lgart
        endda                = t512w-endda
        pclas                = '65'
      importing
        vklas                = vklas
        pvalu                = pvalu
      exceptions
        lgart_not_found      = 1
        vklas_not_maintained = 2
        others               = 3.

    if pvalu eq 'A'.
      clear: pvalu.
    else.
      clear: vklas, pvalu.
      call function 'HRGB_READ_T512W_VKLAS'
        exporting
          molga                = '10'
          lgart                = t512w-lgart
          endda                = t512w-endda
          pclas                = '71'
        importing
          vklas                = vklas
          pvalu                = pvalu
        exceptions
          lgart_not_found      = 1
          vklas_not_maintained = 2
          others               = 3.
    endif.
    check pvalu in s_prclv.
    lgart_table-lgart = t512w-lgart.
    lgart_table-txbcl = pvalu.
    select        * from  t5utm
           where  txbcl eq pvalu
           and    endda ge p_begda
           and    begda le p_begda
           and    rswrk in s_rswrk
           and    txbmd in s_txbmd
           and    tycmb in s_tycmb.

      lgart_table-txbmd = t5utm-txbmd.
      lgart_table-rswrk = t5utm-rswrk.
      lgart_table-txmod = t5utm-txmod.
      lgart_table-tycmb = t5utm-tycmb.
      select        * from  t5ute
             where  endda ge p_begda
             and    begda le p_begda
             and    taxau in s_taxau
             and    txbmd eq t5utm-txbmd.
        lgart_table-taxau = t5ute-taxau.
        select        * from  t5uty
               where  tycmb eq t5utm-tycmb
               and    endda ge p_begda
               and    begda le p_begda
               and    taxty in s_taxty.
          check t5uty-txbl eq 'Y'.
          lgart_table-taxty = t5uty-taxty.
          lgart_table-txbl = t5uty-txbl.
          t_lgart = '/4xx'.
          t_lgart+2(2) = t5uty-taxty.
          select        * from  t512t
                 where  sprsl eq sy-langu
                 and    molga eq t512w-molga
                 and    lgart eq t_lgart.
            lgart_table-txtxt = t512t-lgtxt.
          endselect.

          append lgart_table.
        endselect.
      endselect.
    endselect.

  endselect.
endform.                    "select_by_wage_type

*&---------------------------------------------------------------------*
*&      Form  select_by_pcl71
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form select_by_pcl71.
  select        * from  t52d2
         where  molga eq '10'
         and    prcls eq '71'.
    clear: vklas, pvalu, lgart_table.
    pvalu = t52d2-prclv.
    check pvalu in s_prclv.
    lgart_table-txbcl = pvalu.
    select        * from  t5utm
           where  txbcl eq pvalu
           and    endda ge p_begda
           and    begda le p_begda
           and    rswrk in s_rswrk
           and    txbmd in s_txbmd
           and    tycmb in s_tycmb.

      lgart_table-txbmd = t5utm-txbmd.
      lgart_table-rswrk = t5utm-rswrk.
      lgart_table-txmod = t5utm-txmod.
      lgart_table-tycmb = t5utm-tycmb.
      select        * from  t5ute
             where  endda ge p_begda
             and    begda le p_begda
             and    taxau in s_taxau
             and    txbmd eq t5utm-txbmd.
        lgart_table-taxau = t5ute-taxau.
        select        * from  t5uty
               where  tycmb eq t5utm-tycmb
               and    endda ge p_begda
               and    begda le p_begda
               and    taxty in s_taxty.
          check t5uty-txbl eq 'Y'.
          lgart_table-taxty = t5uty-taxty.
          lgart_table-txbl = t5uty-txbl.
          t_lgart = '/4xx'.
          t_lgart+2(2) = t5uty-taxty.
          select        * from  t512t
                 where  sprsl eq sy-langu
                 and    molga eq '10'
                 and    lgart eq t_lgart.
            lgart_table-txtxt = t512t-lgtxt.
          endselect.

          append lgart_table.
        endselect.
      endselect.
    endselect.

  endselect.
endform.                    "select_by_pcl71
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> HR All times are GMT + 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG.
SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG.
Every effort is made to ensure content integrity. Use information on this site at your own risk.