Skip to Content
0
Former Member
Nov 20, 2012 at 07:03 AM

Coding is not running correct in main area of table in smartform

21 Views

I have created a smart form for service order .The code for vat calculation is running correct in footer of the table while the same code is displaying wrong value while i ma writing in main area of table.Actually i have written this in main area because the vat is different for each line item.It is taking the value of v_vat as 0 which is for first line item and taking for second

**************************** For ST/VAT Charges*****************
DATA: V_MWSKZ LIKE EKPO-MWSKZ,
V_KNUMH TYPE A363-KNUMH.
CLEAR V_KNUMH.



SELECT SINGLE KNUMH FROM A363 INTO V_KNUMH
WHERE KAPPL = 'TX' AND
( KSCHL = 'JMOP' OR KSCHL = 'JMIP' )
AND WERKS = L_XEKPO-WERKS
AND LIFNR = ZXEKKO-LIFNR
AND DATBI >= ODT AND DATAB <= ODT
AND MATNR = L_XEKPO-MATNR.


DATA : V_NETWR LIKE EKPO-NETWR.
CLEAR : V_NETWR.


SELECT SINGLE NETWR INTO V_NETWR FROM EKPO
WHERE EBELN = L_XEKPO-EBELN
AND EBELP = L_XEKPO-EBELP.


CLEAR V_KNUMH.

SELECT SINGLE MWSKZ INTO V_MWSKZ FROM EKPO
WHERE EBELN = L_XEKPO-EBELN AND EBELP = L_XEKPO-EBELP.

SELECT SINGLE KNUMH FROM A950 INTO V_KNUMH
WHERE KAPPL = 'TX'
AND ( KSCHL = 'JVRD' )
AND LAND1 = 'IN' AND MWSKZ = V_MWSKZ AND
DATBI >= ODT AND DATAB <= ODT .

SELECT SINGLE KNUMH FROM A950 INTO V_KNUMH
WHERE KAPPL = 'TX'
AND ( KSCHL = 'JVRN' )
AND LAND1 = 'IN' AND MWSKZ = V_MWSKZ AND
DATBI >= ODT AND DATAB <= ODT .


SELECT SINGLE KNUMH FROM A950 INTO V_KNUMH
WHERE KAPPL = 'TX'
AND ( KSCHL = 'JIPC' )
AND LAND1 = 'IN' AND MWSKZ = V_MWSKZ AND
DATBI >= ODT AND DATAB <= ODT .



SELECT SINGLE KBETR FROM KONP INTO V_VAT
WHERE KNUMH = V_KNUMH." AND loevm_ko NE 'X'.

V_VAT = V_VAT / 10.
STR90 = STR90 + V_VAT.
V_VAT = ( V_NETWR ) * V_VAT / 100.

STR10 = STR10 + V_VAT.
****************************************************************************************
IF V_VAT = '0.00'.
CLEAR V_KNUMH.


SELECT SINGLE NETWR INTO V_NETWR FROM EKPO WHERE EBELN = L_XEKPO-EBELN
AND EBELP = L_XEKPO-EBELP.

CLEAR V_KNUMH.
DATA:V_BASE LIKE KONP-KBETR,
V_AMT LIKE EKPO-NETWR.

SELECT SINGLE MWSKZ INTO V_MWSKZ FROM EKPO
WHERE EBELN = L_XEKPO-EBELN AND EBELP = L_XEKPO-EBELP.

SELECT SINGLE KNUMH FROM A950 INTO V_KNUMH
WHERE KAPPL = 'TX'
AND ( KSCHL = 'ZBSE' )
AND LAND1 = 'IN' AND MWSKZ = V_MWSKZ
AND DATBI >= ODT AND DATAB <= ODT .


SELECT SINGLE KBETR FROM KONP INTO V_BASE
WHERE KNUMH = V_KNUMH." AND loevm_ko NE 'X'.

V_BASE = V_BASE / 10 .
V_AMT = ( V_NETWR * V_BASE ) / 100 .



*********FOR ZVRN Condition*********************

CLEAR V_KNUMH.


SELECT SINGLE KNUMH FROM A950 INTO V_KNUMH
WHERE KAPPL = 'TX'
AND ( KSCHL = 'ZVRN' )
AND LAND1 = 'IN' AND MWSKZ = V_MWSKZ
AND DATBI >= ODT AND DATAB <= ODT .


SELECT SINGLE KNUMH FROM A950 INTO V_KNUMH
WHERE KAPPL = 'TX'
AND ( KSCHL = 'ZVRD' )
AND LAND1 = 'IN' AND MWSKZ = V_MWSKZ
AND DATBI >= ODT AND DATAB <= ODT .



*CLEAR: V_VAT.


SELECT SINGLE KBETR FROM KONP INTO V_VAT
WHERE KNUMH = V_KNUMH.

V_VAT = V_VAT / 10 .
V_VATA = ( V_AMT * V_VAT ) / 100 .

*CLEAR: str10, STR90.

STR90 = STR90 + V_VAT.
str10 = STR10 + V_VATA.


ENDIF.
***********


IF V_MWSKZ = 'IN'.
str1 = 'Inclusive'.
ELSE.
V_MWSKZ = ' '.
str1 = V_TOT_TAX.

ENDIF.