Skip to Content

Read GOS attachment linked to Workitem in Webdynpro

Hello Experts,

I am having a requirement to read attachments linked to various documents like purchase order, Invoice, Shopping cart and Trip etc.

I have a list of work items awaiting user decision from table SWWUSERWI.

I have to identify the document which i guess, can be done by reading the BOR object linked to the work item. Then from it, getting the document key.

For this, I have used SWWWIHEAD and SWWORGTASK to get parent ID. How to get the BOR information and then to read key vale ?

Then read the attached document linked to the document. For this, I have used the logic mentioned in the below thread.

But cl_binary_relation=>read_links is returning empty link table.

I am passing values as below

ls_object-instid = lv_object_key.
ls_object-typeid = 'FIPP'.
ls_object-catid  = 'BO'.

for it_brel, i am passing 'ATTA', 'NOTE', 'URL', 'PNOT' and 'OFFD' etc.

* Read the links for business object.
              CALL METHOD cl_binary_relation=>read_links
                  is_object = ls_object
                  ip_logsys = g_own_logsys
*                 IT_ROLE_OPTIONS     =
                 IT_RELATION_OPTIONS = lt_brel
*                 IP_NO_BUFFER        = SPACE
                  et_links  = lt_links.
*                  et_roles.

            CATCH cx_obl_parameter_error.
            CATCH cx_obl_internal_error.
            CATCH cx_obl_model_error.


Also using below code.

    DATA: g_own_logsys TYPE logsys.
        own_logical_system             = g_own_logsys
        own_logical_system_not_defined = 1
        OTHERS                         = 2.

    SELECT *
          INTO TABLE lt_link
          FROM srgbtbrel
          WHERE typeid_a EQ ls_object-typeid
            AND instid_a EQ lv_object_key
            AND reltype IN lt_brel.
*        AND utctime >= g_since
*        AND utctime <= g_until.
    IF sy-subrc = 0.

      LOOP AT lt_link ASSIGNING FIELD-SYMBOL(<fs_link>).

        MOVE <fs_link>-instid_b TO so_doc_id.

            document_id                = so_doc_id
*           FILTER                     = 'X '
*           DOCUMENT_DATA              =
            object_header              = lt_objectheader
            object_content             = lt_objectcontent
*           OBJECT_PARA                =
*           OBJECT_PARB                =
*           ATTACHMENT_LIST            =
*           RECEIVER_LIST              =
            contents_hex               = lt_content_hex
            document_id_not_exist      = 1
            operation_no_authorization = 2
            x_error                    = 3
            OTHERS                     = 4.

* Convert to XString
            input_length = input_length
*           FIRST_LINE   = 0
*           LAST_LINE    = 0
            buffer       = file_content
            binary_tab   = lt_content_hex
            failed       = 1
            OTHERS       = 2.

* Display the file.
        CALL METHOD cl_wd_runtime_services=>attach_file_to_response
            i_filename      = l_filename
            i_content       = file_content
            i_mime_type     = l_mimetype
            i_in_new_window = 'X'
            i_inplace       = 'X'.


At the end, how to call shopping cart screen from my Web Dynpro Application as it is not as simple as calling other Docs ?

Thanks in advance,


Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Jul 13, 2017 at 10:32 AM

    Your question is a bit jumbled, normally it's better to break it down into individual bits. Post the workflow part using the "SAP Business Workflow" tag.

    As to workflow, please don't read the tables directly. There are a whole load of (mostly) well-documented Workflow API functions in form of SAP_WAPI* function modules - easier, more reliable, upgrade-safe.

    Are you trying to find attachments to the work item or to the object? For the WI there should be a SOFM attachment (SAPOffice Document), easy to retrieve using SAP_WAPI_GET_OBJECTS.

    Add comment
    10|10000 characters needed characters exceeded

    • Providing background is good. Asking questions about technically unrelated issues in the same thread is likely to lose people who could otherwise answer. E.g. There are plenty of WD experts who know little about WF, they're likely to stop reading your question after the first few lines. The more focused your question the more likely you will get an answer.

      As to the question, so your title is not accurate then if it is linked to the document. Or perhaps that is the reason you are not finding it? I would work from the attachment and make sure you have the correct object type.