Skip to Content
Author's profile photo Tushar Shinde

Attaching files to GOS via Web Dynpro ABAP

This document will help you to add attachments to any Application Transaction and its associated Business Object which is configured to use GOS services for attachments, notes etc.

What is GOS?

GOS stands for Generic Object Services, available in various SAP Application Transactions, which helps to create personal or general note, attach files, trigger workflow, add URL etc. All these services are available by display of below icon in any standard SAP Transaction (You can even add it in your own Custom Applications as well).

New Picture (24).jpg

On click of the Icon (or button), a toolbar is displayed as shown below.

New Picture (25).jpg

Toolbar provides various facilities like, attaching documents, creating personal or general note, starting workflow etc.

Best explanation for

What is GOS? Where the documents attached in GOS are stored? Which tables are involved, when you attach any object to GOS for a particular Business Document?

All answers for above questions is available in SAP Notes ->

These notes explain very intricate details about GOS & and its technical aspects.

In SAP ESS – Travel Management Module, SAP had delivered a class CL_FITV_GOS, which was used within Travel Module for purpose of attachments to GOS. However, the class is nothing more specific to Travel Module, so I decided to copy the class into my own class, which will provide assistance to my Webdynpro for Uploading or Downloading files to & from GOS respectively.

In this blog, I have taken example of Application Transaction BP i.e. Business Partner, where we can create Business Partner & assign different Roles to it. The Business Object (BO) associated with this application transaction is BUS1006 (check transaction SWO1 to find Business Objects related to any application transactions).

Below is the screenshot of Class ZCL_GOS_SERVICES copied from standard class (CL_FITV_GOS) provided from SAP.


Method UPLOAD_DATA( ) helps in uploading file to GOS for a particular Business Partner. It takes below mentioned parameters as input.



      value(FILE_DATA) type XSTRING

      value(OBJ_ID) type STRING "Business Partner Number

      value(FILE_NAME) type STRING


      value(RT_MESSAGES) type BAPIRETTAB .

Static Method GET_LINKS( ) gives the list of already attached Document ID for that Business Partner and

class-methods GET_LINKS






Static Method GET_CONTENT( ) is used to get the file data (XTSRING) for a particular Document ID.

  class-methods GET_CONTENT



      !IV_OBJTP type SO_OBJ_TP




      !ES_MESSAGE type BAPIRET2 .

SRGBTBREL – is a table where we can find the binary relationships between the GOS & Application Transaction is stored. Also there are many other tables as explained in above mentioned SAP notes.

Below is the Screenshot for Sample Web Dynpro Application, which demonstrates, how to attach files to GOS for a Business Partner (also check the video demo of Application at end of blog).

Below screen contains an Input Field, which accepts a Business Partner (BP) number, on enter displays details of Business Partner in form.


The Screen consists of 2- Buttons – Attach File & View Attachments. On click of Attach files, popup window is displayed, which provides option to select and upload a file for the mentioned BP.



After selecting file click on Start Upload button to upload file in GOS for specified Business Partner. Business Partner number will be the Key & the Object Type will be BUS1006, this entry will be visible in table SRGBTBREL which stores the relationship between attachments in GOS & Application Object.


Please check the screenshot which shows the entry maintained in table SRGBTBREL after uploading the file.

New Picture (26).jpg

On click of View Attachment a Popup will display all list of Attachments as shown in below screenshot along with the recently attached document at last (highlighted in yellow for reference). Download link will provide the option to download & save file in a local system.


The following screenshots will display, technically all the developments done in Web Dynpro ABAP. Before going through the screen shots, just want to explain in short the components developed.

There are 2- Components

  1. ZWD_UIBB_BUPA – This component is front facing component which consist of Single View, which takes input a Business Partner number and displays the details of that Business Partner number. View consist of 2-buttons Attach File & View Attachments. On click of these buttons, a separate Pop-up window appears which actually come from another component, which is added in FPM configuration but visible only when the desired custom FPM Event is raised.
  2. ZWD_UIBB_ATTACH_GOS – This component is actually responsible for Attaching files to GOS or Displaying existing list of documents in a table. This component uses the Custom class ZCL_GOS_SERVICES created for assistance in Uploading or Downloading files to or from GOS respectively.

1. ZWD_UIBB_BUPA  – WD Component

Component Structure

New Picture (27).jpg

This component is used to display details of Business Partner and provides buttons to Attach Files or View existing attachments.


New Picture (28).jpg

FPM based Web Dynpro Application

New Picture (29).jpg

Application Configuration for FPM Application ZWD_A_UIBB_BUPA

New Picture.jpg

New Picture (1).jpg

OIF Component Configuration for FPM Application Configuration ZWD_AC_UIBB_BUPA

New Picture (2).jpg

Adding Component ZWD_UIBB_BUPA as a UIBB

New Picture (3).jpg

IDR Component Configuration for FPM Application Configuration ZWD_AC_UIBB_BUPANew Picture (4).png

New Picture (5).jpg

After successfully executing above steps, Test the configuration.

New Picture (6).jpg

New Picture (7).png

2. ZWD_UIBB_ATTACH_GOS  – WD Component

Component Structure

New Picture (9).png

Class ZCL_GOS_SERVICES is added in component attributes with attribute name MO_ASSIST.

New Picture (10).png

2-Events are added in Component Controller, which are fired based on FPM event raised from Component-1 (i.e. ZWD_UIBB_BUPA). If Attach File button is clicked in Component-1, than SHOW_UPLOAD_SCREEN event is fired, which displays view V_UPLOAD_FILES of Component-2 (i.e. ZWD_UIBB_ATTACH_GOS) to upload a new file. If View Attachments button is clicked in Component-1, than SHOW_DOWNLOAD_SCREEN event is fired, which displays view V_ATTACH_LIST of Component-2 (i.e. ZWD_UIBB_ATTACH_GOS) to display existing attachments. For both events SHOW_UPLOAD_SCREEN & SHOW_DOWNLOAD_SCREEN, the Event Handler is added in V_BLANK View, which processes the event to display the desired View as Popup.

New Picture (11).png

Methods in Component Controller               

New Picture (30).png

In WDDOINIT( ) method INITIALIZATION( ) method is called.

New Picture (20).png

INITIALIZATION( ) method in Component Controller

New Picture (21).png

ATTACH_DOCUMENT( ) method in Component Controller

New Picture (22).png

Here the custom class method UPLOAD_DATA( ) is called with necessary parameters to Upload the file for the Business Partner mentioned.

GET_ATTACTMENTS_LIST( ) method in Component Controller

New Picture (23).png

Here the custom class methods GET_LINKS( ) & GET_CONTENT( ) is used to get List of attachments and also the File data of each attachment, so as to provide download functionality in Web Dynpro View.

PROCESS_EVENT( ) method in Component Controller – It is used to process events raised by any other UIBB’s in FPM instance.

METHOD process_event .

CONSTANTS lc_param_partner TYPE string VALUE ‘PARTNER’.

DATA lo_wd_component TYPE REF TO if_wd_component.

DATA: lt_return TYPE TABLE OF bapiret2,
LIKE LINE OF lt_return.

IF io_event->mv_event_id EQ ‘ATTACH_POPUP’.

“Get Business Partner Number from Event Parameters
CALL METHOD io_event->mo_event_data->get_value
= lc_param_partner
= wd_this->iv_obj_id. “Business Partner Number

IF wd_this->iv_obj_id IS NOT INITIAL.

DATA lo_nd_upload_data TYPE REF TO if_wd_context_node.
DATA lo_el_upload_data TYPE REF TO if_wd_context_element.
DATA ls_upload_data TYPE wd_this->element_upload_data.

*       navigate from <CONTEXT> to <UPLOAD_DATA> via lead selection
= wd_context->get_child_node( name = wd_this->wdctx_upload_data ).

*       get element via lead selection
= lo_nd_upload_data->get_element( ).

*       @TODO fill static attributes
CLEAR : ls_upload_data.

*      reset all declared attributes
= ls_upload_data ).

“Fire SHOW_UPLOAD_SCREEN Event that will be handled by V_BLANK View
“to display Upload File Window W_UPLOAD_VIEW
->fire_show_upload_screen_evt( ).


ELSEIF io_event->mv_event_id EQ ‘ATTACH_VIEW’.

“Display Attachment View to display list of Attachments
CALL METHOD io_event->mo_event_data->get_value
= lc_param_partner
= wd_this->iv_obj_id. “Business Partner Number

IF wd_this->iv_obj_id IS NOT INITIAL.
“Get existing list of attachments for Business Partner
->get_attachments_list( ).

“Fire SHOW_DOWNLOAD_SCREEN Event that will be handled by V_BLANK View
“to display Attachment List Window W_ATTACH_LIST_VIEW
->fire_show_download_screen_evt( ).




View V_BLANK – No UI Element is added purposely in this view

New Picture (13).png

Event Handlers in View V_BLANK – which are actually handling events raised by component controller so as to display the desired window as popup

New Picture (14).png


New Picture (15).png

Actions in V_UPLOAD_FILES View

START_UPLOAD action calls ATTACH_DOCUMENT( ) method of component controller

CANCEL_UPLOAD action closes the Popup Window.

New Picture (16).png

Context of V_UPLOAD_FILES View

New Picture (17).png

View V_ATTACH_LIST – Used to display existing list of attachments

New Picture (18).png

Context of V_ATTACH_LIST View – the context structure is similar to the internal table the class returns but in addition a XSTRING attribute is added so as to get file content and store in it

Adding the Component in FPM OIF Config so as to enable communication between 2- Components (UIBB’s)


Check the video demo to see how the sample application works.


Frequently asked questions about Generic Object Services (GOS)

To conclude, these article was prepared by me so as to enable attachments to GOS using Web Dynpro.

Caution -> This article is applicable only for folks trying to attach documents using GOS->Create -> Create Attachment option because the documents attached uses SAP Office config for storing documents, but for folks who are willing to attach documents thru GOS-> Create -> Store Business Document option, for this ArchiveLink specific FM/ Class can be used to attach and link document with SAP Business Transactions.

Best Regards

Tushar Shinde

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Aliaksandr Shchurko
      Aliaksandr Shchurko


      Author's profile photo Tushar Shinde
      Tushar Shinde
      Blog Post Author


      Thanks to u too...


      Tushar Shinde

      Author's profile photo Lukas Weigelt
      Lukas Weigelt

      Good stuff! Thanks for sharing your development approach in such detail and giving the blog so much effort 🙂

      Cheers, Lukas

      Author's profile photo Tushar Shinde
      Tushar Shinde
      Blog Post Author

      Thank You.

      Author's profile photo Former Member
      Former Member

      Nice document, how can it be achieved without GOS involvement for document type.msg/.docx/.txt/.xlsx attached to table. .Png/.pdfs work fine with string and xstring approach.



      Author's profile photo Ramakrishnappa Gangappa
      Ramakrishnappa Gangappa
      Author's profile photo Tushar Shinde
      Tushar Shinde
      Blog Post Author

      I guess, you can handle it in same way, it works for PDF/Image files, only thing required GOS config should be in place to handle those Document CLass.

      Author's profile photo Former Member
      Former Member

      Tushar, Its a wel structured document. Thanks for Sharing.

      Author's profile photo Sreehari V Pillai
      Sreehari V Pillai


      We got a similar scenario . I have the file content in my program . I need to create a GOS document from the file content - more openly , I have the inputs to be passes to upload_data() . All I am looking for is, how to create a gos with that ! 🙂