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 attachments of a FI document?

Former Member
0 Kudos

Hi experts,

In a request, I have to enhance the program RFBUEB00 to retrieve the list of all attachments linked to a FI document in order to add 2 columns in the ALV report.

For that, I use the class method CL_BINARY_RELATION->READ_LINKS_OF_BINRELS.

The problem is that method don't take into account all the attachments we can found in FB03>Attachment List. In my case I have 5 attachments in FB03 (1 URL, 1 note, 1 MS Word document, 2 Archived documents):

The method doesn't retrieve the Archived documents. The output table contains only 3 entries:

I noticed, by debugging FB03, that the documents found by the method have a TYPEID_B = CL_MSG_AL_ITEM (Service MSGLINK).

The documents not found by the method have a TYPEID_B = CL_ARL_AL_ITEM (Service ARLLNKSRV).

Do you know why all the attachments are not retrieved? And have you a method, FM or advice to get all these attachments?

Thanks in advance,

Guillaume

1 ACCEPTED SOLUTION

Sandra_Rossi
Active Contributor

The SAPoffice documents are linked to business objects via the Object Relationship Service tables (access via the class CL_BINARY_RELATION).

The archived documents are Logical Documents linked to business objects via the connection tables of the Content Management System (access via the class CL_ALINK_CONNECTION).

6 REPLIES 6

Former Member
0 Kudos

Try using  the class Cl_GOS_Manager.

-Amit.

Sandra_Rossi
Active Contributor

The SAPoffice documents are linked to business objects via the Object Relationship Service tables (access via the class CL_BINARY_RELATION).

The archived documents are Logical Documents linked to business objects via the connection tables of the Content Management System (access via the class CL_ALINK_CONNECTION).

0 Kudos

Thank you! With the method CL_ALINK_CONNECTION->FIND( ), I can retrieve my 2 missing attachments.

But is there a Table or a FM to retrieve the name (or description, or more info) of these archived document based on the ARC_DOC_ID?

0 Kudos

Hi

All informations you can have are from Document Type (AR_OBJECT):

if a file is stored by SAP archiving, it'll be assigned to a certain document type, so try to get information from table TOADV

Else you can only upload the file

It can use fm ARCHIVOBJECT_DISPLAY in order to display it or ARCHIVOBJECT_GET_URI to get the url of the file....and so on

Max

0 Kudos

Thank you, this is what I was looking for.

I take this opportunity to precise that I had another problem, resolve with colleagues: some attachments did not still appear. Actually they was attached to the MM document (linked to this FI document). Now with the field AWKEY I can fetch these missing attachments.

ansin158
Explorer
0 Kudos

To get the list of archived attachments for an object, use FM ARCHIV_GET_CONNECTIONS. Importing parameters for fetching archived attachments of FI document will be:

OBJECTTYPE = 'BKPF'

OBJECT_ID = '<BUKRS><FI doc number><Fiscal year>'

If there are attachments in the object linked with the FI document, e.g. vendor invoice, then fetch the linked object number from BKPF-AWKEY. use this as object id. The object type will be BUS2081 for vendor invoice. If the attachment for vendor invoice is stored in GOS/BDS, then you can use the following FMs: BAPI_REL_GETRELATIONS/BDS_PHIOS_GET_RIGHT respecitvely.