cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Attachments in Workflow.

Former Member
0 Likes
3,066

I am following the document which I got in SDN . for making attachments in WF.

I have done the same way as it was given but In tcode SWI1 its showing as Error.

I am triggering the workflow through my report program usinf the FM SWW_WI_START_SIMPLE.

and in my BOR object I defined the method attachment and called the FM SAP_WAPI_ATTACHMENT_ADD

What might be the problem, could any one explain please

Accepted Solutions (1)

Accepted Solutions (1)

bpawanchand
Active Contributor
0 Likes

1.First of all I would suggest to start the workflow with SAP_WAPI_START_WORKFLOW

2. Please check whether the header of the Attahcment is populated correctly or not.

I hope the code snippet might help you to understand


  DATA :
     lv_header        TYPE swr_att_header.
  IF lv_xstring IS NOT INITIAL.

    lv_header-file_type = 'B'.
    lv_header-file_name = 'Attachment'.
    lv_header-file_extension = 'DOC'.
    lv_header-language = 'EN'.

    CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
      EXPORTING
        workitem_id = wf_wi_id
        att_header  = lv_header
        att_bin     = lv_xstring
      IMPORTING
        return_code = lv_return
        att_id      = att_id.

    IF lv_return = 0.

      lv_objtkey = att_id-doc_id.
      lv_objsofm = 'SOFM'.
      swc0_create_object bo_sofm lv_objsofm lv_objtkey.

    ENDIF.                             " IF lv_return = 0

Former Member
0 Likes

Hi,

when I am using the FM 'SAP_WAPI_START_WORKFLOW its leading to dump as there is type conflict in the container type

I am using the INCLUDE <cntn01>.

In the Binding also there is a Problem.

the Task is not getting binded with the method automatically.

what might be the problem.

Thanks and regards

bpawanchand
Active Contributor
0 Likes

CALL FUNCTION 'SAP_WAPI_START_WORKFLOW'

EXPORTING

task = 'WS90000092'

LANGUAGE = SY-LANGU

*DO_COMMIT = 'X'

  • USER = SY-UNAME

start_asynchronous = 'X'

  • DESIRED_START_DATE =

  • DESIRED_START_TIME =

  • DESIRED_START_ZONLO = SY-ZONLO

  • IFS_XML_CONTAINER =

IMPORTING

  • RETURN_CODE =

workitem_id = workitem_id

  • NEW_STATUS =

TABLES

input_container = container

  • MESSAGE_LINES =

  • MESSAGE_STRUCT =

agents = it_agents .

COMMIT WORK.

WRITE : workitem_id.

ENDIF.

replace the starting of workflow with the below code


CALL FUNCTION 'EWW_WORKFLOW_START'
  EXPORTING
    x_task                = 'WS90000092'
 TABLES
   X_CONTAINER            = container
 EXCEPTIONS
   INVALID_TASK          = 1
   NO_ACTIVE_PLVAR       = 2
   START_FAILED          = 3
   GENERAL_ERROR         = 4
   OTHERS                = 5
          .
IF sy-subrc <> 0.
 MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.


Former Member
0 Likes

HI

When I check the Tcode SWI1 I am finding the the activity step which I used in the workflow is not getting exectued properly

I am getting the status as Error

Unable to read RFC destination WORKFLOW_LOCAL_100

Kindly help me on this issue

bpawanchand
Active Contributor
0 Likes

Check SWU3 workflow custiomizing whether the RFC destination is active or it is mared as Red color cross

Former Member
0 Likes

hi,

Its marked as red color cross

Regards

bpawanchand
Active Contributor
0 Likes

Then te workflow customization is not done correctly. please check the below blog to know more aboput [workflow auto customization|http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417200)ID1970508150DB10021094557931378781End?blog=/pub/wlg/9945]

narin_nandivada3
Active Contributor
0 Likes

Hi,

Ask your Basis team to assign a profile as SAP_ALL profile so that your user can be set as as RFC destination user.

If not you can go what Pavan has suggested in the blog.

Good luck

Narin.

Former Member
0 Likes

Hello,

Please search the forum before posting questions, it will get you the solution much more quickly.

regards

Rick Bakker

Hanabi Technology

Former Member
0 Likes

HI

The confiogurations are done. thanks for the support.

in the post you have given a code snippet



    IF lv_return = 0.
 
      lv_objtkey = att_id-doc_id.
      lv_objsofm = 'SOFM'.
      swc0_create_object bo_sofm lv_objsofm lv_objtkey.
 
    ENDIF.        

can you help me with the data types of the lv_objkey , lv_objsofm, and what is bo_sofm.

I think I have to use the above code snippet in BOR method.? am I correct.

reagrds

bpawanchand
Active Contributor
0 Likes

Yes., you need to write code in the BOR method and later you have to export the attachment object back to the task and from task to workflow and you have to make the bindings between workflow and the step which you want to send to the agent.

If you are implementing the logic in the BOR then,

1. Bo_sofm TYPE SWC_OBJECT.

2.lv_objsofm TYPE swotobjid-objtype,

3. lv_objtkey TYPE swotobjid-objkey,

Former Member
0 Likes

hi ,

I am getting error

Statement "SWC0_CREATE_OBJECT" is not defined. Check your spelling.

I have one more doubt , why I am not getting default binding from task to method

Former Member
0 Likes

it shud be SWCO_CREATE_OBJECT.

you have written 0 instead of O.

Former Member
0 Likes

I having da same prob

bpawanchand
Active Contributor
0 Likes

you have to use SWC_CREATE_OBJECT the one which i mentioned that I was using in a class method SWC<zero>_create_object, any how you are writing the code in the bor so you have to just remove the <zero> from that macro.

Former Member
0 Likes

HI,

The work flow is executed successfully but in the tcode SWi1 I was unble to see my attachment.

can you please help me in this.

Edited by: SAP LEARNER on Sep 17, 2009 6:44 AM

Former Member
0 Likes

i have the same problem, can you please help me in this?

Former Member
0 Likes

Please open a new thread with the details of your problem.

Answers (0)