Blogs

Automatically upload GOS attachments
Stephan Heinberg 
Business Card
Company: Zimmer, Inc.
Posted on Jan. 22, 2012 04:56 AM in ABAP, Business Process Management, ERP, Product Lifecycle Management

Subscribe.Subscribe
Print. Print
Permalink Permalink
Share

My task was to perform a migration that uploads files to the Generic Object Service (BC-SRV-GBT-GOS).

Generic Object Service (GOS)

I knew that the files are stored via Business Document Service (BC-SRV-BDS) using the Knowledge Provider (BC-SRV-KPR).
So I thought I will google a released and documented API for that:
But, hey this is SAP! We would not earn so much money, if everything is perfectly documented ;-)

I found a few blogs and comments, but non served me well.
So I spend a bit of time finding a solution and I would like to share this with you.

There is an API for that

My input is a binary file, so I need something that can handle RAW data, sometimes also called HEX.
I came across the function module SO_ATTACHMENT_INSERT_API1, but then I would need to call a few undocumented FMs to create a folder and link it to that. For me this was too much undocumented stuff.
At the end I found the static BOR method Message.Create, which is officially released by SAP

Sample

To demonstrate how it works, here is a sample program:

  • The file is uploaded with cl_gui_frontend_services=>gui_upload from the frontend.
  • Filename and extension are split with the help of DMS function modules
  • Storage with BOR method Message.Create
  • Linking the document to the original BOR object using BINARY_RELATION_CREATE

Background

Just a few remarks:
2010 SAP enhanced the BCS APIs to handle four digit file name extensions. Check note 1459896.
By default BCS documents are stored in the main SAP database. So keep that in mind when planning a big migration! You can also store the document on a Content Server.
Compare:
Note 904711 - SAPoffice: Where are documents physically stored?
Note 530792 - Storing documents in the generic object services

Hope I could help, if you are on a similar task.

Stephan Heinberg   is a Inhouse Consultant and Project Manager for Product Lifecycle Management and an enthusiastic fan of ABAP.


Comment on this article
Comment on this weblog
Showing messages 1 through 3 of 3.

Titles Only Main Topics Oldest First

  • Provde F4 help for filename
    2012-01-30 22:46:47 Gautham chakraverthi Business Card [Reply]


    You can also provide F4 help for filename to make it more user friendly. :)



    * f4 help for filename
    AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.


    DATA: gt_lit_file_table TYPE filetable,
    gt_lwa_file_table TYPE file_table,
    g_lfd_rc TYPE i,
    g_lfd_action TYPE i.


    CALL METHOD cl_gui_frontend_services=>file_open_dialog
    CHANGING
    file_table = gt_lit_file_table
    rc = g_lfd_rc
    user_action = g_lfd_action
    EXCEPTIONS
    file_open_dialog_failed = 1
    cntl_error = 2
    error_no_gui = 3
    not_supported_by_gui = 4
    OTHERS = 5.


    IF sy-subrc = 0 AND cl_gui_frontend_services=>action_cancel <> g_lfd_action.


    READ TABLE gt_lit_file_table INTO gt_lwa_file_table INDEX 1.
    IF sy-subrc EQ 0.
    p_file = gt_lwa_file_table-filename.
    ENDIF.


    ENDIF.

  • CVBAPI
    2012-01-23 00:17:25 Tom Van Doorslaer Business Card [Reply]

    Hi,


    You can also check out function group CVBAPI. There are some nice BAPI's in there which you can use to create/change documents in the SAP Document Management System.
    Only on ERP tough. In CRM there's a BOL object for that purpose (CMDocument)


    cheers,


    Tom

    • CVBAPI
      2012-01-23 01:06:37 Stephan Heinberg Business Card [Reply]

      Dear Tom,
      Just to clarify:
      CA-DMS has nothing to do with BC-SRV-BDS and GOS, expect that DMS BOR “Document” uses also GOS and BDS and DMS use KPRO.


      I know the DMS BAPIs quite well, since I use them for ten years now.
      Best regards,
      Stephan


Showing messages 1 through 3 of 3.