Skip to Content
0
Former Member
Apr 30, 2013 at 05:30 PM

SAP_WAPI_ATTACHMENT_ADD

1281 Views

Could you help me with a work flow, I'm trying to attach, documents to a workflow, what happens is this, when I enter debug mode the documen attaches, when I run it directly, it doesn't

this is my code.

CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
EXPORTING
task = task
* LANGUAGE = SY-LANGU
do_commit = 'X'
* USER = SY-UNAME
* START_ASYNCHRONOUS = ' '
* DESIRED_START_DATE =
* DESIRED_START_TIME =
* DESIRED_START_ZONLO = SY-ZONLO
* IFS_XML_CONTAINER =
IMPORTING
* RETURN_CODE =
workitem_id = v_wiid
* NEW_STATUS =
TABLES
input_container = it_container
message_lines = it_message_lines
message_struct = it_message_struct
agents = it_agents.

DATA:
lv_objtkey TYPE c,
lv_objsofm TYPE c,
lv_return TYPE sy-subrc,
bo_sofm TYPE swc_object.


* l_ATT_ID LIKE SWR_ATT_ID.
LOOP AT files_tab
INTO wa_files.


l_header-file_type = 'B'.
l_header-language = 'ES'.
l_header-file_name = wa_files-file_name.
l_header-file_extension = wa_files-extension.

*v_xstring = wa_files-FILE.

.

CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
EXPORTING
workitem_id = v_wiid
att_header = l_header
att_bin = wa_files-zxstring
do_commit = 'X'
IMPORTING
return_code = l_retcode
att_id = l_att_id
TABLES
message_lines = lt_msg.


SWC_CREATE_OBJECT BO_SOFM 'SOFM' l_att_id.
SWC_SET_ELEMENT CONTAINER 'SOFM' BO_SOFM.

ENDLOOP.

this is my code.

CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'
EXPORTING
task = task
* LANGUAGE = SY-LANGU
do_commit = 'X'
* USER = SY-UNAME
* START_ASYNCHRONOUS = ' '
* DESIRED_START_DATE =
* DESIRED_START_TIME =
* DESIRED_START_ZONLO = SY-ZONLO
* IFS_XML_CONTAINER =
IMPORTING
* RETURN_CODE =
workitem_id = v_wiid
* NEW_STATUS =
TABLES
input_container = it_container
message_lines = it_message_lines
message_struct = it_message_struct
agents = it_agents.

DATA:
lv_objtkey TYPE c,
lv_objsofm TYPE c,
lv_return TYPE sy-subrc,
bo_sofm TYPE swc_object.


* l_ATT_ID LIKE SWR_ATT_ID.
LOOP AT files_tab
INTO wa_files.


l_header-file_type = 'B'.
l_header-language = 'ES'.
l_header-file_name = wa_files-file_name.
l_header-file_extension = wa_files-extension.

*v_xstring = wa_files-FILE.

.

CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
EXPORTING
workitem_id = v_wiid
att_header = l_header
att_bin = wa_files-zxstring
do_commit = 'X'
IMPORTING
return_code = l_retcode
att_id = l_att_id
TABLES
message_lines = lt_msg.


SWC_CREATE_OBJECT BO_SOFM 'SOFM' l_att_id.
SWC_SET_ELEMENT CONTAINER 'SOFM' BO_SOFM.

ENDLOOP.