cancel
Showing results for 
Search instead for 
Did you mean: 

Workflow calling

Former Member
0 Kudos

Hi,

I have created a template with 2 steps.

1. An activity which runs a BOR method.

2. Send mail.

After executing the activity I want a mail in my inbox.(activity is not background).

Now I need to cal this template in one of my program.

Can some one give me sample code to cal the WF template in my prgm such that i will get a text mail to my inbox. Im not using any events to trigger the WF.

Thanks.

Accepted Solutions (1)

Accepted Solutions (1)

former_member185167
Active Contributor
0 Kudos

Hello,

Search for SAP_WAPI_START_WORKFLOW in this forum.

regards

Rick Bakker

Hanai Technology

Former Member
0 Kudos

Hi Rick,

I have tried with SAP_WAPI_START_WORKFLOW with my WF number 'WS88000199'.

But am getting return code - 4 with an error message You are not one of the possible agents of task 'WS88000199'

But my task is general task.

Thanks.

former_member185167
Active Contributor
0 Kudos

Hello,

Have you set WS88000199 to General task as well?

regards

Rick Bakker

Hanabi Technology

bpawanchand
Active Contributor
0 Kudos

Two reasons are possible

1. YOu might not have the authorization to start the workflow

2. Go to BAsic data of the workflow and try to make the workflow as general task ( CTRL + F8 ---> SHIFT+F9 select the GEneral task and then try to execute

Former Member
0 Kudos

Hi Pavan,

I tried this.

I got a work item in the inbox. which need to be executed.

But i want a text mail.

Thanks.

bpawanchand
Active Contributor
0 Kudos

You mean to say that, you don't want to receive the workitem but directly the MAIL in the inbox,

If this is the case then simply make the task as background

Former Member
0 Kudos

Hi Pavan,

I tries it earlier only.

When the task is set to background, am not getting neither work item not mail. nothing is getting into inbox.

Thanks.

bpawanchand
Active Contributor
0 Kudos

SO i think the control is getting stuck in the methdo execution of the business object .

  • Did you check the log , I ean in SWWL you can check at which step the workflow is getting hanged, i think the task is remaining in IN PROCESS status check the code and make the appropriate changes

former_member185167
Active Contributor
0 Kudos

Hello,

I think there may be something wrong with your mail settings.

Does WF-BATCH have an email address?

Are the mails appearing in SOST?

regards

Rick Bakker

Hanabi Technology

Former Member
0 Kudos

Pavan,

The status is completed in SWWL.

bpawanchand
Active Contributor
0 Kudos

Does the entire workflow is getting completed .

What is the receipient type you have selected in the mail step

I mean

  • Organizational OBJECT

  • WF INitiator

  • Email Addrress

If you are using the 1st one and in the EXPRESSION if you are sending the mail by using the SAP USERID then make sure that you append US to the SAP userid

Former Member
0 Kudos

Pavan,

am using the initiator.

bpawanchand
Active Contributor
0 Kudos

Try to select the USERID and give your Userid and check actaully the mail is getting triggered or not

Former Member
0 Kudos

hi

can u please give me some details with how is that happening

even i m trying to trigger thru FM SAP_WAPI_START_WORKFLOW'

But the WF is not coming to my inbox.

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

Have you given Proper Agent Assignment??

bpawanchand
Active Contributor
0 Kudos

Apart from the below mentioned Fm you can even use WAPI functions to start the workflow

SAP_WAPI_START_WORKFLOW


INCLUDE cntn01_swc.
 
DATA :
   t_customer TYPE
     STANDARD TABLE
           OF kna1,
 
   w_task TYPE swwwihead-wi_rh_task VALUE 'WS99002337',
   t_cont  TYPE TABLE OF swcont,
   w_entires TYPE i VALUE 3.
 
 
SELECT *
  FROM kna1
  INTO TABLE t_customer
    UP TO 3 ROWS.
 
swc0_set_table   t_cont 'CUST'     t_customer.
swc0_set_element t_cont 'ENTRIES'  w_entires.
 
 
CALL FUNCTION 'EWW_WORKFLOW_START'
  EXPORTING
    x_task          = w_task
  TABLES
    x_container     = t_cont
  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.
 
ELSE.
 
  WRITE :
      / 'Workflow Triggered'.
ENDIF.

check this code