Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Tax details not geting populated

Hi Folks,

I have a problem in populating tax details.can anyone here please let me know where I am going wrong in the code.The last butone field is caluculation and can be ignored for the time being.

REPORT ZMMEXCISETEST .

*Tables.

TABLES : ekbe,

rbkp,

rseg,

bkpf,

bset,

lfa1,

makt.

*Declaration for ALV.

TYPE-POOLS: slis.

DATA : itfieldcat TYPE slis_t_fieldcat_alv WITH HEADER LINE.

DATA : itrepid TYPE sy-repid.

itrepid = sy-repid.

DATA : itevent TYPE slis_t_event.

DATA : itlistheader TYPE slis_t_listheader.

DATA : walistheader LIKE LINE OF itlistheader.

DATA : itlayout TYPE slis_layout_alv.

DATA : top TYPE slis_formname.

DATA : itsort TYPE slis_t_sortinfo_alv WITH HEADER LINE.

DATA : itsort1 TYPE slis_sortinfo_alv.

DATA : itprintparams TYPE slis_print_alv.

DATA : itvariant TYPE disvariant.

DATA : date1 LIKE rbkp-budat,

date2 LIKE rbkp-budat,

string1(65) TYPE c,

title(65) TYPE c.

DATA:L_BELNR1 TYPE BKPF-BELNR,

L_AWKEY1 TYPE BKPF-AWKEY.

*Internal table Declarations.

TYPES: BEGIN OF ty_itfinal,

sl_no TYPE sy-tabix, " FOR SERIAL No.

belnr TYPE rbkp-belnr, " Material Doc. No.

budat TYPE rbkp-budat, " Posting Date in the Document

lifnr TYPE rbkp-lifnr, " Vendor Code

xblnr TYPE rbkp-xblnr, " Supplier Document Number

bldat TYPE rbkp-bldat, " Document Date

kursf TYPE rbkp-kursf, "

buzei TYPE rseg-buzei, " miro line item

ebeln TYPE rseg-ebeln, " po no

ebelp TYPE rseg-ebelp, " PO line item

matnr TYPE rseg-matnr, " part no

bwtar TYPE rseg-bwtar, " valuation type

menge TYPE rseg-menge, " quantity

wrbtr TYPE rseg-wrbtr, " value of goods

lfbnr TYPE rseg-lfbnr, "

wrbtr_r TYPE rseg-wrbtr, " Rate

wrbtr_v TYPE rseg-wrbtr, " Value of Goods

bewtp TYPE ekbe-bewtp, " PO history category

budat1 TYPE ekbe-budat, "

hwste_c TYPE bset-hwste, " ED/CVD(Tax Amount in Local Currency)

hwste_e TYPE bset-hwste, " E.Cess(Tax Amount in Local Currency)

hwste_s TYPE bset-hwste, " Snhe.Cess(Tax Amount in Local Currency)

accno TYPE bkpf-belnr, "

BELNR1 TYPE BKPF-BELNR,

AWKEY TYPE BKPF-AWKEY,

name1 TYPE lfa1-name1, " vendor name

maktx TYPE makt-maktx, " Material Description

END OF ty_itfinal.

DATA: itfinal TYPE ty_itfinal OCCURS 0 WITH HEADER LINE.

TYPES : BEGIN OF ty_itab1,

belnr LIKE rbkp-belnr, " Material Doc. No.

budat LIKE rbkp-budat, " Posting Date in the Document

lifnr LIKE rbkp-lifnr, " Vendor Code

xblnr LIKE rbkp-xblnr, " Supplier Document Number

bldat LIKE rbkp-bldat, " Document Date

kursf LIKE rbkp-kursf, " Ex.Rate

END OF ty_itab1.

DATA :itab1 TYPE ty_itab1 OCCURS 0 WITH HEADER LINE.

*Selection Screen

SELECTION-SCREEN BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.

PARAMETERS: p_bukrs LIKE rbkp-bukrs OBLIGATORY.

PARAMETERS: p_werks like rseg-werks OBLIGATORY.

SELECT-OPTIONS: s_budat FOR rbkp-budat OBLIGATORY.

PARAMETERS : p_gjahr LIKE rseg-gjahr OBLIGATORY.

SELECTION-SCREEN END OF BLOCK block1.

date1 = s_budat-low.

date2 = s_budat-high.

PERFORM getdata.

PERFORM alv.

&----


*& Form GETDATA

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM getdata .

*Invoice Header

SELECT belnr

budat

lifnr

xblnr

bldat

kursf

FROM rbkp

INTO TABLE itab1

WHERE gjahr = p_gjahr.

IF sy-subrc NE 0.

MESSAGE 'No Values.' TYPE 'S'.

ELSE.

LOOP AT itab1.

IF itab1-budat NOT IN s_budat.

DELETE itab1.

ENDIF.

ENDLOOP.

ENDIF.

*Invoice Item.

LOOP AT itab1.

MOVE-CORRESPONDING itab1 TO itfinal.

SELECT buzei

matnr

bwtar

menge

wrbtr

lfbnr

XBLNR

FROM rseg INTO CORRESPONDING FIELDS OF itfinal

WHERE belnr = ITAB1-belnr.

ENDSELECT.

IF itfinal-lfbnr IS INITIAL.

SELECT belnr

budat

FROM ekbe INTO (itfinal-lfbnr, itfinal-budat1)

WHERE belnr = itab1-belnr.

ENDSELECT.

ENDIF.

*P.O. History

SELECT ebeln

ebelp

bewtp

FROM ekbe

INTO CORRESPONDING FIELDS OF itfinal

WHERE belnr = itab1-belnr.

ENDSELECT.

*<b>Accounting Doc.No.

SELECT BELNR

AWKEY

FROM bkpf INTO (ITFINAL-BELNR1,itfinal-aWKEY)

WHERE blart = 'RE' AND

GJAHR = P_GJAHR AND

BUKRS = P_BUKRS AND

BUDAT IN S_BUDAT.</b>

*Vendor Details.

SELECT name1

FROM lfa1 INTO (itfinal-name1)

WHERE lifnr = itfinal-lifnr.

ENDSELECT.

*Material Description.

SELECT maktx

FROM makt INTO (itfinal-maktx)

WHERE matnr = itfinal-matnr.

ENDSELECT.

ENDSELECT.

APPEND ITFINAL.

ENDLOOP.

<b>LOOP AT ITFINAL.

*Excise Duty and Ed.Cess.

SELECT HWSTE

FROM BSET INTO (ITFINAL-HWSTE_C)

WHERE BELNR = ITFINAL-BELNR1 AND

GJAHR = P_GJAHR AND

BUKRS = P_BUKRS AND

KSCHL = 'JMO1' AND

KSCHL = 'JMO2'.

ENDSELECT.

SELECT HWSTE

FROM BSET INTO (ITFINAL-HWSTE_E)

WHERE BELNR = ITFINAL-BELNR1 AND

BUKRS = P_BUKRS AND

GJAHR = P_GJAHR AND

KSCHL = 'JEC1' AND

KSCHL = 'JEC2'.

ENDSELECT.

MODIFY ITFINAL.

ENDLOOP.</b>

*Filtering the Internal Table w.r.t P.O History Category.

LOOP AT itfinal.

IF itfinal-bewtp EQ 'E'.

DELETE itfinal.

ENDIF.

itfinal-wrbtr_v = itfinal-wrbtr * itfinal-kursf.

itfinal-wrbtr_r = itfinal-wrbtr_v / itfinal-menge.

MODIFY itfinal.

ENDLOOP.

ENDFORM. " GETDATA

&----


*& Form ALV

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM alv .

IF itfinal[] IS INITIAL.

MESSAGE 'No Values exist for the Selection.' TYPE 'S'.

STOP.

ENDIF.

LOOP AT itfinal.

itfinal-sl_no = sy-tabix.

MODIFY itfinal.

ENDLOOP.

DEFINE j_fieldcat.

itfieldcat-fieldname = &1.

itfieldcat-col_pos = &2.

itfieldcat-seltext_l = &3.

itfieldcat-do_sum = &4.

itfieldcat-outputlen = &5.

itfieldcat-edit = &6.

append itfieldcat to itfieldcat.

clear itfieldcat.

END-OF-DEFINITION.

j_fieldcat 'SL_NO' '' 'SL. NO' '' 03 ''.

j_fieldcat 'LFBNR' '' 'MATERIAL DOC.No.' '' 10 ''.

j_fieldcat 'BUDAT' '' 'POSTING DATE.' '' 08 ''.

j_fieldcat 'LIFNR' '' 'VENDOR' '' 10 ''.

j_fieldcat 'NAME1' '' 'VENDOR NAME.' '' 35 ''.

j_fieldcat 'XBLNR' '' 'SUPPLIER DOC.No.' ' ' 10 '' .

j_fieldcat 'BLDAT' '' 'ACCOUNTING DOC.DATE' '' 08 ''.

j_fieldcat 'MATNR' '' 'PART No.' '' 18 ''.

j_fieldcat 'MAKTX' '' 'DESCRIPTION' '' 40 '' .

j_fieldcat 'MENGE' '' 'QUANTITY RECEIVED' '' 08 ''.

j_fieldcat 'KURSF' '' 'ECHANGE RATE' '' 13 ''.

j_fieldcat 'WRBTR_R' '' 'RATE' '' 13 ''.

j_fieldcat 'WRBTR_V' '' 'VALUE OF GOODS' '' 13 ''.

j_fieldcat 'HWSTE_C' '' 'ED/CVD' '' 13 ''.

j_fieldcat 'HWST_E' '' 'EDU.CESS' '' 13 ''.

j_fieldcat 'HWST_S' '' 'S&HE.CESS' '' 13 ''.

j_fieldcat 'BWTAR' '' 'VALUTAION TYPE' '' 10 ''.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

is_layout = itlayout

i_callback_user_command = ' '

i_callback_top_of_page = 'TOP'

it_fieldcat = itfieldcat[]

i_save = 'A'

  • is_variant = ITVARIANT

it_events = itevent[]

  • is_print = ITPRINTPARAMS

it_sort = itsort[]

TABLES

t_outtab = itfinal

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. " ALV

&----


*& Form TOP

&----


  • Top of page for ALV Report

----


FORM top.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

i_list_type = 0

IMPORTING

et_events = itevent

  • EXCEPTIONS

  • LIST_TYPE_WRONG = 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.

string1 = 'Excise Input Details '.

CONCATENATE string1 p_werks date1 'to' date2 INTO title SEPARATED BY space.

walistheader-typ = 'H'.

walistheader-info = title.

APPEND walistheader TO itlistheader.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

it_list_commentary = itlistheader

  • I_LOGO = ''.

  • I_END_OF_LIST_GRID =

.

  • ENDIF.

CLEAR itlistheader.

  • ENDIF.

ENDFORM. "TOP

Thanks,

K.Kiran.

Message was edited by:

Kiran K

Tags:
Not what you were looking for? View more on this topic or Ask a question