<html>
<head>
<style>
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
</style>
</head>
<body class='hmmessage'>
Dear Experts,<BR>
&nbsp;<BR>
I need to trigger a Workflow from a report, which generates a prefilled PDF-FORM in&nbsp;the UWL.<BR>
&nbsp;<BR>
<STRONG>Scenario:</STRONG><BR>
&nbsp;<BR>
<STRONG>Z_REPORT</STRONG> --&gt; Trigger event --&gt; <STRONG>Start Workflow</STRONG> (the WF containers&nbsp;have recieved vaules&nbsp;from the Z_REPORT) --&gt; Generates&nbsp;a&nbsp;<STRONG>PDF-Work Item in&nbsp;UWL</STRONG>&nbsp;<BR>
&nbsp;<BR>
--&gt; Display FORM with&nbsp;default values in the fields (inherited from the container)&nbsp;<BR>
&nbsp;<BR>
The Process A contains the forms Form_A and Form_B.&nbsp; I&nbsp;am not&nbsp;able to use&nbsp;Backend services and field passing in HRASR_DT, due to the customer`s requirements.<BR>
&nbsp;<BR>
<STRONG>The Workflow:</STRONG><BR>
The Workflow has the following steps: <BR>
&nbsp;<BR>
1. Start workflow (from triggering events)<BR>
2. Export from Workflow container --&gt; Form container <BR>
3. Display the Form container with defaultet field values from the Workflow container<BR>
&nbsp;<BR>
<STRONG>Challenge 1:</STRONG><BR>
&nbsp;<BR>
I need to trigger the workflow from Z_REPORT .<BR>
&nbsp;<BR>
I have managed to start&nbsp;a workflow from Z_REPORT by using the FM "SAP_WAPI_START_WORKFLOW". In this case, the WF works fine with normal WF steps, however, it fails when processing STEPS that has anything to do with PROCESS A&nbsp;and FORMS.<BR>
&nbsp;<BR>
I have been using FM "<!--StartFragment --> 
<STYLE type=text/css>
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
</STYLE>
<SPAN>SAP_WAPI_CREATE_EVENT</SPAN> " , but I don`t seem to manage to start the event&nbsp;<!--StartFragment -->&nbsp;CL_HRASR00_WF_PROCESS_OBJECT.
<STYLE type=text/css>
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
</STYLE>
 <BR>
&nbsp;<BR>
<STRONG>Code:</STRONG><BR>
<STRONG></STRONG>&nbsp;<BR>
<!--StartFragment -->&nbsp;
<STYLE type=text/css>
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L1S31 {
font-style: italic;
color: #808080;
}
.L1S33 {
color: #4DA619;
}
</STYLE>
<SPAN>&nbsp;lv_objkey&nbsp;=&nbsp;<SPAN class=L1S33>''</SPAN>.</SPAN><BR>
<SPAN>&nbsp;&nbsp;lv_objtype&nbsp;=&nbsp;<SPAN class=L1S33>'CL_HRASR00_WF_PROCESS_OBJECT'</SPAN>.&nbsp;<SPAN class=L1S31>"&nbsp;&nbsp;type</SPAN><BR>&nbsp;&nbsp;lv_event&nbsp;&nbsp;&nbsp;=&nbsp;<SPAN class=L1S33>'TRIGGERED'</SPAN>.&nbsp;<SPAN class=L1S31>"&nbsp;event&nbsp;name</SPAN></SPAN> <BR>
<STRONG></STRONG>&nbsp;<BR>
<!--StartFragment -->&nbsp;
<STYLE type=text/css>
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L1S31 {
font-style: italic;
color: #808080;
}
.L1S33 {
color: #4DA619;
}
.L1S52 {
color: #0000FF;
}
</STYLE>
<SPAN>&nbsp;&nbsp;<SPAN class=L1S52>CALL</SPAN>&nbsp;<SPAN class=L1S52>FUNCTION</SPAN>&nbsp;<SPAN class=L1S33>'SAP_WAPI_CREATE_EVENT'</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class=L1S52>EXPORTING</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;object_type&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;lv_objtype<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;object_key&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;lv_objkey<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class=L1S52>event</SPAN>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;lv_event<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;commit_work&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;<SPAN class=L1S33>'X'</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class=L1S52>IMPORTING</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;return_code&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;return_code<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;event_id&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;event_id<BR>&nbsp;&nbsp;&nbsp;&nbsp;<SPAN class=L1S52>TABLES</SPAN><BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;input_container&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;=&nbsp;lt_cont<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;.</SPAN> <BR>
I don`t get any error messages, but I can`t see any new events started in t-code SWEL.<BR>
&nbsp;<BR>
<STRONG>Question 1: </STRONG><BR>
<STRONG>"Do I need to use the&nbsp;event CL_HRASR00_WF_PROCESS_OBJECT in order to start my WF and being able to generate PDF-FORM Work item in UWL?"</STRONG><BR>
<STRONG></STRONG>&nbsp;<BR>
<STRONG>Question 2:</STRONG><BR>
<STRONG>"How do I start the event CL_HRASR00_WF_PROCESS_OBJECT from the report?</STRONG><BR>
&nbsp;<BR>
<STRONG></STRONG>&nbsp;<BR>
<STRONG>Challenge 2:</STRONG><BR>
&nbsp;<BR>
If I start my WF from the Portal MSS(in order to test the WF) I get an error message when I start the workflow with <BR>
the step "Export from Workflow container --&gt; Form container". <BR>
The problem seems to be that the workflow needs to display a FORM in the users UWL, before being able to use the import / export task.<BR>
&nbsp;<BR>
It works perfectly well, when I am using a STEP "display FORM_A" before using the STEP "Export from Workflow container --&gt; Form container". I don`t want to display an empty form, and then in the next step display the same form with defaulted values.<BR>
&nbsp;<BR>
In the "DISPLAY form"-step,&nbsp;I&nbsp;have tried to use the Condition "Complete work item". When I start the workflow and set I predefine the condition, the step<BR>
will be set to completed, however, the next step "Export from Workflow container --&gt; Form container" will get the status under processing, and continue in<BR>
an infinite loop.<BR>
&nbsp;<BR>
The conclusion is: I need to open and process the "DISPLAY FORM" work item from the UWL manually, in order to make the export step work.<BR>
&nbsp;<BR>
<STRONG>Question 3:</STRONG><BR>
<STRONG>"How can I manage to start the "Export from Workflow container --&gt; Form container" step, without having to generate the step "DISPLAY FORM_A"?</STRONG><BR>
&nbsp;<BR>
I am so sorry for this long e-mail, and perhaps I should have split this mail into two different requests. However, it is important to see the whole picture of the process.<BR>
&nbsp;<BR>
Thanks in advance.<BR>
&nbsp;<BR>
Best regards, <BR>
&nbsp;<BR>
Tor<BR>
&nbsp;<BR>
&nbsp;<BR>
&nbsp;<BR>
&nbsp;<BR><br /><hr />See all the ways you can stay connected <a href='http://www.microsoft.com/windows/windowslive/default.aspx' target='_new'>to friends and family</a></body>
</html>