08-19-2009 7:16 AM
Hi All Experts.
Thanks in Advance for Help.
I am going to make GL Pay service Tax Report. i wnt to make report selection from FAGLFLEXT-RACCT.(GL Account number) and Fetch data from BKPF, BSEG, SKAT table.
So Please Guide me about hw to make Relationship from FAGLFLEXT-RACCT. to BKPF and BSEG Table.
The Foll code for fetch data.
FORM data_retrieval.
SELECT * FROM FAGLFLEXT INTO TABLE IT_FAGLFLEXT WHERE RACCT IN RACCT.
SELECT * FROM BKPF INTO TABLE IT_VBKP WHERE BELNR IN BELNR.
LOOP AT IT_VBKP.
ITAB-BELNR = IT_VBKP-BELNR.
ITAB-BLDAT = IT_VBKP-BLDAT.
ITAB-BUDAT = IT_VBKP-BUDAT.
ITAB-XBLNR = IT_VBKP-XBLNR.
ITAB-GJAHR = IT_VBKP-GJAHR.
ITAB-KTONR = BSEG_ALV-KTONR.
select single WRBTR from BSEG into ITAB-WRBTR where BELNR = ITAB-BELNR.
select single kunnr from BSEG into ITAB-KUNNR where BELNR = ITAB-BELNR.
select single name1 from LFA1 into ITAB-LIFNR where kunnr = ITAB-kunnr.
select single SAKNR from BSEG into ITAB-SAKNR where BELNR = ITAB-BELNR.
APPEND ITAB.
endloop.
ENDFORM. "data_retrieval
08-19-2009 7:44 AM
You can link FAGLFLEXT with BSEG with respect to GJAHR, PRCTR AND HKONT IN BSEG. And you can also link FAGLFLEXT with SKAT with respect to SAKNR which is account no.
I guess, you can join these 3 tables with respect to these fields.. Hope, this helps.
08-19-2009 7:21 AM
faglflexa and bseg and bkpf all have document number as key field.
use them to link each other.
and bseg-hkont = faglflexa-racct.
but as this is not a key field do not use it in select query.
08-19-2009 7:44 AM
You can link FAGLFLEXT with BSEG with respect to GJAHR, PRCTR AND HKONT IN BSEG. And you can also link FAGLFLEXT with SKAT with respect to SAKNR which is account no.
I guess, you can join these 3 tables with respect to these fields.. Hope, this helps.
08-19-2009 7:46 AM
Hi
Thnks For Suppors.
But i cant do it, i tried already this. can u change my code. as above same.
Please do help.
Thnks
Bhavesh
08-19-2009 7:48 AM
hi
Use faglflexa WHERE rbukrs = cCode AND ryear = fyear AND racct IN acct AND budat in date1
and a Select Query on BKPF for all entries in LT_FAGLFLEXA where
BKPF-belnr = lt_faglflexa-belnr
AND BKPF- bukrs = lt_faglflexa-rbukrs
AND BKPF- gjahr = lt_faglflexa-gjahr
AND BKPF- budat = lt_faglflexa-budat.
surya
08-19-2009 7:50 AM