0% found this document useful (0 votes)
30 views25 pages

Zsales

sales abap report
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
30 views25 pages

Zsales

sales abap report
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 25

[4:24 PM] Manjunath A V (External)

*&---------------------------------------------------------------------*

*& Include ZSALES_MAIN

*&---------------------------------------------------------------------*

FORM getdata .

SELECT vbeln

FROM likp

INTO TABLE it_likp1

WHERE vkorg IN s_vkorg

AND fkdat IN s_bldat

* AND BLDAT IN S_BLDAT "Commented by satish on 26.10.2009

AND kunnr IN s_kunnr.

IF NOT it_likp1[] IS INITIAL.

SELECT

vbeln

werks

FROM lips

INTO TABLE it_lips

FOR ALL ENTRIES IN it_likp1

WHERE vbeln = it_likp1-vbeln

AND werks IN s_werks.

SORT it_lips.

DELETE ADJACENT DUPLICATES FROM it_lips.

ENDIF.

IF NOT it_lips[] IS INITIAL.

SELECT vbeln

kunnr

kunag

btgew

ntgew
gewei

FROM likp

INTO TABLE it_likp

FOR ALL ENTRIES IN it_lips

WHERE vbeln = it_lips-vbeln.

ENDIF.

IF NOT it_likp[] IS INITIAL.

SELECT vbelv

posnv

vbeln

posnn

vbtyp_n

FROM vbfa

INTO TABLE it_vbfa

FOR ALL ENTRIES IN it_likp

WHERE vbelv = it_likp-vbeln

AND vbtyp_v = 'J'

AND ( vbtyp_n = 'M' OR vbtyp_n = 'U' )." AND vbtyp_n = 'J' .

ENDIF.

SELECT vbeln

vkorg

fkart

knumv

fkdat

netwr

waerk

kurrf

zterm

kunag

xblnr
FROM vbrk

INTO TABLE it_vbrk

WHERE fkdat IN s_bldat

AND vkorg IN s_vkorg

AND fksto = ' '

AND rfbsk <> 'E'

DELETE it_vbrk WHERE fkart = 'S1' .

DELETE it_vbrk WHERE fkart = 'S2' .

DELETE it_vbrk WHERE fkart = 'S3' .

DELETE it_vbrk WHERE fkart = 'ZSN' .

DELETE it_vbrk WHERE fkart = 'ZDC' .

IF p_check = 'X' AND p_check1 NE 'X'.

DELETE it_vbrk WHERE fkart = 'ZISC'.

ELSEIF p_check1 = 'X' AND p_check NE 'X' .

DELETE it_vbrk WHERE ( fkart = 'L2' OR fkart = 'G2' OR fkart = 'RE' ).

ELSEIF p_check1 = '' AND p_check = '' .

DELETE it_vbrk WHERE ( fkart = 'L2' OR fkart = 'G2' OR fkart = 'RE' OR fkart =
'ZISC' ).

ENDIF.

* SELECT vbelv

* posnv

* vbeln

* posnn

* vbtyp_n

* FROM vbfa

* INTO TABLE it_vbfa

* FOR ALL ENTRIES IN it_vbrk

* WHERE vbeln = it_vbrk-vbeln

* AND vbtyp_v = 'J'


* AND ( vbtyp_n = 'M' OR vbtyp_n = 'U' )."

* DELETE ADJACENT DUPLICATES FROM it_vbfa COMPARING vbelv posnv vbeln posnn
vbtyp_n .

IF it_vbrk[] IS NOT INITIAL.

SELECT vbeln

kunnr

parvw

FROM vbpa INTO TABLE it_vbpa

FOR ALL ENTRIES IN it_vbrk

WHERE vbeln = it_vbrk-vbeln

AND kunnr IN s_kunnr

AND parvw = 'AG'.

DELETE ADJACENT DUPLICATES FROM it_vbpa.

SELECT vbeln

posnr

matnr

werks

fkimg

kursk

netwr

aubel

arktx

ntgew

vbelv

FROM vbrp INTO TABLE it_vbrp

FOR ALL ENTRIES IN it_vbpa

WHERE vbeln = it_vbpa-vbeln

AND werks IN s_werks.


ENDIF.

SELECT knumv

kposn

kschl

kwert

FROM konv

INTO TABLE it_konv

FOR ALL ENTRIES IN it_vbrk

WHERE knumv = it_vbrk-knumv

AND ( kschl = 'JIVP' OR kschl = 'JIVC' OR

kschl = 'JSVD' OR kschl = 'JEC3' OR kschl = 'JHC3' OR kschl =


'ZTRA' OR

kschl = 'OTDH' OR kschl = 'K007' OR kschl = 'JEXP' OR kschl =


'JECS' OR

kschl = 'JHCS' OR kschl = 'PR00' OR kschl = 'ZPR0' OR kschl =


'ZS00' OR

kschl = 'ZSUP' OR kschl = 'ZTCS' OR kschl = 'ZTOC' OR kschl =


'JOCG' OR

kschl = 'JOIG' OR kschl = 'JOSG' OR kschl = 'ZCR0' OR kschl =


'JTC1' OR

kschl = 'ZSUR').

LOOP AT it_vbrk. " code commented by Mubashir


24 aug .

SELECT SINGLE belnr

awkey

FROM bkpf

INTO it_bkpf WHERE awkey = it_vbrk-vbeln

AND blart = 'RV'. "#EC *

APPEND it_bkpf.

CLEAR it_bkpf.

ENDLOOP.

SORT it_bkpf BY belnr.

DELETE ADJACENT DUPLICATES FROM it_bkpf.


SELECT belnr

zfbdt

zbd1t

augbl FROM bseg

INTO TABLE it_bseg FOR ALL ENTRIES IN it_bkpf

WHERE belnr = it_bkpf-belnr

AND bschl = '01'.

REFRESH : it_vbpa.

SELECT vbeln kunnr parvw FROM vbpa INTO TABLE it_vbpa

FOR ALL ENTRIES IN it_vbrp

WHERE vbeln = it_vbrp-vbeln

AND ( parvw = 'AG' OR parvw = 'WE' ).

SELECT kunnr land1 name1 FROM kna1 INTO TABLE it_kna1

FOR ALL ENTRIES IN it_vbpa

WHERE kunnr = it_vbpa-kunnr.

SELECT land1 landx50 FROM t005t INTO TABLE it_t005t

FOR ALL ENTRIES IN it_kna1

WHERE spras = 'EN' AND land1 = it_kna1-land1.

SELECT exnum FROM j_1iexcdtl INTO TABLE it_excd

FOR ALL ENTRIES IN it_vbrp

WHERE rdoc2 = it_vbrp-vbeln AND trntyp = 'DLFC' AND status = 'C'.

SELECT vbeln netwr fkart

FROM vbrk INTO TABLE lt_vbrk

FOR ALL ENTRIES IN it_vbrp

WHERE vbeln = it_vbrp-vbeln.

ENDFORM.

FORM layout .

it_layout-colwidth_optimize = 'X'.

it_layout-zebra = 'X'.
ENDFORM.

[4:24 PM] Manjunath A V (External)


*&---------------------------------------------------------------------*

*& Include ZSALES_HEADER

*&---------------------------------------------------------------------*

FORM header_form .

SORT it_vbrp BY vbeln posnr ASCENDING.

SORT it_vbrk[] BY vbeln ASCENDING.

SORT it_vbpa[] BY vbeln ASCENDING.

SORT it_kna1[] BY kunnr ASCENDING.

SORT it_t005t[] BY land1 ASCENDING.

SORT it_bkpf[] BY awkey ASCENDING.

SORT it_bseg[] BY zfbdt ASCENDING.

SORT it_excd[] BY rdoc2 ASCENDING.

SORT it_vbfa[] BY vbeln ASCENDING.

DATA : it_vbfab LIKE it_vbfa OCCURS 100.

it_vbfab[] = it_vbfa[] .

SORT it_vbfab[] BY vbelv vbeln ASCENDING .

DELETE ADJACENT DUPLICATES FROM it_vbfab[] COMPARING vbelv vbeln.

* LOOP AT it_vbrp WHERE fkimg <> 0.

*break abap.

LOOP AT it_vbrk .

READ TABLE it_vbrp WITH KEY vbeln = it_vbrk-vbeln BINARY SEARCH.

IF sy-subrc = 0 AND it_vbrp-fkimg <> 0 .

* ON CHANGE OF it_vbrp-vbeln .

* READ TABLE it_vbrk WITH KEY vbeln = it_vbrp-vbeln BINARY SEARCH.

*************************ADDED TO FETCH PLANT FOR DEBIT/CREDIT/SALES RETURN MEMOS


FROM BILLING DOC ITEMS*****************************

it_head-xblnr = it_vbrk-xblnr.

it_head-werks = it_vbrp-werks.
***********************************************************************************
*************************************

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

CLEAR : it_wght, it_wght1.

CLEAR : it_head-btgew, it_head-ntgew.

READ TABLE it_vbfab INTO it_vbfa WITH KEY vbeln = it_vbrp-vbeln .

IF sy-subrc NE 0 .

CLEAR : it_wght, it_wght1, it_head-btgew, it_head-ntgew.

REFRESH : it_wght, it_wght1.

SELECT vbelv

FROM vbfa INTO TABLE

it_wght WHERE

vbeln = it_vbrp-vbeln.

SORT it_wght BY vbelv ASCENDING.

SELECT vbeln

kunnr

btgew

ntgew

gewei

FROM likp INTO TABLE it_wght1

FOR ALL ENTRIES IN it_wght

WHERE vbeln = it_wght-vbelv.

LOOP AT it_wght1.

IF ( it_wght1-gewei <> 'KG' ).

it_head-btgew = it_head-btgew + ( it_wght1-btgew / 1000 ).

it_head-ntgew = it_head-ntgew + ( it_wght1-ntgew / 1000 ).

ELSE.

it_head-btgew = it_head-btgew + it_wght1-btgew.

it_head-ntgew = it_head-ntgew + it_wght1-ntgew.

ENDIF.
ENDLOOP.

it_head-kunnr = it_wght1-kunnr.

ENDIF.

* break abap.

LOOP AT it_vbfab INTO it_vbfa WHERE vbeln = it_vbrp-vbeln .

LOOP AT it_likp WHERE vbeln = it_vbfa-vbelv .

* ON CHANGE OF it_vbfa-vbelv .

IF ( it_likp-gewei <> 'KG' ).

it_head-btgew = it_head-btgew + ( it_likp-btgew / 1000 ).

it_head-ntgew = it_head-ntgew + ( it_likp-ntgew / 1000 ).

ELSE.

it_head-btgew = it_head-btgew + it_likp-btgew.

it_head-ntgew = it_head-ntgew + it_likp-ntgew.

ENDIF.

IF it_head-kunnr IS INITIAL .

it_head-kunnr = it_likp-kunnr.

ENDIF.

* endon .

ENDLOOP.

CLEAR it_vbfa .

ENDLOOP.

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

* it_head-kunnr = it_likp-kunnr.

READ TABLE it_kna1 WITH KEY kunnr = it_head-kunnr BINARY SEARCH.

IF sy-subrc EQ 0.

it_head-custname = it_kna1-name1.

ENDIF.

CLEAR : g_name1.

CLEAR : land1.
READ TABLE it_vbpa WITH KEY vbeln = it_vbrp-vbeln parvw = 'AG' .

IF sy-subrc NE 0.

READ TABLE it_vbpa WITH KEY vbeln = it_vbrp-vbeln parvw = 'WE' .

IF sy-subrc EQ 0.

it_head-sold_to = it_vbpa-kunnr.

ENDIF.

ENDIF.

IF sy-subrc EQ 0.

it_head-sold_to = it_vbpa-kunnr.

ENDIF.

READ TABLE it_kna1 WITH KEY kunnr = it_vbpa-kunnr BINARY SEARCH.

IF sy-subrc EQ 0.

it_head-soldname = it_kna1-name1.

READ TABLE it_t005t WITH KEY land1 = it_kna1-land1 BINARY SEARCH .

IF sy-subrc EQ 0.

it_head-landx50 = it_t005t-landx50.

ENDIF.

ENDIF.

CLEAR : g_name1.

IF it_vbrk-fkart = 'G2' OR it_vbrk-fkart = 'L2' OR it_vbrk-fkart = 'ZTIN'.


"For Debit Memo,Credit Memo and Tooling Invoice Shiptopart is same as sold to party

it_head-kunnr = it_vbrk-kunag.

it_head-custname = it_head-soldname.

ENDIF.

it_head-vbeln = it_vbrp-vbeln.

it_head-fkdat = it_vbrk-fkdat.

* ITAB-NETWR = IT_VBRP-NETWR.

it_head-waerk = it_vbrk-waerk.

it_head-vkorg = it_vbrk-vkorg.

READ TABLE it_bkpf WITH KEY awkey = it_vbrp-vbeln .


it_head-belnr = it_bkpf-belnr.

READ TABLE it_bseg WITH KEY belnr = it_bkpf-belnr .

IF sy-subrc EQ 0.

it_head-augbl = it_bseg-augbl.

g_date = it_bseg-zfbdt.

days = it_bseg-zbd1t.

ENDIF.

IF it_bseg-augbl IS INITIAL.

it_head-augbl = 'NotCleared'.

ENDIF.

* IF DAYS = 0.

* LV_DATE1 = G_DATE.

* ENDIF.

CALL FUNCTION 'BKK_ADD_WORKINGDAY'

EXPORTING

i_date = g_date

i_days = days

i_calendar1 = 'X'

* I_CALENDAR2 =

IMPORTING

e_date = lv_date1

* E_RETURN =

* SY-SUBRC.

IF days = 0.

lv_date1 = g_date.

ENDIF.

it_head-paydate = lv_date1.

* READ TABLE lt_vbrk WITH KEY vbeln = it_vbrp-vbeln .


IF it_vbrk-fkart = 'G2'. "added by narasimha
kini k to minus the credit memo

it_head-netwr = - ( it_vbrk-netwr ).

it_head-valinr = it_head-netwr * it_vbrk-kurrf.

ELSE.

it_head-netwr = it_vbrk-netwr.

it_head-valinr = it_head-netwr * it_vbrk-kurrf.

ENDIF.

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

IF it_vbrk-fkart = 'ZINJ' OR it_vbrk-fkart = 'ZTIN'. "For JObwork inv and


Tooling inv

it_head-exnum = it_vbrk-vbeln. "Excise inv is same


as INV No

ELSE.

READ TABLE it_excd WITH KEY rdoc2 = it_vbrp-vbeln BINARY SEARCH.

IF sy-subrc EQ 0.

it_head-exnum = it_excd-exnum.

ENDIF.

ENDIF.

PERFORM gettax_header.

****************added by narasimha kini k to calculate bill value for SALES


org=1100/1200 which is equal to invoice value(inr)*************

IF it_vbrk-vkorg = '1100' OR it_vbrk-vkorg = '1200'.

it_head-bill_value = it_head-valinr.

ELSE.

it_head-bill_value = it_head-valinr + it_vbrk-mwsbk.

ENDIF.

IF it_vbrk-fkart = 'G2'.

it_head-bill_value = - ( it_head-bill_value ).

ENDIF.

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

* ENDIF.

* APPEND ITAB.

APPEND it_head.

CLEAR it_head.

CLEAR : g_name1,

netval_fc ,

fkart,

it_vbfa,

g_vtext,

lv_date1,

g_vtext,

it_vbrk,

* wa_bseg,

it_bseg,

it_vbpa,

it_kna1,

it_bkpf,

it_likp,

* it_cinv,

it_konv.

* it_ewbill.

CLEAR : g_date,

days,

taxval.

* ENDON.

ENDIF .

ENDLOOP.

ENDFORM.

FORM header_vkorg .
LOOP AT it_head WHERE vkorg = '1000'.

it_head-valinr = it_head-valinr - ( it_head-kwertjecs + it_head-kwertjexp +


it_head-kwertjhcs ).

it_head-netwr = it_head-netwr - ( it_head-kwertjecs + it_head-kwertjexp +


it_head-kwertjhcs ).

MODIFY it_head.

CLEAR it_head.

ENDLOOP.

ENDFORM.

FORM fillcatalog .

PERFORM fill_field1 USING :

* 'SNO' 'Sl.No' '10' 'IT_FINAL' ' ',

'KUNNR' 'Ship to Party #' '10' 'IT_HEAD' ' ' '' ' ' ' ' '
',

'CUSTNAME' 'Ship to Party Name' '7' 'IT_HEAD' ' ' '' ' ' '
' ' ',

'SOLD_TO' 'Sold to Party #' '10' 'IT_HEAD' ' ' '' ' ' ' ' '
',

'LANDX50' 'Country' '50' 'IT_HEAD' ' ' '' ' ' ' ' ' ',

'SOLDNAME' 'Sold to Party Name' '7' 'IT_HEAD' ' ' '' ' ' '
' ' ',

'WERKS' 'Plant' '5' 'IT_HEAD' ' ' '' ' ' ' ' ' ',

'VBELN' 'Inv #' '10' 'IT_HEAD' ' ' '' 'X' 'C71' ' ',

'FKDAT' 'Inv date' '10' 'IT_HEAD' ' ' '' ' ' ' ' ' ',

'PAYDATE' 'Payment Due Date' '10' 'IT_HEAD' ' ' '' ' ' '
' ' ',

* 'MATNR' 'Material Number' '18' 'IT_HEAD' ' ' ' ' ' ' ' ' '
',

* 'KDMAT' 'Customer Material' '18' 'IT_HEAD' ' ' ' ' ' ' ' '
' ',

* 'FKIMG' 'Quantity in PC' '13' 'IT_HEAD' ' ' ' ' ' ' ' '
'X',

'NETWR' 'Inv val(Dy+tx)Docur' '40' 'IT_HEAD' ' ' '' ' '
'C10' 'X',

'PR00' 'BasVal Docur(SP*QTY)' 'IT_HEAD' ' ' ' ' '' ' '
'C10' 'X',

'PR00INR' 'BasPrice(SP*QTY)-INR' 'IT_HEAD' ' ' ' ' '' ' '
'C10' 'X',

'OTDH' 'ToolCost-Doc Curr' 'IT_HEAD' ' ' ' ' '' ' ' 'C10'
'X',

'OTDHINR' 'ToolCost-INR' 'IT_HEAD' ' ' ' ' '' ' ' 'C10'
'X',

'K007' 'Discount in Doc Curr' 'IT_HEAD' ' ' ' ' '' ' '
'C10' 'X',

'K007INR' 'Discount in INR' 'IT_HEAD' ' ' ' ' '' ' ' 'C10'
'X',

'ZTRA' 'Trans Cost Doc Curr' 'IT_HEAD' ' ' ' ' '' ' ' 'C10'
'X',

'ZTRAINR' 'TransportCost in INR' 'IT_HEAD' ' ' ' ' '' ' '
'C10' 'X',

'VALINR' 'InvVal(ASV-TR&TC)INR' '40' 'IT_HEAD' ' ' '' ' '


'C10' 'X',

'EXNUM' 'Excise Inv #' '10' 'IT_HEAD' ' ' ' ' '' ' '
'X',

* 'PRICEPC' 'Price per PC in DOC CURR' '13' 'IT_HEAD' ' ' ' '
' ' ' ' 'X' ,

* 'PRICEPCINR' 'Price per PC in INR' '13' 'IT_HEAD' ' ' ' '
' ' ' ' ' ',

'WAERK' 'Inv Currency' '10' 'IT_HEAD' ' ' '' ' ' ' ' ' ',

'BEDINR' 'BED(INR)' '13' 'IT_HEAD' ' ' '' ' ' ' ' 'X',

'ECESSINR' 'Excise Ecess(INR)' '13' 'IT_HEAD' ' ' ' ' ' ' '
' 'X',

'SHECESSINR' 'Excise SCess(INR)' '13' 'IT_HEAD' ' ' ' ' ' '
' ' 'X',

'TOTEXCISE' 'Total Exc Duty-INR' '13' 'IT_HEAD' ' ' ' ' ' '
' ' 'X',

'VATCST' 'VAT or CST' '13' 'IT_HEAD' ' ' ' ' ' ' ' ' ' ',

'TAXVAL' 'Tax(INR)' '13' 'IT_HEAD' ' ' ' ' ' ' ' ' 'X',

'JVSD' 'Serv Tax-Basic-INR' '13' 'IT_HEAD' ' ' ' ' ' ' ' '
'X',

'JEC3' 'Serv Tax Ecess-INR' '13' 'IT_HEAD' ' ' ' ' ' ' ' '
'X',

'JHC3' 'Serv Tax SHcess-INR' '13' 'IT_HEAD' ' ' ' ' ' ' ' '
'X',

'TOTSERVTAX' 'Total Serv Tax-INR' '13' 'IT_HEAD' ' ' ' ' ' '
' ' 'X',

* 'KURRF' 'Exchange rate' '10' 'IT_HEAD' ' ' '',

* 'VALINR' 'Net Value(INR)' '10' 'IT_HEAD' ' ' '' ' ' ' ',

'TOTDUTYTAX' 'Total duty+ Tax-INR' '13' 'IT_HEAD' ' ' ' '
' ' ' ' 'X',

'TOTAL' 'GRInval-Dut+Tax-INR' '15' 'IT_HEAD' ' ' ' ' ' '
' ' 'X',

* 'BILL_VALUE' 'BILL VALUE(INR)' '15' 'IT_HEAD' ' ' ' ' '
' ' ' 'X',

'BELNR' 'Accounting Doc #' '10' 'IT_HEAD' ' ' '' 'X' 'C60'
' ',

'AUGBL' 'Clearing Status' '10' 'IT_HEAD' ' ' ' ' ' ' ' ' '
',

'ZTCSINR' 'TCS Value' '10' 'IT_HEAD' ' ' ' ' ' ' ' ' ' ',

'BTGEW' 'Gross Weight(Kg)' '18' 'IT_HEAD' ' ' ' ' ' ' ' ' '
',

'NTGEW' 'Net Weight(Kg)' '18' 'IT_HEAD' ' ' ' ' ' ' ' ' ' ',

'XBLNR' 'GST Invoice' '18' 'IT_HEAD' ' ' '' ' ' ' ' ' ',

'CGST' 'CGST(INR)' '13' 'IT_HEAD' ' ' ' ' ' ' ' ' 'X',

'SGST' 'SGST(INR)' '13' 'IT_HEAD' ' ' ' ' ' ' ' ' 'X',

'IGST' 'IGST(INR)' '13' 'IT_HEAD' ' ' ' ' ' ' ' ' 'X',

'GTCS' 'TCS(INR)' '13' 'IT_HEAD' ' ' ' ' ' ' ' ' 'X'.

ENDFORM.

FORM display_header .

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = sy-repid

i_callback_user_command = 'USER_COMMANDS'

i_callback_top_of_page = 'TOP_OF_PAGE'

i_grid_title = 'Sales Report'

is_layout = it_layout
it_fieldcat = it_fieldcat

i_save = 'X'

TABLES

t_outtab = it_head[]

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.

FORM gettax_header .

DATA : g_jexp LIKE konv-kwert. "#EC NEEDED

DATA : zfkart LIKE vbrk-fkart.

DATA : zcr00 LIKE it_konv-kwert.

CLEAR : zfkart.

* SELECT SINGLE fkart FROM vbrk INTO zfkart WHERE vbeln = it_vbrk-vbeln.

zfkart = it_vbrk-fkart .

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

AND kschl = 'PR00'. "Basic Price (PR00)

it_head-pr00 = it_head-pr00 + it_konv-kwert.

ENDLOOP.

" ADDD BY MUBASHIR 2 AUG 2023 KSCHL = ZSUR

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

AND kschl = 'ZSUR'. "Basic Price (PR00)

it_head-pr00 = it_head-pr00 + it_konv-kwert.

ENDLOOP.
""""""ADDD BY MUBASHIR 2 AUG 2023

* IF sy-subrc = 0. """"""comm BY
MUBASHIR 5 AUG 2023

it_head-pr00inr = it_head-pr00 * it_vbrk-kurrf. "Basic Price in INR


(PR00)

* ENDIF. """"""comm BY
MUBASHIR 5 AUG 2023

IF ( zfkart = 'G2' OR zfkart = 'RE' ).

CLEAR : zcr00.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

AND kschl = 'ZCR0'. "Basic Price (PR00)

zcr00 = zcr00 + it_konv-kwert.

ENDLOOP.

IF sy-subrc = 0.

it_head-pr00 = - ( zcr00 ).

it_head-pr00inr = it_head-pr00 * it_vbrk-kurrf.

ELSE.

it_head-pr00 = - ( it_head-pr00 ).

it_head-pr00inr = it_head-pr00 * it_vbrk-kurrf.

ENDIF.

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

AND kschl = 'ZPR0'. "Basic PRice (ZPR0)

it_head-pr00 = it_head-pr00 + it_konv-kwert.

ENDLOOP.

IF sy-subrc = 0.

it_head-pr00inr = it_head-pr00 * it_vbrk-kurrf. "Basic Price in


INR(Zpr0)

ENDIF.

CLEAR it_konv.
LOOP AT it_konv WHERE knumv = it_vbrk-knumv

AND kschl = 'ZS00'. "Basic PRice


(ZS00)Service Tax

it_head-pr00 = it_head-pr00 + it_konv-kwert.

ENDLOOP.

IF sy-subrc = 0.

it_head-pr00inr = it_head-pr00 * it_vbrk-kurrf. "Basic Price in


INR(ZS00)Service TAx

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

AND kschl = 'ZSUP'. "Basic PRice (ZSUP)SUPP


Invoice

it_head-pr00 = it_head-pr00 + it_konv-kwert.

ENDLOOP.

IF sy-subrc = 0.

it_head-pr00inr = it_head-pr00 * it_vbrk-kurrf. "Basic Price in


INR(ZSUP)Supp Invoice

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

AND kschl = 'ZTOC'. "Tooling invoice

it_head-pr00 = it_head-pr00 + it_konv-kwert.

ENDLOOP.

IF sy-subrc = 0.

it_head-pr00inr = it_head-pr00 * it_vbrk-kurrf. "Tooling invoice


price.

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

AND kschl = 'K007'. "Discount (K007)

it_head-k007 = it_head-k007 + it_konv-kwert.


ENDLOOP.

IF sy-subrc = 0.

it_head-k007inr = it_head-k007 * it_vbrk-kurrf. "Discount in INR

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

* KPOSN = IT_VBRP-POSNR

AND kschl = 'JEXP'. "BED

************************ADDING CODE**************************************

it_head-kwertjexp = it_head-kwertjexp + it_konv-kwert.

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

it_head-bedinr = it_konv-kwert + it_head-bedinr.

ENDLOOP.

IF sy-subrc = 0.

it_head-bedinr = it_head-bedinr * it_vbrk-kurrf.

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

* KPOSN = IT_VBRP-POSNR

AND kschl = 'JECS'. "Ecess

***********************************CHANGE OF CODE*********************

it_head-kwertjecs = it_head-kwertjecs + it_konv-kwert.

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

it_head-ecessinr = it_konv-kwert + it_head-ecessinr.

ENDLOOP.

IF sy-subrc = 0.

it_head-ecessinr = it_head-ecessinr * it_vbrk-kurrf.

ENDIF.

* CLEAR IT_KONV.
* ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

** KPOSN = IT_VBRP-POSNR

AND kschl = 'JHCS'. "Shecess

**************************ADDING A CODE********************************

it_head-kwertjhcs = it_head-kwertjhcs + it_konv-kwert.

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

it_head-shecessinr = it_konv-kwert + it_head-shecessinr.

ENDLOOP.

IF sy-subrc = 0.

it_head-shecessinr = it_head-shecessinr * it_vbrk-kurrf.

ENDIF.

it_head-totexcise = it_head-bedinr + it_head-ecessinr + it_head-shecessinr.


"Total Excise

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

* KPOSN = IT_VBRP-POSNR

AND kschl = 'JSVD'. "Service TAx

it_head-jvsd = it_konv-kwert + it_head-jvsd.

ENDLOOP.

IF sy-subrc = 0.

it_head-jvsd = it_head-jvsd * it_vbrk-kurrf.

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

* KPOSN = IT_VBRP-POSNR

AND kschl = 'JEC3'. "Service Tax Ecess

it_head-jec3 = it_konv-kwert + it_head-jec3.

ENDLOOP.
IF sy-subrc = 0.

it_head-jec3 = it_head-jec3 * it_vbrk-kurrf.

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

* KPOSN = IT_VBRP-POSNR

AND kschl = 'JHC3'. "Service Tax


Shecess

it_head-jhc3 = it_konv-kwert + it_head-jhc3.

ENDLOOP.

IF sy-subrc = 0.

it_head-jhc3 = it_head-jhc3 * it_vbrk-kurrf.

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

* KPOSN = IT_VBRP-POSNR

AND kschl = 'OTDH'. "Tooling Cost

it_head-otdh = it_konv-kwert + it_head-otdh.

ENDLOOP.

IF sy-subrc = 0.

it_head-otdhinr = it_head-otdh * it_vbrk-kurrf. "Tooling Cost in


INR

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

* KPOSN = IT_VBRP-POSNR

AND kschl = 'ZTRA'. "Transportation


Charges

it_head-ztra = it_konv-kwert + it_head-ztra.

ENDLOOP.

IF sy-subrc = 0.
it_head-ztrainr = it_head-ztra * it_vbrk-kurrf. "Transportation
Charges in INR

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

* KPOSN = IT_VBRP-POSNR

AND kschl = 'ZTCS'. "Transportation


Charges

it_head-ztcsinr = it_konv-kwert + it_head-ztcsinr.

ENDLOOP.

IF sy-subrc = 0.

it_head-ztcsinr = it_head-ztcsinr * it_vbrk-kurrf.


"Transportation Charges in INR

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

* KPOSN = IT_VBRP-POSNR

AND kschl = 'JIVP'. "VAT

it_head-taxval = it_konv-kwert + it_head-taxval.

ENDLOOP.

IF sy-subrc = 0.

it_head-taxval = it_head-taxval * it_vbrk-kurrf. "VAT in INR

* if it_head-taxval is not initial.

it_head-vatcst = 'VAT'. "VAT or CST

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

* KPOSN = IT_VBRP-POSNR

AND kschl = 'JIVC' .

* KSCHL = 'JIVC'. "VAT

* IF SY-SUBRC = 0.
it_head-taxval = it_konv-kwert + it_head-taxval.

ENDLOOP.

* CLEAR IT_KONV.

* ENDIF.

IF sy-subrc = 0.

it_head-vatcst = 'CST'.

it_head-taxval = it_head-taxval * it_vbrk-kurrf. "CST in INR

ENDIF.

* IF IT_HEAD-TAXVAL IS NOT INITIAL.

* IT_HEAD-VATCST = 'CST'. "VAT or CST

* ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

AND kschl = 'JOCG'. "CGST

it_head-cgst = it_konv-kwert + it_head-cgst.

ENDLOOP.

IF sy-subrc = 0.

it_head-cgst = it_head-cgst * it_vbrk-kurrf. "CGST in INR

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

AND kschl = 'JOSG'. "SGST

it_head-sgst = it_konv-kwert + it_head-sgst.

ENDLOOP.

IF sy-subrc = 0.

it_head-sgst = it_head-sgst * it_vbrk-kurrf. "SGST in INR

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv


AND kschl = 'JTC1'. "JTC1

it_head-gtcs = it_konv-kwert + it_head-gtcs.

ENDLOOP.

IF sy-subrc = 0.

it_head-gtcs = it_head-gtcs * it_vbrk-kurrf. "SGST in INR

ENDIF.

CLEAR it_konv.

LOOP AT it_konv WHERE knumv = it_vbrk-knumv

AND kschl = 'JOIG'. "IGST

it_head-igst = it_konv-kwert + it_head-igst.

ENDLOOP.

IF sy-subrc = 0.

it_head-igst = it_head-igst * it_vbrk-kurrf. "CGST in INR

ENDIF.

IF ( zfkart = 'G2' OR zfkart = 'RE' ).

it_head-cgst = - ( it_head-cgst ).

it_head-sgst = - ( it_head-sgst ).

it_head-igst = - ( it_head-igst ).

ENDIF.

it_head-totservtax = it_head-jvsd + it_head-jec3 + it_head-jhc3. "Total Service


Tax

it_head-totdutytax = it_head-totexcise + it_head-taxval + it_head-totservtax +


it_head-ztcsinr. "Total Duty (Tot Excise + VATorCST + TOTServiceTAX)

it_head-total = it_head-valinr + it_head-taxval. "Gross Value in INR

CLEAR : zfkart.

ENDFORM.

You might also like