cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger a workflow when saving trips (as opposed to save and send)

Former Member
0 Kudos

Hi,

Currently, we allow both employee, as well as Travel admin on behalf of an employee, to create Travel requests and Travel claims in the Portal.  In both scenarios, either the employee or Travel admin can fill up a request and/or claim and once they select "SAVE and SEND", a workflow is triggered to send a work item to the approving manager.  This all works fine.  However, we now have a requirement that if it is a Travel admin creating the request/claim for the employee, they should only "SAVE" the trip and an email will be sent to the employee requesting him to SAVE and SEND the trip himself.  We already have a function to send emails for all our different workflow scenarios and we just want to create a new workflow to call this existing send email function. 

My question is:  Which event should I use which would be triggered on "SAVE".  From researching, it sounds like the events BUS2089.Created and BUS2089.Changed for Claims and BUS2089.RequestCreated and BUS2089.RequestChanged are what I need.  Could someone please confirm that these events will be triggered on Portal "SAVE" option?  Also, in PR05, would the same events be triggered with status Request Recorded/Open and Trip Completed/Open?

If workflow is not possible at the SAVE level, is there a BADI that gets triggered only on SAVE?

Thanks, any guidance would be appreciated.

Jinny

Accepted Solutions (0)

Answers (3)

Answers (3)

Lukas_Weigelt
Active Contributor
0 Kudos

Hi Jinny,

some feedback would be nice. Were you able to accomplish what you wanted?

Cheers, Lukas

Former Member
0 Kudos

Hi Lukas and Nayan,

I still need to discuss this with our Abaper.  Right now we are still in the process of investigating what possible solutions we may be able to use.  Thanks so much for the replies, I will keep you posted once we're in the development phase of the solution.

Jinny

Nayan
Explorer
0 Kudos

Hi Jinny,

Instead of WF you can directly call FM to trigger mail.

Go to Component FITV_FPM then go to View LAYOUT_VIEW

inside ONACTIONNAVIGATE event

you can write your logic under this case statement

WHEN IF_FITV_FPM_API=>GC_NAVIGATE_SR.

Lukas_Weigelt
Active Contributor
0 Kudos

Nayan Baseshankar wrote:

Hi Jinny,

Instead of WF you can directly call FM to trigger mail.

Go to Component FITV_FPM then go to View LAYOUT_VIEW

inside ONACTIONNAVIGATE event

you can write your logic under this case statement

WHEN IF_FITV_FPM_API=>GC_NAVIGATE_SR.

Interesting, but with this, all plausibility and technical checks would be skipped and a mail might be sent even if the process is interrupted. This isn't consistent in my opinion.

Nayan
Explorer
0 Kudos

You can do a implicit enhancement inside SAVE_AS_DRAFT method of  CL_FITE_ASSISTANCE class in this way we can trigger a alert mail after all the standard checks and validations

Lukas_Weigelt
Active Contributor
0 Kudos

That sounds much better

Re-Reading gv_saved and implement the mail FM here would do the trick and it would be less complicated than what I suggested earlier. I like

Lukas_Weigelt
Active Contributor
0 Kudos

Hi Jinny,

there is no standard event being triggered from Saving a Trip in Status 1 - 0. When you take a look at the code within Include FITP_WORKFLOW in Form TRIGGER_WORKFLOW...

CASE statu-abrec.
       WHEN '0'.
*       begin WBGK024026;
         CASE statu-antrg.
           WHEN '5'. event = 'RequestWaits'.                 "#EC NOTEXT
           WHEN '6'. event = 'ExpenseWaits'.                 "#EC NOTEXT
         ENDCASE.
*       end WBGK024026;
       WHEN '1'.
         CASE statu-antrg.
*          WHEN '1'. EVENT = 'Requested'. "#EC NOTEXT       "WBGK024026
           WHEN '1'. event = 'RequestCreated'. "#EC NOTEXT   "WBGK024026
           WHEN '2'. event = 'RequestApproved'.              "#EC NOTEXT
           WHEN '3'. event = 'Created'.                      "#EC NOTEXT
           WHEN '4'. event = 'Approved'.                     "#EC NOTEXT
*         begin WBGPLN;
           WHEN '5'. event = 'RequestWaits'.                 "#EC NOTEXT
           WHEN '6'. event = 'ExpenseWaits'.                 "#EC NOTEXT
*         end WBGPLN;
         ENDCASE.

...you can see all Events for all statuses of ANTRG are already being used in standard and they are only triggered when ABREC is 1, which isn't the case in draft save mode.

If I was in your position I would approach in the following way:

Make an implicit enhancement at the beginning at the form and set event=RequestCreated if antrg = 1 and abrec = 0. This will be inconsistent to the standard behaviour but can then again be reorganized in the handling of the workflow. You'd have to read the status of the trip in the workflow again and then distinguish whether it is a draft or a send-and-save and proceed respectively.

Cheers, Lukas