1. Introduction

It is a very common requirement in SAP R3 that data in files is uploaded from legacy system and then it is used for various purposes like creation of sales order, purchase order, appropriation requests, vendor etc. Thus the legacy system file plays a vital role here and may be required for future reference. There are various techniques like GOS, BDS through which file can be attached & retrieved in SAP itself. Hence the same file may no longer needed to be stored in legacy system. This document will give detailed explanation about BDS( Business document services).Both BDS and GOS provides various functions that are available in various SAP applications . Some of these functions include

  • Creation of attachments to an object
  • Creation of notes for an object
  • Viewing the attachments
  • Sending attachments via mail

GOS toolbox is integrated with various applications and it can be opened when clicking on button ‘services for object’ in title bar (see below snapshot). For example, consider an application as creating/changing(VF01/VF02) billing documents . The GOS toolbox is integrated with these transactions to provide services for object(Billing document).

BDS toolbox or popularly known as BDN(business document navigator) can be started with transaction OAER. BDN is a centralized tool which provides all services similar to GOS for a business object. Details of attachments created through BDN, will also available in GOS toolbox from where it can be viewed. The only difference is attachments created through BDN can not be edited/deleted through GOS .

There are two ways by which attachments can be created using BDS

  • Using standard transaction OAER
  • Creating custom programs

2. Creating/Storing documents using transaction OAER

Before running this transaction, one should be aware of business object/Class for the desired application for which attachments need to be created. For example, if you want to create an attachments for Invoices, then one must be aware of that invoices belongs to Business object VBRK. Similarly Sales orders belongs to business object VBAK.

Run transaction OAER. One can see the below selection screen on running this transaction.

Give Class name as ‘VBRK’ ( For Billing documents) , ‘BO’ (Business object) as class type and execute(F8).

It will ask for Billing document number for which attachments needs to be created.

Image3 62357 2494063

Provide the billing document number as a object key and press enter. If no key field is provided, details of all document for business object(VBRK) will be displayed. Now one can see the main screen which has been divided into three panes/windows.

a) Description (Highlighted in Red)Top left block shows all the attachments created for a object key( invoice in this case) . On double click on specific document under this window, opens the document in preview window(highlighted in green).

b) Detail(Highlighted in Blue) Bottom left block can be used to create attachments for a object key. It also tells which kind of standard documents( Word , excel) or documents specific to current Business object can be created.

c) Preview(Highlighted in Green)Top right block which is used to see the preview of a document.

Steps for Creating attachments

Go to the ‘Create’ tab of detailed window(Bottom left block). Expand the folder ‘Standard Doc. Types’ .

Standard document type supported by any application can be known from table TOADV.

Image5 62359 6426709

Now double click on desired attachment type which you want to create. It will ask for document path.

Specify the document path and press Enter. When storing a document, one can provide additional information in below pop up :

  • Description of document
  • Language of document
  • Keywords

Image7 62361 4454654

Once Attachment description and language details has been provided, press Enter. This will result in creation of the attachment for invoice. Now this attachment information will be available in ‘Description’ window.

On double click on above document, it will open the the attachment. Similarly Attachment types like DOC, PPT can be created using this fashion.

3. Creating attachments through custom code

Many a times custom interfaces are created for requirements like creation of purchase order, creation of sales order, creation of appropriation request etc. These interfaces generally picks the data from a flat file in legacy system. Below mentioned code can be used in these interfaces which will attach this legacy file into created object(Invoices, Appropriation request etc).  The main logic behind this custom subroutine is mentioned below

  • Get file location(path) from user
  • Get file name and its extension from file location
  •  Get mime type using file extension
  • Fill signature details of document. Signature includes details of the attachment to be created like attachment name, language
  • Pass above mentioned details in function module BDS_BUSINESSDOCUMENT_CREATEF in order to create attachments.

Code details of this custom subroutine is present  below.

4. Viewing attachment through GOS

GOS(Generic object services) is also one of the way for creating/viewing attachments for any application.

Document created through BDS are compatible with GOS .This means document created through BDS can be viewed through GOS. The only difference is document created through BDS can not be deleted or modified through GOS. For viewing the BDS attachment using GOS , go to the main application. In this case it is transaction VF03(Display billing document).Provide the billing document number used in a above example.

Image9 62363 4124886

Click on ‘Services for object’ button(highlighted in red). It will open a pop up which provides various functionalities like create/display attachments.

Click on the ‘Attachment List’ button(highlighted in red) to see all the attachments created for this billing document.


This is the same document(Test.xls) which was created using BDS. Double click on this entry will open the attachment.

5. Retrieving stored documents using BDS

Apart from displaying attachment, it may require to send the attachment via mail. There are couple of function modules which can be used with some custom code to achieve  this functionality.

a). BDS_ALL_CONNECTIONS_GET : This FM gives the details of all attachments created(from BDS as well as GOS) for any object key.

b).  BDS_BUSINESSDOCUMENT_GET_TAB : This FM gives the attachment data in binary/ASCII format which can be used for functionality like sending attachments via emails.

Below subroutine can be used to get binary/text data of BDS/GOS document. Below source code with email email sending logic can be used to send documents via email.

New NetWeaver Information at SAP.com

Very Helpfull



User Rating: Be the first one !