Skip to Content
-1
Aug 11, 2023 at 12:07 PM

Problem with a Query

117 Views Last edit Aug 11, 2023 at 12:10 PM 4 rev

Hello,

I have a task and a Query that I've made to it but somehow it doesn't fill requirements, can you spot the mistake here? All what i need to do is filter the tax codes from those tables and based on that, fetch the data from BSEG/BSET table (which works fine) so my guess is, that my query for identyfing particular tax codes doesn't work.

       SELECT t~mwskz,tk~konts

FROM t007a AS t
INNER JOIN a003 AS a ON
t~mwskz = a~mwskz

INNER JOIN t683s AS ts ON
a~kschl = ts~kschl

INNER JOIN t030k AS tk ON
ts~kvsl1 = tk~ktosl AND
t~mwskz = tk~mwskz

WHERE t~kalsm = 'TAXUS'
AND t~mwart = 'V'
AND t~zmwsk <> ''
AND a~kappl = 'TX' AND a~aland = 'US'
AND ts~kappl = 'TX' AND ts~kalsm = 'TAXUS'
AND tk~ktopl = 'CXDE'
INTO CORRESPONDING FIELDS OF TABLE @it_tax_codes.

requirements:

STEP I – identification of CAM tax codes (T007A-MWSKZ):

• T007A-KALSM = TAXRO

• T007-MWART = V

• T007A-ZMWSK <> empty

STEP II – identification of G/L accounts

o Table A003-KSCHL – to obtain condition types (more than one for one tax code possible!)

Application (KAPPL) = TX

Country (ALAND) = US

Tax code (MWSKZ) = T007A-MWSKZ

Table T683S-KVSL1 – to obtain account key.

Application (KAPPL) = TX

Procedure (KALSM) = TAXUS

Condition type (KSCHL) = A003-KSCHL

Table T030K-KONTS – to obtain G/L accounts.

Processing key (KTOSL) = T683S-KVSL1

Chart of accounts (KTOPL) = CXDE