09-25-2014 7:55 AM
Hi All,
I want to associate BSEG line item to its tax amount (which exist as multiple line items in BSET). I sum up the amount for each BSET-TXGRP but cannot associate to which BSEG-BUZEI does a BSET-TXGRP belong to.
Is there any way to get the tax line items (in BSET) of an existing tax document for a particular line item of accounting document (BSEG).
I know that,
BSEG-BUKRS = BSET-BUKRS
BSEG-BELNR = BSET-BELNR
BSEG-GJAHR = BSET-GJAHR,
but
BSEG-BUZEI <> BSET-BUZEI
also,
BSEG-TXGRP may not correspond to correct BSET-BUZEI.
I found 'CALCULATGE_TAX_DOCUMENT' FM which calculates tax amount as required. But the reason I cannot rely on this is because possible tax code changes could lead to different calculated amount than that of in the tax document.
I have been searching several posts and links but no where did I get any solution. Can anyone suggest any function modules to fetch tax data of a bseg line item instead of newly calculating it using calculation function modules?
Regards,
Priyanka S.
09-25-2014 9:30 AM
09-25-2014 8:45 AM
Hi,
Can you pls try using FM's
* bseg fill
CREATE_BSET_ITEM &
* bseg fill (tax line)
CREATE_TAX_ITEM
whether it helps your requirement.
Regards,
K.S.
09-25-2014 8:59 AM
Hi K.S.,
Thanks, but this does not help my requirement.
Regards,
Priyanka S.
09-25-2014 9:22 AM
09-25-2014 10:48 AM
Hi Venkat,
Thanks. I want the tax calculated using the tax code and not withholding tax codes.
Regards,
Priyanka Salvi
09-25-2014 9:30 AM
09-25-2014 10:51 AM
Hi Max,
The reporting requirement is to show tax amount against each invoice item with tax code.
Regards,
Priyanka S.
09-25-2014 11:05 AM
Ok
There's no a particular link between BSEG item and BSET item, if a tax code is used in an accounting document, the tax data will be saved in BSET table.
So you should explain how you need to arrange your program
If tax amount is not zero, the item with BSEG-BUZID = 'T' should be created, so perhaps it's the link you're looking for, but if the tax amount is zero no item will be saved in BSEG, but tax data will be in BSET.
I believe the only good link is the TAX CODE
Max
09-25-2014 12:33 PM
Hi Max,
Thanks a lot. Using this field I can get those items in BSEG for which tax item is available in BSET.
Rest I think for those items, I will have to match using amount and tax code. I hope that should work out.
Regards,
Priyanka S.
09-25-2014 1:09 PM
Hi
You can try to use TXGRP: BSET-TXGRP = BSEG-TXGRP
In this way you should have the reference between BSET and BSEG
Max
09-25-2014 1:59 PM
Hi Max,
Thanks again. I had check this linkage but unfortunately our development system did not have value in it so I had discarded that option. Now I checked our production system has values in BSEG-TXGRP.
So the solution would be,
1. From EKBE table, get invoice line items where EKBE-VGABE = '2'.
2. concatenate (EKBE-LFGJA EKBE-LFBNR EKBE-LFPOS) into WA_INV_XREF3.
3. From BSEG table, get corresponding line item of invoice item using,
BSEG-XREF3 = WA_INV_XREF3.
4. Get BSET items using, BSET-BELNR = BSEG-BELNR and same fiscal yr and company code.
5. Sum up tax amounts in BSET for each TXGRP.
6. Finally, associate BSET and BSET as : BSEG-TXGRP = BSET-TXGRP.
(note that, other clauses like company code, fiscal yr, etc are to be included in queries)
Thanks for the help.
Regards,
Priyanka S.
09-25-2014 2:26 PM
Hi
If you need to start from Purchase Order:
1. From EKBE table, get invoice line items where EKBE-VGABE = '2'.
2. concatenate (EKBE-LFGJA EKBE-LFBNR EKBE-LFPOS) into WA_INV_XREF3.
3. From BSEG table, get corresponding line item of invoice item using,
BSEG-XREF3 = WA_INV_XREF3.
No you should use the right link:
1. From EKBE table, get invoice line items where EKBE-VGABE = '2'.
This steo is ok
2. concatenate (EKBE-LFGJA EKBE-LFBNR EKBE-LFPOS) into WA_INV_XREF3.
It's not good solution, if you want to get vendor invoice:
2. concatenate EKBE-BELNR EKBE-GJAHR into WA_AWKEY
so
3. SELECT * UP TO 1 ROWS
FROM BKPF
WHERE AWTYP = 'RMRP'
AND AWKEY = WA_AWKEY.
ENSELECT.
Now you have Accounting document (Vendor Invoice), probably (if you want to Tax data only) you don't need to read BSEG, but BSET only:
4. So read BSET where
BSET-BUKRS = BKPF-BUKRS
BSET-BELNR = BKPF-BELNR
BSET-GJAHR = BKPF-GJAHR
Max
09-30-2014 10:33 AM
Hi Max,
This solution I have used since I am also fetching the accounting header document using AWKEY whereas I used XREF3 to fetch the exact GR/IR line item from accounting document to map it against the invoice.
Thanks again.
Regards,
Priyanka Salvi
09-25-2014 12:03 PM
hi,
For tax detail select fields from BSET table with reference of acc Document Number which you got from BKPF table. follow the below example
SELECT BELNR GJAHR BUZEI TXGRP SHKZG HWBAS HWSTE KSCHL FROM BSET
CLIENT SPECIFIED INTO CORRESPONDING FIELDS OF TABLE IST_BSET
FOR ALL ENTRIES IN IST_BKPF
WHERE MANDT = SY-MANDT
AND BELNR = IST_BKPF-BELNR .
then use the internal table IST_BSET in the loop . then which tax you wants show using the condition type you got value of the tax like the below example.
READ TABLE IST_BSET INTO WA_BSET WITH KEY BELNR = WA_BKPF-BELNR
TXGRP = TXGRP
KSCHL = 'JMOP'.
IF SY-SUBRC = 0 .
WA_OUTPUT-BED = WA_BSET-HWSTE.
ENDIF.
Regards,
Mukesh
09-25-2014 1:15 PM
Hi Mukesh,
Thanks, but I do not have the value of condition type before hand. There is condition type in RSEG but the value differs in BSET.
Regards,
Priyanka S.
12-17-2021 9:38 AM
Hi Priyanka,
You mapped BSEG-TXGRP with BSET-TXGRP where you can get tax with line items
Regards
Sandip