Gos attachment on a dynpro

Hallo Gurus,
I need Your help!
Is it possible to use a Gos attachment in a Module Pool?
I have an image on material master data, and I would like to show it on a dynpro (for example with cl_gui_picture).
I have read the attachment with function SO_DOCUMENT_READ_API1 but then I don't know how to use the result.
Can anybody help me?
Thank you very much indeed!

try
CALL FUNCTION 'SO_DOCUMENT_READ_API1
EXPORTING
DOCUMENT_ID = <doc>
FILTER = FILTER
IMPORTING
DOCUMENT_DATA = <DOCUMENT_DATA>
TABLES
OBJECT_HEADER = OBJECT_HEADER
OBJECT_CONTENT = OBJECT_CONTENT
* OBJECT_PARA =
* OBJECT_PARB =
* ATTACHMENT_LIST =
* RECEIVER_LIST =
CONTENTS_HEX = CONTENTS_HEX
EXCEPTIONS
DOCUMENT_ID_NOT_EXIST = 1
OPERATION_NO_AUTHORIZATION = 2
X_ERROR = 3
OTHERS = 4

Similar Messages

  • Services for Object (GOS) Attachement List not showing after attachment

    Hi All,
    I have created a new entry for the Generic Object Service List and this links to a copy of the CL_GOS_SRV_ATTACHMENT_CREATE class (Create attachment) with some additional logic. However, after attaching a file, the "Attachment List" does not become available until after I re-enter the transaction. The attachment list is showing the correct attachments.
    After some (understatement...) investigation, I found that even if I try and link the new service to a unchanged copy of the CL_GOS_SRV_ATTACHMENT_CREATE service in SGOSATTR, it is not working. It is attaching fine, but the "Attachment List" entry in the Services for Object Menu is still greyed out. If I attach the original class CL_GOS_SRV_ATTACHMENT_CREATE to the newly created entry it works fine. e.g. straight after I attach a file to the transaction, the menu entry becomes available.
    I can't find where the re-draw of the GOS menu happens and hence can not determine what is going wrong. Does anybody know if this is part of the Kernel or is this actually done in ABAP ?
    Am I missing something ? Debugging including system debugging for two days now and can't find it... very frustrating.
    Any help would be appreciated.
    Thanks,
    Wouter.

    Hi Wouter,
    I had originally posted to ask if you had resolved this since I was facing the same issue, but then deleted my post when I was able to get it working. Sorry, I didn't mean to initiate a flurry of activity in such an old thread.
    My scenario is I created a new GOS service entry in table SGOSATTR using transaction SGOSM. My new service uploads attachments to an external document management system via a call to a RESTful web service. The class I use in the SGOSM entry is a custom subclass of CL_GOS_SRV_URL_CREATE.
    I resolved this issue by taking a look at what CL_GOS_SRV_URL_CREATE does in its EXECUTE method. The key bits to refresh the GOS Attachment List with the new attachment are...
    raise event commit_required. " if SGOSM has the commit flag checked
    raise event service_succeeded
           exporting eo_service = me.
    These events tell any subscribers to go do their thing-- which in this case includes a refresh of the GOS Attachment List. So in the EXECUTE method of my custom subclass, after I call function BINARY_RELATION_CREATE, I raise these events...
    CALL FUNCTION 'BINARY_RELATION_CREATE'
       EXPORTING
           obj_rolea     = gs_object
           obj_roleb    = rel_doc
           relationtype = 'URL'
       EXCEPTIONS
           OTHERS       = 1.
    CASE sy-subrc.
       WHEN 0.
           MESSAGE s043(sgos_msg). " The attachment was successfully created
           RAISE EVENT commit_required.
           RAISE EVENT service_succeeded
                 EXPORTING eo_service = me.
       WHEN OTHERS.
           MESSAGE s042(sgos_msg). " The attachment has not been created
    ENDCASE.
    I hope this is helpful to you even though your initial implementation was a while back. Thanks for replying to my question though!!
    Cheers,
    Amy

  • How to transfer GOS attachment to my work item

    Hi Friends,
      I have the following requirement. The user while creating a Appropriation request in tcode IMA1N will create an attachment using Generic Object Services(GOS). once he saves my workflow will trigger and it will go to approval. I need to show the attachment created using GOS in my Work item. How to achieve this. Please advice.

    I have some annotations:
    The object type ARCHIVE is for archived Data Files from the DataArchiving. The object type for ArchiveLink documents is  IMAGE
    The default method is  .Display   to display the document.
    The GOS-Attachment is not a SAP ArchiveLink document. This attachment is stored in SOOD and linked via the GOS-relationship table SRGBTBREL
    The business object, that can be used here is: SOFM
    The object instance needs to be found with a custom self-made background method, to find the correct link and create an object instance.
    After that, this instance can be used as a secondary method in the work item's execution or attached to the ADHOCOBJECTS as already mentioned here.
    Good luck,
       Florin
    P.S.: Similar reply cross-posted to SAP-WUG

  • Transfer GOS Attachment (Single/Multiple) from custom program to XK01

    Hi,
    GOS - Generic Object Service is a way one can attach single / multiple attachment. I have a custom program where there is a GOS with some attachment (used CL_GOS_MANAGER class).
    Next I need to send / transfer this GOS attachment from my custom program to say a standard transaction , eg XK01.
    Whether we can achieve this functionality, ie. we are able to create/save attachment but is there a way to send attachment (not via email) such that the same attach itself to the GOS of the standard transaction. I don't see any method in the CL_GOS_MANAGER class by which we can achieve this!
    Any suggestion/solution will be highly appreciated!
    Thanks,
    Deb

    Hi,
    I am trying to send attachment linked to a custom BO to standard BO eg, LFA1 using 'GOS_SERV_TOOLS_TEST' (copy_linked_objects).
    Surprisingly, I am able to copy/send attachment list within same BO (LFA1) from one LIFNR to another LIFNR. But the same method does not work when I try to copy attachment between diff BO example from VENDOR BO to MATERIAL BO. Why is it so?
    Also it does not work between a custom BO & standard BO. Please suggest in case I am missing on anything!
    Thank,
    Deb

  • GOS attachment and KPRO

    Hi
    I understood GOS attachment(Contents of PC attachment ) file is stored in SAP table SOFFCONT1 and SOC3.
    But i could not understand how GOS attachment can be stored using Kpro to external server.
    SAP note explains documents are stored  using Kpro. how the Kpro setting is done to save the attachment in external server.
    I referred sdn forums and SAP help. but no body explains about how kpro is linked with GOS attachment.
    Pls shed light on this.
    Regards
    ckumar

    thanks..found its linked with Bussiness workplace..thanks

  • Retrieve GOS Attachment

    Hi All,
    I am developing a program to retrieve the GOS attachment from PO attachment and send to the vendor through email. Kindly advise me to resolve this problem because I have no idea how to retrieve the attachment from the GOS table.
    Many thanks and best regards,
    Ting Wei Hong

    Hi,
    There is a class CL_GOS_MANAGER. Use that.
    See here for an example:
    data: o_gos type ref to cl_gos_manager.
      data: o_att type ref to cl_gos_attachments.
      data: ls_borident type borident.
      ls_borident-objkey = gs_data-vgbel.
      ls_borident-objtype = zcl_word=>co_busobject_worddocument.
      free o_gos.
      create object o_gos
        exporting
          ip_no_commit = space.
      call method o_gos->start_service_direct
        exporting
          ip_service       = 'VIEW_ATTA'
          is_object        = ls_borident
        exceptions
          no_object        = 1
          object_invalid   = 2
          execution_failed = 3
          others           = 4.
      if sy-subrc <> 0.
        message 'Geen bijlagen aanwezig. Toolbox wordt getoond' type 'S'.
        o_gos->display_toolbox( is_object = ls_borident ).
      else.
        message 'Bijlagen aangepast' type 'S'.
      endif.

  • RFCs to create GOS attachment

    Hi Experts,
    I'm not ABAPer at all. Here are only my suppositions and please do not judge me strictly.
    I need to upload PDF file as a GOS attachment to the QM notification from external system (SAP MII) using RFC. As I found out there is no remote-enabled FM for this. There is only SGOS_NOTE_CREATE for notes. I investigated it and found out that all FM's that are used inside it are remote-enabled.
    Question: is it possible to call from my external system same 3 FMs as in SGOS_NOTE_CREATE (SO_FOLDER_ROOT_ID_GET, SO_OBJECT_INSERT, BINARY_RELATION_CREATE_COMMIT) to create attachment instead of note? I guess that in general i need to provide SO_OBJECT_INSERT with some other parameters than it is done in SGOS_NOTE_CREATE, so it will create attachment-object instead of note-object in SAPoffice. Is this way possible, or there should be more steps to create attachment?
    thanks in advace,
    Petr

    Hi,
    In the above code what is is_object and attachment parameters corresponds to. What are the values needs to used in this parameters.
    data: l_object_id_loio type SDOKOBJECT,
           l_object_id_phio type SDOKOBJECT.
      call function 'SO_LOIO_PHIO_CREATE'
            importing
                 loio_object = l_object_id_loio
                 phio_object = l_object_id_phio
            exceptions
                 kpro_model_error = 103
                 x_error          = 1000
                 others           = 1000
    call function 'SO_KPRO_DATA_INTO_OBJCONT_PUT'
                  exporting
                       loio_object = l_object_id_loio
                  tables
    *                CONTEXT     =
                       objcont     = i_objcont.
       x_obj_data-file_ext = 'HTM'.
         x_obj_data-OBJPRI = '5'.
          x_obj_data-extct = 'K'.
         x_obj_data-objla = sy-langu.
         x_obj_data-objdes = '000004280212022400687486'. "wa_attach-filename.
         x_obj_data-objlen   = LINES( i_bin_data ) * 255. "i_soli_size. 000000007319
         CONDENSE x_obj_data-objlen.
    CONCATENATE '&SO_FILENAME=' '000004280212022400687486.htm' INTO x_objhead. "wa_attach-filename INTO wa_content.
         APPEND x_objhead TO i_objhead.
         x_objhead = '&SO_FORMAT=BIN' .
         APPEND x_objhead TO i_objhead.
         CALL FUNCTION 'SO_OBJECT_INSERT'
           EXPORTING
             folder_id                  = l_fol_id
             object_hd_change           = x_obj_data
             object_type                = 'EXT'
             owner                      = sy-uname
           IMPORTING
             object_id                  = x_object_id
           TABLES
             objcont                    = i_objcont    "&SO_KProObjectID=SOFFLOIO E2870D61F569E7F186CB0013216A31DB
             objhead                    = i_objhead     "&SO_FILENAME=000227964812102400687486.htm &SO_FORMAT=BIN
           EXCEPTIONS
             active_user_not_exist      = 1
             communication_failure      = 2
             component_not_available    = 3
             dl_name_exist              = 4
             folder_not_exist           = 5
             folder_no_authorization    = 6
             object_type_not_exist      = 7
             operation_no_authorization = 8
             owner_not_exist            = 9
             parameter_error            = 10
             substitute_not_active      = 11
             substitute_not_defined     = 12
             system_failure             = 13
             x_error                    = 14
             OTHERS                     = 15.
         IF sy-subrc = 0 AND x_object-objkey IS NOT INITIAL.
           x_folmem_k-foltp = l_fol_id-objtp.
           x_folmem_k-folyr = l_fol_id-objyr.
           x_folmem_k-folno = l_fol_id-objno.
           x_folmem_k-doctp = x_object_id-objtp.
           x_folmem_k-docyr = x_object_id-objyr.
           x_folmem_k-docno = x_object_id-objno.
           l_ep_note = x_folmem_k.
           x_note-objtype = 'BKPF'. "c_message.
           x_note-objkey = l_ep_note.
           CALL FUNCTION 'BINARY_RELATION_CREATE_COMMIT'
             EXPORTING
               obj_rolea    = x_object
               obj_roleb    = x_note
               relationtype = 'ATTA'
             EXCEPTIONS
               OTHERS       = 1.
    I am using this code for attaching a .HTM external file automatically to a invoice document. But unable to attach it.
    Can you please help.
    Regards,
    Rafi

  • GOS attachement

    Hi
    is there any standard bapis or RFcs are available to export GOS attachment from R/3 to external systemsv.  the attachement will be exist in qm02 transaction . if in case of n attachment i have to upload latest one .

    hi reddy,
    Welcome to SDN forum.
    use function module
    <b>BDS_GOS_CONNECTIONS_GET</b>
    to get the GOS attachment list
    Refer this link
    /people/rammanohar.tiwari/blog/2005/10/10/generic-object-services-gos--in-background
    Reward with points for helpful answers.
    Cheers
    Alfred

  • How to enhance the GOS attachment list

    Hi,
    I'd like to enhance the standard GOS attachment list as follows:
    - when archiving a new document (archive link) to write additional text into a z-table --> this I managed already
    - in the display of the attachment list, besides the standard fields display also additional fields (from the z-table) --> this is a new requested feature
    - add a new button with functionality (besides the already known change, delete, filter, etc. buttons) --> this is also a new requested feature
    I tried already some BADIs, but it seems that they are not really working.
    So, if someone could support in this case, it would be highly appreciated:
    a) read additional info and display it in the GOS ALV
    b) put additional functions / icons on the ALV
    The SAP release I'm working on is ECC 6.0
    kr,
    Andreas

    Hi Anderas,
    There is a class for GOS attachment list. CL_GOS_ATTACHMENTS
    go to se24 and checkout this class. There are various methods. As per my knowledge you can make enhancement implementations in method SET_TOOLBAR rto fullfill your requirement.
    By debugging check out for other methods which can suite your requirement.
    Regards
    Sachin.

  • Disable 'Delete' button for posted invoices  in GOS Attachment List

    Hi,
    when i open the attachement list of a generic object i see the attached files. In this dialog i want to disable the   "Delete" ( attachment)  button  for Posted invoices ( In MIR4 tcode -> If the invoice is already posted it should not allow to delete the attachment )
    I read oss notes and some ides of copying diverse classes but nothing really helps.
    I found two badis
    GOS_SRV_REQUEST
    GOS_SRV_SELECT
    but i dont know where we have to write our code .
    I read so many posts related to attachments but all the places described about authoriztion object .
    Can you please give some ideas to disable the delete button for posted invoices.

    Hello,
    For GOS there is no SAP Standard authorization concept. The only way to
    manage GOS authorizations is implementing it via custom code as
    described in SAP Note: 491271.
    Please have a look at the SAP notes:
    491271 Authorizations for generic object services
    701609 Authorizations for services: Final classes
    For the use of S_OC_ROLE: this object states if a user is an office
    administrator he can create, modify or delete every document, even
    those created by other users. If the user is not an office admin, the
    user is still able to create his own attachments.
    Regarding to the issue, there is an role object S_GUI for upload.
    To match your inquiry, pleaes find the user's role and active the
    object S_GUI.
    Regards,
    David

  • Issue with retrieving GOS attachment

    Hi,
    My requirement is to create a Web service to retrieve the contents of an attachment which was uploaded via GOS.toolbar in Purchase Requisition. I am able to retrieve the list of attachments and get the content of the particular attachment, but after I save the file to my PC I am unable to open the file. It seems to be corrupt.
    Following is the logic I have used:
    1. Call  BDS_GOS_CONNECTIONS_GET with CLASSNAME =  'BUS2105' and objkey = <PR Number>. I am able to retrieve the list of attachments in gos_connections.
    2. Then call  SO_DOCUMENT_READ_API1 to read the contents_hex into LT_HEX_CONT.
    3. Convert the table contents into Binary string LV_BINFILE using the folowing code
    CLEAR lv_binfile.
       LOOP AT lt_hex_cont INTO ls_hex_cont.
         ASSIGN ls_hex_cont TO <p> CASTING.
         CONCATENATE lv_binfile <p> INTO lv_binfile IN BYTE MODE.
       ENDLOOP.
    4.return the contents of the lv_binfile as the export parameter for the FM
    The Java program that consumes the web service downloads the contents to a file on the PC, but we are unable to open the file.
    I tried the following also:
    1. Call  BDS_GOS_CONNECTIONS_GET with CLASSNAME =  'BUS2105' and objkey = <PR Number>. I am able to retrieve the list of attachments in gos_connections.
    2. Then call  SO_DOCUMENT_READ_API1 to read the OBJECT_CONTENT and download to PC using GUI_DOWNLOAD in ASC mode. Still the same issue.
    One thing I noticed is that the size of the actual file is 103kb, whereas the downloaded file is about 208kb.
    Not sure where I went wrong. Pls help
    Regds
    Thiru

    Hi Thiru,
    from
    http://wiki.scn.sap.com/wiki/display/ABAP/Reading+PDF+attachment+from+sap+inbox+through+ABAP?original_fqdn=wiki.sdn.sap.com
    I've got one idea to use fm SCMS_BINARY_TO_XSTRING for xstring creation. But the parameter input_length is needed.
    Maybe you can get it from fm SO_DOCUMENT_READ_API1 in table ATTACHMENT_LIST.
    Please try that.
    Regards,
    Klaus

  • SOFFPHIO and GOS attachment

    Hi all
    Users are using the Generic Object Services to attach the PC document, the documents are normally stored in the database (SOFFCONT1).
    So to store externally the documents using kpro, i assign the SOFFPHIO document class to SOFFHTTP using TCode SKPR08. So that all the document goes to the content server.
    My doubt is how the GOS-create attachment is connected to SOFFPHIO class. I saw SOFFPHIO table also available.
    Once i attached the pdf or xls document using GOS create attachment, SOFFPHIO automatically trigerrs to save
    the file in content server? or any setting is required in middle.
    Pls confirm.
    Regards
    ckumar

    thanks

  • GOS : Attachment list

    Hi All ,
    I would like to disable the Change and Delete buttons for the Service : Attachment list in GOS.
    Please let me know how can i achieve this.
    Helpful answers will surely be rewarded.
    Thank you
    Srinivas

    Hi Raja,
    Can you be more specific..I want to disable the buttons for the Attachment list service...
    Also if you can provide me the example code..that will be helpful...
    Thank you
    Srinivas

  • Arch.link doc.attribute is missing in GOS attachment list

    Hi,
    Currently the company that I work with is in implementing archive link to attach documents (e.g.
    office document) to some object types (e.g. BUS2007,BUS1001). I have done the required configuration and the functionality is working fine.
    However when I display the document in attachment list, the followings are not shown :
    1.the title of document is not showing instead it shows the description of document type description (this is from customizing)
    2.the creator name is blank
    I compare with standard GOS file attachments, the above functionality are working fine.
    Appreciate if anyone can help me on this.
    Thanks & Regards,
    Hendra

    hi,
    hendra,
    this could be possble please see the below URL,
    http://help-abap.blogspot.com/2008/11/generic-object-services-gos-toolbar.html
    Also chect with GOS authorization
    http://help.sap.com/saphelp_nw04/helpdata/EN/1e/31a40415b711d4a39200a0c943858e/frameset.htm
    Benakaraj
    ??P
    Edited by: benaka rajes on Jul 14, 2009 8:27 PM

  • GOS attachment list could not open office 2007 docs

    HI All,
    My client environment is still uses office 2003.
    but documents attached to the financial accounting documents may have office 2007 files attached.
    when we try to open these docs we get an error.
    Is there any OSS note available for the same?
    it is in GOS services.

    Office 2007 changed their file structure. Files are now saved as .docx for word files. Old style was just .doc. Open the document on your PC, choose FILE-> SAVE AS-> 97-2003 document. This will save it with the .doc extension. Then transfer to your BlackBerry. Same for Excel and Powerpoint as well.

Maybe you are looking for