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: 

How to get all accounts linked to a document?

Former Member
0 Kudos

Hi,

here is teh brief of teh requirement i have.

need to generate a report which displays ALL the accounts related to a document for a G/L account.

fnl3n gives this in 2 steps:

Run fbl3n with a gL acc, cc and posting date.

On the next srn, double click some doc number.

On the next scren press ovcerview button. There the u201Caccountu201D column gives all the accounts attached to this document number ( the one that was double clicked).

Basically the report is running for a perticular G/L account and displaying all its doc numbers and all of their (doc no's) acounts along with its description.

i tried to debug, but no luck. its calling some ledger..... and goes on. coulnt get it.

i need to get description too along with GL accounts.

thanks a lot....

regards

Kavana

Edited by: Rob Burbank on Sep 23, 2009 4:11 PM

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Welcome to SCN.

You can go to BSIS and BSAS with your account number and get the documents that you want. Then using the document number, company code and fiscal year, got to BSEG and the all the line items for the document.

Rob

Corrected BSID to BSAS

Edited by: Rob Burbank on Sep 23, 2009 4:44 PM

19 REPLIES 19

Former Member
0 Kudos

Welcome to SCN.

You can go to BSIS and BSAS with your account number and get the documents that you want. Then using the document number, company code and fiscal year, got to BSEG and the all the line items for the document.

Rob

Corrected BSID to BSAS

Edited by: Rob Burbank on Sep 23, 2009 4:44 PM

Former Member
0 Kudos

Hi

All item data of account document are in table BSEG, the item can be of 3 kinds (main kind):

- Vendor BSEG-KOART = K

- Customer BSEG-KOART = D

- G/l BSEG-KOART = S

So if u know the company code, document number and fyscal year, u need to read BSEG table, check the account type and so get the description from:

- Vendor LFA1

- Customer KNA1

- G/l SKAT

Max

former_member193335
Active Participant
0 Kudos

Hi Kavana.

There are six database tables wich conform another database table in a structure named cluster.

These tables are BSIS, BSAS, BSIK, BSAK, BSID and BSAD wich conform the cluster database table named BSEG.

If you need to access GL accounts you should use BSIS for open items and BSAS for cleared items.

For vendor documents you can use BSIK for open items and BSAK for cleared items.

For customer documents you should use BSID for open items and BSAD for cleared items.

You can find the whole account document in BSEG.

Using that tables you can obtain all the accounts linked to a document.

Regards.

Rafael Rojas.

0 Kudos

hey Thanks ....

had done the same steps... but didnt use BSEG....retrieved from bsas/is, bsad/id, bsak/ik,.,,

but ther was 1 account coming which is not in either BSAS nor in BSIS but in BSEG!!!

thanks a lot for ur ans, and please let me know, y that doc is in BSEG but not in all other 6 tables..........?

0 Kudos

Thanks to all for teh quick response.. this was my first post and happy to know people r out to help each other

0 Kudos

If you know the document number, fiscal year and company code, it is best to go directly to BSEG to get the data. In a development environment your approach may work ok, but when you go to production most of these tables do not have secondary indexes on these fields and the program may grind to a halt.

Everyone here is glad to help, but in the future, remember that the proper way to say thanks is by assigning points to helpful answers.

Rob

0 Kudos

thansk rob, in fact iw as doign it now :)... was findign out how...

Former Member
0 Kudos

Hi again

can u plz ans me is it possibel that a account exists in Bseg not in BSAS or BSIS or BSAD or BSID or BSAk or BSIK?

can this happen?

0 Kudos

I think odd documents like down payment requests may behave like this.

Or maybe noted items - not entirely sure.

Rob

Edited by: Rob Burbank on Sep 23, 2009 5:38 PM

0 Kudos

Hi Kavana.

In my experience as ABAP developer I have not see that behavior. Each of records in BSEG exist in the another six tables you mention. It is possible that some kind of documents with a specific property, like noted items, exist only in BSEG. I suggest you to ask your FI consultant about this.

Regards.

Rafael Rojas.

0 Kudos

Hi

No that's impossible, if u can find out that situation means something doesn't work in your system.

BSIS/BSAS.......... are index tables having the main data of BKPF and BSEG table.

When a account document is posted for a vendor or customer, the system can create an item for the reconciliation g/l account, this particular item is not stored in BSEG table but in BSIK/BSAK or BSID/BSAD tables only

Max

0 Kudos

The "missing" line, does it have BSEG-KOART = 'S'?

If I remember correctly, then BSIS and BSAS are only being filled in addition to BSEG when SKB1-XKRES is set to 'X' (display of line items is possible). Please check this for the G/L account in question via tx FS00 or SE16.

Thomas

0 Kudos

Hello Thomas,

Yes, Thomas you remember correctly (b'coz i learnt it from one of your previous post)

In FS00 --> "Control Data" tab --> "Open Item Management" & "Line Item Display" checkboxes should be checked.

Going my Max's post I dont think that any such config is possible for Vendors/ Customers.

BR,

Suhas

0 Kudos

Hi Suhas,

for vendors/customers this is set implicitely I believe.

The code in question is in include LF005F01, form routine SACHKONTEN_INDEX.

form sachkonten_index.
  check bseg-xkres = 'X'.

  if bseg-augbl = space.
    move-corresponding bkpf to bsis.
    move-corresponding bseg to bsis.
...
    endif.
  else.
    move-corresponding bkpf to bsas.
    move-corresponding bseg to bsas.
...
    endif.
  endif.
endform.                    "sachkonten_index.

Not 100% sure though if BSEG-XKRES is simply being filled from SKB1-XKRES beforehand.

Thomas

0 Kudos

Inorder to acivate open item management for G/L you have to copy the program

RFSEPA02 to Z and use it. ( also check note 175960 )

There must be somthing similar for vendors/customers, but not sure.

0 Kudos

My conclusion after a few tests, see also message FH 021:

- activating SKB1-XKRES triggers BSIS/BSAS creation

- running RFSEPA01will build BSIS/BSAS for historical BSEG items in case SKB1-XKRES is being activated for an existing account

- running RFSEPA04 will delete BSIS/BSAS in case SKB1-XKRES is being decactivated for an existing account

- open items management is only possible when SKB1-XKRES is active

Gautham, RFSEPA02/03 is indeed for open items management, but not for line item display I was referring to.

Thomas

0 Kudos

Hi Thomas

Thansk for ur inputs..

yes, the account which i was mentioning doesnt have xkers activated. its space even in production.

any idea, when this happens? from func side? which tcode they run and thsi account which is attached to a doc no, wotn be in open items nto in cleared items? is it when it is reversed or soemthign liek that?

Former Member
0 Kudos

I don't think this has anything at all to do with open item management.

Rob

Edited by: Rob Burbank on Sep 24, 2009 9:06 AM

0 Kudos

Recurring documents (BKPF-BSTAT = 'D') will have entries in BKPF and BSEG but not in the index tables. There may be other examples as well, but that's all I could find.

My earlier statement about the index tables not having secondary indexes for BUKRS, BELNR and GJAHR is no longer correct in ECC.

Rob