Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Relationship Between BKPF , BESG, FAGLFLEXT

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos

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.

5 REPLIES 5

Former Member
0 Kudos

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.

Former Member
0 Kudos

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.

0 Kudos

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

Former Member
0 Kudos

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

0 Kudos

This message was moderated.