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

calculating tax(vat cenvat cst) in po report



 
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP
View previous topic :: View next topic  
Author Message
pranaypanchbhai
Участник
Участник



Joined: 26 Mar 2010
Posts: 9

PostPosted: Fri Apr 02, 2010 3:09 pm    Post subject: calculating tax(vat cenvat cst) in po report Reply with quote

hiiiiiiiiiii friends

i am sending a report of purchase order in that i want the calculation of VAT CENVAT & CST OF amount depending on tax code how is possible plz tell me solution for that plz its urgent for me

venvat amount = net amount * vat percentage
nvat amount = (net amount +cenvat amount) * vat percentage
cst amount = (net amount +cenvat amount) * cst percentage

example if net value = 25,600.00
and tax code is 65 = Input 8.42%CENVAT+12.5%VAT credit-RM
then cenvat = 2,155.52
vat = 3,469.44
cst = 0.00

Code:
*&---------------------------------------------------------------------*
*& Report  ZDEMO
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*

REPORT  ZDEMO.


type-pools: slis.
tables: ekko, ekpo, t007s, t001.

data: begin of itekpo occurs 0,
        ebeln type ekpo-ebeln, " po no.
        aedat type ekpo-aedat, " change date
        lifnr type ekko-lifnr, "  vendor code
        bedat type ekko-bedat, " po date
        matnr type ekpo-matnr, " material no.
        bukrs type ekpo-bukrs, " company code
        werks type ekpo-werks, " plant
        meins type ekpo-meins, " unit
        netpr type ekpo-netpr, " net price
        prdat type ekpo-prdat, " price date = creat date
        netpr2 type ekpo-netpr, " net price
        prdat2 type ekpo-prdat, " price date = creat date
        aedat2 type ekpo-aedat,
        txz01 type ekpo-txz01, " short text
        menge type ekpo-menge, " quantity
        netwr type ekpo-netwr, " net value
        brtwr type ekpo-brtwr, " gross value
        mwskz type ekpo-mwskz, " tax code
        text1 like t007s-text1," Tax description
        name1 like lfa1-name1, " VENDOR NAME
     end of itekpo.
data: begin of itab occurs 0,
        ebeln type ekpo-ebeln, " po no.
        aedat type ekpo-aedat, " change date
        lifnr type ekko-lifnr, "  vendor code
        bedat type ekko-bedat, " po date
        matnr type ekpo-matnr, " material no.
        bukrs type ekpo-bukrs, " company code
        werks type ekpo-werks, " plant
        meins type ekpo-meins, " unit
        netpr type ekpo-netpr, " net price
        prdat type ekpo-prdat, " price date = creat date
        txz01 type ekpo-txz01, " short text
        menge type ekpo-menge, " quantity
        netwr type ekpo-netwr, " net value
        brtwr type ekpo-brtwr, " gross value
        mwskz type ekpo-mwskz, " tax code
        text1 like t007s-text1," Tax description
        name1 like lfa1-name1, " VENDOR NAME
        butxt type t001-butxt, " company name
        plant type t001w-name2, " plant name

     end of itab.
data : gv_butxt type char50. " company name
data : gv_plant type t001w-name2. " plant name
*********ALV Declaration*************************

data: it_fieldcatalog type  slis_t_fieldcat_alv with header line,
      wa_fieldcatalog like line of it_fieldcatalog,
      wa_layout type slis_layout_alv,
      it_rec type table of itab,
      it_rec1 type table of itab,
      wa_rec like line of itab,
      wa_itab like line of itab.

data : it_sort type slis_t_sortinfo_alv,
       wa_sort type slis_sortinfo_alv.
constants: lc_page type slis_formname value 'TOP_OF_PAGE'.

*********ALV Declaration*************************
selection-screen : begin of block b with frame title text-100.
select-options:
                company for ekpo-bukrs no intervals default '1000',
                plant for ekpo-werks no intervals default '1021',
                mat_no for ekpo-matnr,
                po_date for ekpo-prdat.
selection-screen  end of block b .

start-of-selection.
  select ebeln aedat matnr bukrs werks netpr prdat txz01 menge meins netwr mwskz brtwr
         from ekpo into corresponding fields of table itekpo
       where
         bukrs in company and
         werks in plant and
         matnr in mat_no and
         prdat in po_date .

end-of-selection.

loop at itekpo.

 select single lifnr bedat from ekko  into (itekpo-lifnr, itekpo-bedat)
                                  where ebeln = itekpo-ebeln.
    select single name1 from lfa1 into (itekpo-name1)
                                  where lifnr = itekpo-lifnr.
    select single text1 from t007s into (itekpo-text1)
                                  where mwskz = itekpo-mwskz and spras = 'E'
                                        and kalsm = 'TAXINN'.


      move :  itekpo-ebeln to itab-ebeln,
              itekpo-aedat to itab-aedat,
              itekpo-lifnr to itab-lifnr,
              itekpo-txz01 to itab-txz01,
              itekpo-menge to itab-menge,
              itekpo-meins to itab-meins,
              itekpo-netwr to itab-netwr,
              itekpo-brtwr to itab-brtwr,
              itekpo-mwskz to itab-mwskz,
              itekpo-name1 to itab-name1,
              itekpo-text1 to itab-text1,
              itekpo-bedat to itab-bedat,
              itekpo-matnr to itab-matnr,
              itekpo-bukrs to itab-bukrs,
              itekpo-werks to itab-werks,
              itekpo-meins to itab-meins,
              itekpo-netpr to itab-netpr,
              itekpo-prdat to itab-prdat.


********** for PLANT name in heading ******
    select single name2
             from t001w
             into gv_plant
             where werks = itekpo-werks.
    move : gv_plant to itab-plant.
**************************************************
append itab.
      clear: itekpo.

    clear: itab.

  endloop.

  if not itab[] is initial.
    perform sort.
    perform populate_field_catalog.
    perform fill_layout.
    perform display_alv.

  else.
    write: ' NO DATA'.
  endif.
*&---------------------------------------------------------------------*
*&      Form  populate_field_catalog
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form populate_field_catalog .

  wa_fieldcatalog-fieldname = 'EBELN'.
  wa_fieldcatalog-seltext_m  = 'PO NUMBER'.
  append wa_fieldcatalog to it_fieldcatalog.
  clear wa_fieldcatalog.

  wa_fieldcatalog-fieldname =  'PRDAT'.
  wa_fieldcatalog-seltext_m  = 'PO Date'.
  wa_fieldcatalog-do_sum = 'X'.
  append wa_fieldcatalog to it_fieldcatalog.
  clear wa_fieldcatalog.

  wa_fieldcatalog-fieldname =  'AEDAT'.
  wa_fieldcatalog-seltext_m  = 'CREAT Date'.
  wa_fieldcatalog-do_sum = 'X'.
  append wa_fieldcatalog to it_fieldcatalog.
  clear wa_fieldcatalog.

  wa_fieldcatalog-fieldname =  'LIFNR'.
  wa_fieldcatalog-seltext_m  = 'VENDOR CODE'.
  append wa_fieldcatalog to it_fieldcatalog.
  clear wa_fieldcatalog.

  wa_fieldcatalog-fieldname =  'NAME1'.
  wa_fieldcatalog-seltext_m  = 'Vendor Name'.
  append wa_fieldcatalog to it_fieldcatalog.
  clear wa_fieldcatalog.

  wa_fieldcatalog-fieldname =  'MATNR'.
  wa_fieldcatalog-seltext_m  = 'MATERIAL CODE'.
  wa_fieldcatalog-no_zero      = 'X'.
  append wa_fieldcatalog to it_fieldcatalog.
  clear wa_fieldcatalog.

  wa_fieldcatalog-fieldname =  'TXZ01'.
  wa_fieldcatalog-seltext_m  = 'MATERIAL DESCRIPTIONS'.
  append wa_fieldcatalog to it_fieldcatalog.
  clear wa_fieldcatalog.

  wa_fieldcatalog-fieldname =  'MENGE'.
  wa_fieldcatalog-seltext_m  = 'Quntity'.
  append wa_fieldcatalog to it_fieldcatalog.
  clear wa_fieldcatalog.

  wa_fieldcatalog-fieldname =  'MEINS'.
  wa_fieldcatalog-seltext_m  = 'UNIT'.
  append wa_fieldcatalog to it_fieldcatalog.
  clear wa_fieldcatalog.

  wa_fieldcatalog-fieldname =  'NETPR'.
  wa_fieldcatalog-seltext_m  = 'Net Price'.
  wa_fieldcatalog-do_sum = 'X'.
  append wa_fieldcatalog to it_fieldcatalog.
  clear wa_fieldcatalog.

  wa_fieldcatalog-fieldname =  'NETWR'.
  wa_fieldcatalog-seltext_m  = 'Net Value'.
  wa_fieldcatalog-do_sum = 'X'.
  append wa_fieldcatalog to it_fieldcatalog.
  clear wa_fieldcatalog.

  wa_fieldcatalog-fieldname =  'MWSKZ'.
  wa_fieldcatalog-seltext_m  = 'Tax Code'.
  append wa_fieldcatalog to it_fieldcatalog.
  clear wa_fieldcatalog.

  wa_fieldcatalog-fieldname =  'TEXT1'.
  wa_fieldcatalog-seltext_m  = 'TAX DESC.'.
  append wa_fieldcatalog to it_fieldcatalog.
  clear wa_fieldcatalog.


endform.                    " populate_field_catalog

*&---------------------------------------------------------------------*
*&      Form  fill_layout
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*
form fill_layout .
  wa_layout-no_input = 'X'.
  wa_layout-colwidth_optimize = 'X'.
  wa_layout-zebra = 'X'.
endform.                    " fill_layout

*&      Form  display_alv
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  -->  p1        text
*  <--  p2        text
*----------------------------------------------------------------------*

form display_alv .
  call function 'REUSE_ALV_GRID_DISPLAY'
    exporting
      i_callback_program      = sy-repid
      i_callback_user_command = 'USER_COMMAND'
      i_callback_top_of_page  = lc_page
      is_layout               = wa_layout
      it_fieldcat             = it_fieldcatalog[]
      i_default               = 'X'
      i_save                  = 'A'
      it_sort                 = it_sort
    tables
      t_outtab                = itab
    exceptions
      program_error           = 1
      others                  = 2.
  if sy-subrc <> 0.
    message id sy-msgid type sy-msgty number
sy-msgno
    with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  endif.

endform.                    " display_alv

********************TOP-OF-PAGE******************
*******************
*&--------------------------------------------------------------------*
*&      Form  TOP_OF_PAGE
*&--------------------------------------------------------------------*
* TOP-OF-PAGE for ALV list display
*---------------------------------------------------------------------*
form top_of_page.
  data: t_header type slis_t_listheader,
        wa_header type slis_listheader,
        gv_date(10),
    sv_date_low(10),
    sv_date_high(10).

* Convert the date format.
  write sy-datum to gv_date mm/dd/yyyy.
  write po_date-low to sv_date_low mm/dd/yyyy.
  write po_date-high to sv_date_high mm/dd/yyyy.

  wa_header-typ  = 'S'.
  wa_header-key =  'PLANT NAME'.
  wa_header-info = gv_plant.
  append wa_header to t_header.
  clear wa_header.

  wa_header-typ  = 'S'.
  wa_header-key =  'DESCRIPTION'.
  wa_header-info = 'LIST OF PURCHASE ORDER  '.
  append wa_header to t_header.
  clear wa_header.

  wa_header-typ  = 'S'.
  wa_header-key =  'DATE'.
  wa_header-info = gv_date .
  append wa_header to t_header.
  clear wa_header.

  wa_header-typ  = 'S'.
  wa_header-key =  'PERIOD FROM'.
  wa_header-info = sv_date_low.
  append wa_header to t_header.
  clear wa_header.

  wa_header-typ  = 'S'.
  wa_header-key =  'PERIOD TO'.
  wa_header-info = sv_date_high.
  append wa_header to t_header.
  clear wa_header.

  call function 'REUSE_ALV_COMMENTARY_WRITE'
    exporting
      it_list_commentary = t_header
      i_logo             = ''.

endform.                    "top_of_page

"TOP_OF_PAGE
*&---------------------------------------------------------------------*
*&      Form  sort
*&---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
form sort .
  wa_sort-spos = '1'.
  wa_sort-tabname = 'ITAB'.
  wa_sort-fieldname = 'EBELN'.
  wa_sort-up = 'X'.
  wa_sort-subtot = 'X'.
*wa_SORT-no_out = 'X'.

  append wa_sort to it_sort.
  clear wa_sort.


endform.                    " SORT
Back to top
View user's profile Send private message
vga
Мастер
Мастер


Age: 170
Joined: 04 Oct 2007
Posts: 1218
Location: Санкт-Петербург

PostPosted: Fri Apr 02, 2010 6:09 pm    Post subject: Reply with quote

There are FM for tax calculation
See http://www.sapnet.ru/viewtopic.php?t=409

_________________
Молитва - это запрос разработчику на изменение кода программы.
Back to top
View user's profile Send private message Blog Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    Russian ABAP Developer's Club Forum Index -> ABAP 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.