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: 

Find attachment documents from BSAK / BKPF

Former Member
0 Kudos
1,716

Hi,

I am new to working with the SAP database, so my knowledge in this field is limited - please bear with me 🙂

I am working with BSAK / BKPF right now, and I need to find out which table / fields that are used to relate / get the attachment files tied to a document. Can anyone tell me how I will get the relations and which tables to look for to get this information ? To get the unique document id I need BUKRS, GJAHR, BELNR, but I can't seem to find any tables / fields where I can get the tied attachments to this?

Any help is appreciated, and thank you very much in advance! 🙂

http://dl.dropbox.com/u/60359162/fb.jpg

1 ACCEPTED SOLUTION

former_member217316
Contributor
0 Kudos
414

Tables involved

BKPF

SRGBTBREL

SOOD

Join 1

BKPF – GJAHR + BKPF – AWKEY = SRGBTBREL – INSTID_A

Join 2

SRGBTBREL – INSTID_B = SOOD – OBJTP + SOOD – OBJYR + SOOD – OBJNO

Hope this helps.

Harsh

7 REPLIES 7

former_member282968
Contributor
0 Kudos
414

Dear Stephan,

SRGBTBREL is the table and the passing 'ATTA; in RELTYPE check the entries in the field INSTID_A.

Please refer to the bbelow link for more info:

http://scn.sap.com/thread/1892470

With regards,

0 Kudos
414

Hi, and thank you very much for your reply!

However, your suggestion only gives me doc number and fiscal year - no Co code. Besides that I can not figure out how to relate this to the actual attachment, as SRGBTBREL does not hold any info about the file ? or maybe I am missing something.. There must be more tables required to interact with to get the files related to the document number ?

Thank you in advance!

0 Kudos
414

Dear Stephan,

Goto BKPF get your company code, Document Number and Fiscal Year.

In table SRGBTBREL for field INSTID_A which is Instance ID pass your company code give a space pass your docno and fiscal year with no spaces and reltype should be ATTA .If entry exists then an attachment exists else no.

The field INSTID_A contains company code, Document Number and Fiscal Year.

Program RFBKPF00 contains the related methods for showing the attachment list. You can place the break-point in the related method and test the runtime values.

regards,

0 Kudos
414

Hi,

Thanks once again for your reply. I will try to be more clear in my setup.. I forgot to mention from the start, that I am not working directly in SAP in this matter. I am using Auditing software called ACL. From there I have direct access to my SAP database (read-only). see below where I look into SRGBTBREL.

http://dl.dropbox.com/u/60359162/sap06.jpg

In SRGBTBREL i have this:

http://dl.dropbox.com/u/60359162/acl.jpg

As you see, there is not enough information to have both, co code (4 cifre) doc no (10 cifre) and fiscal year (4 cifre) ?

My main goal is to locate attached files to a given document through the database only - this is to find the attached documents to potential duplicate payments and to show which ones does not have attached documents at all..

So, I have all tables available, I just can't find out how to locate the attached files only through the database, as I can't find any direct relation to the right cc code and document in a given period..

I hope you can help me, being maybe a little more specific on what I should do to get this information 🙂

0 Kudos
414

Please check the below thread :

http://scn.sap.com/thread/551819

with regards,

former_member217316
Contributor
0 Kudos
415

Tables involved

BKPF

SRGBTBREL

SOOD

Join 1

BKPF – GJAHR + BKPF – AWKEY = SRGBTBREL – INSTID_A

Join 2

SRGBTBREL – INSTID_B = SOOD – OBJTP + SOOD – OBJYR + SOOD – OBJNO

Hope this helps.

Harsh

0 Kudos
414

Thank you VERY much! that did half the trick!

Now I fetch documents where these kinds of attachments are present :

http://dl.dropbox.com/u/60359162/s1.jpg

BUT. I don't get files attached as archived documents (these are also pdf's but apparently attached manually or something? ) :

http://dl.dropbox.com/u/60359162/s2.jpg

Any idea how to get the reference to these documents also?

Thank you very much for your effort so far!