on 07-12-2017 9:09 PM
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.
https://archive.sap.com/discussions/message/1456793#1456793
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.
TRY.
* Read the links for business object.
CALL METHOD cl_binary_relation=>read_links
EXPORTING
is_object = ls_object
ip_logsys = g_own_logsys
* IT_ROLE_OPTIONS =
IT_RELATION_OPTIONS = lt_brel
* IP_NO_BUFFER = SPACE
IMPORTING
et_links = lt_links.
* et_roles.
CATCH cx_obl_parameter_error.
CATCH cx_obl_internal_error.
CATCH cx_obl_model_error.
ENDTRY.
Also using below code.
DATA: g_own_logsys TYPE logsys.
CALL FUNCTION 'OWN_LOGICAL_SYSTEM_GET'
IMPORTING
own_logical_system = g_own_logsys
EXCEPTIONS
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.
CALL FUNCTION 'SO_DOCUMENT_READ_API1'
EXPORTING
document_id = so_doc_id
* FILTER = 'X '
* IMPORTING
* DOCUMENT_DATA =
TABLES
object_header = lt_objectheader
object_content = lt_objectcontent
* OBJECT_PARA =
* OBJECT_PARB =
* ATTACHMENT_LIST =
* RECEIVER_LIST =
contents_hex = lt_content_hex
EXCEPTIONS
document_id_not_exist = 1
operation_no_authorization = 2
x_error = 3
OTHERS = 4.
* Convert to XString
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = input_length
* FIRST_LINE = 0
* LAST_LINE = 0
IMPORTING
buffer = file_content
TABLES
binary_tab = lt_content_hex
EXCEPTIONS
failed = 1
OTHERS = 2.
* Display the file.
CALL METHOD cl_wd_runtime_services=>attach_file_to_response
EXPORTING
i_filename = l_filename
i_content = file_content
i_mime_type = l_mimetype
i_in_new_window = 'X'
i_inplace = 'X'.
ENDLOOP.
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,
Manoj
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.