on 08-24-2016 10:26 AM
Hi,
Is there a simple way to create an attachment to the workdecision task ?
Scenario
I have a workflow that was triggered by a Requested event of ADDRESSEMP object model.
This event is trigger whenever user change an address in the ESS system.
But now I need to send the the approval a workflow decision with an attachment that contains
the new address information.
What I've done.
1. I create a new method in ADDRESSEMP object that called AttachDoc, with the code below
include <cntn01>.
DATA:
it_solix_tab TYPE solix-line OCCURS 0,
v_wa_solix TYPE solix,
v_att_id TYPE swr_att_id,
v_att_header TYPE swr_att_header,
v_xstring TYPE xstring,
v_workitemid TYPE swr_struct-workitemid,
v_input_length TYPE wsrm_error-wsrm_direction,
v_filename TYPE swr_att_header-file_name,
v_docname_only TYPE swr_att_header-file_name,
v_doc_extension TYPE swr_att_header-file_extension,
v_reltyp TYPE breltyp-reltype VALUE 'ATTA',
v_msgtyp TYPE sofm-doctp VALUE 'EXT',
v_swc_object TYPE swc_object.
TYPES: BEGIN OF t_message_key,
foltp TYPE so_fol_tp,
folyr TYPE so_fol_yr,
folno TYPE so_fol_no,
doctp TYPE so_doc_tp,
docyr TYPE so_doc_yr,
docno TYPE so_doc_no,
fortp TYPE so_for_tp,
foryr TYPE so_for_yr,
forno TYPE so_for_no,
END OF t_message_key.
DATA: v_message_key TYPE t_message_key,
v_doc_size TYPE i,
* Changes for Excel
v_bytes_read TYPE i,
v_temp_bytes_read TYPE i,
* End of Changes for Excel
v_tab_lines TYPE i,
v_offset TYPE i,
i_split LIKE STANDARD TABLE OF soli WITH HEADER LINE,
v_length TYPE i.
CONSTANTS: c_slash VALUE '/'.
swc_get_table container 'IT_SOLIX_TAB' it_solix_tab.
* get the input values
swc_get_element container 'V_WORKITEMID' v_workitemid.
swc_get_element container 'V_INPUT_LENGTH' v_input_length.
CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
EXPORTING
input_length = v_input_length
IMPORTING
buffer = v_xstring
TABLES
binary_tab = it_solix_tab.
v_att_header-file_type = 'B'.
v_att_header-file_name = 'Address'.
v_att_header-file_extension = 'PDF'.
v_att_header-language = sy-langu.
CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
EXPORTING
workitem_id = v_workitemid
att_header = v_att_header
att_bin = v_xstring
IMPORTING
att_id = v_att_id.
* pass attachment id and internal document number for SOFM
swc_set_element container 'ATT_ID' v_att_id.
swc_set_element container 'SOFM' v_att_id-doc_id.
The parameter of this function is Table.
2. I created a simple workflow
3. I created a new container for ADDRESSEMP
But I'm lost with the data binding. Could somebody please help? I just need a simple ways to create attachment in the user decision
Thanks,
Sammy
Hi Sam
Are you adding first the attachment to the workflow container ?
What I have for instance done in one example is used TS48907979 to wonvert an office document into an SOFM document then add it to an GO_SOFM container element of the workflow
Then you create your own copy of the decision task and add the container IO_SOFM
and you do the binding from workflow container GO_SOFM to IO_SOFM
So as soon as you have your workflow container element in the form of SOFM it is quite straight forward
Cheers
Stephane
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Can you please directly try to bind to task container &adhoc_objects&
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.