Advance With Dialog on Asynchronous Task

Florin Wach (SI) florin.wach at systems-integration.net
Sun Jul 5 16:53:52 EDT 2015


swc_call_method self ‘Edit’ container.

It usually won’t work with asynchronous methods, so check the macro here and modify one of the synchronous-import parameters, if needed.

Florin


> Am 30.06.2015 um 15:28 schrieb Bratzler, Loren <loren.bratzler at nscorp.com>:
> 
> Hey Jocelyn, hope you are doing well!
>  
> Thinking about what you said and what Ramki said, I found a hack for my custom method that appears to work where I check the status of the document after returning from the t-code call:
>  
> begin_method zedit changing container.
> 
> DATA: lv_status TYPE rbkp-rbstat.
> 
> DATA: xwfla1 LIKE boole-boole VALUE 'X'.                    "Note916729
> SET PARAMETER ID 'RBN' FIELD object-key-invoicedocnumber.
> SET PARAMETER ID 'GJR' FIELD object-key-fiscalyear.
> SET PARAMETER ID 'CHG' FIELD 'X'.
> EXPORT xwfla1 TO MEMORY ID 'FIENJOYWF'.                     "Note916729
> CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.
> 
> SELECT SINGLE rbstat
>   FROM rbkp
>   INTO lv_status
>  WHERE belnr = object-key-invoicedocnumber
>    AND gjahr = object-key-fiscalyear.
> 
> IF lv_status <> 'B'.    " Completed
>   exit_cancelled.
> ENDIF.
> 
> end_method.
>  
>  
> The obvious downside to this is if someone happens to change the document status to “completed” outside of workflow via the normal backend MIR4 screen.  We do have an enhancement implementation on the MIR4 screen where I might be able to control the “save as complete” button to only be allowed by the workflow approver.  If I can make that work, then this approach may work for us.
>  
> One more question for anyone:  This custom method, ZEDIT, is a copy of the standard method, EDIT.  Is there a way to call the standard method from my custom method so that I don’t have to duplicate the code being executed?
>  
> Loren Bratzler
> Norfolk Southern Corporation
>  
>  
> From: sap-wug-bounces at mit.edu <mailto:sap-wug-bounces at mit.edu> [mailto:sap-wug-bounces at mit.edu <mailto:sap-wug-bounces at mit.edu>] On Behalf Of Dart, Jocelyn
> Sent: Monday, June 29, 2015 4:54 PM
> To: SAP Workflow Users' Group
> Subject: [EXTERNAL] Re: Advance With Dialog on Asynchronous Task
>  
> Hi Loren 
> Ok so this is why that method was originally asynchronous as with a transaction the std way to find out if the work was done is to listen for a terminating event.  
>  
> So Catch-22. 
>  
> Maybe see if there is a BAPI that lets you do a synchronous call.  
>  
> Is creating your own alternative UI in SAPUI5 or WDA to control the edit a possible option?
> Rgds
> Jocelyn
> 
> Sent from my iPhone with many apologies for the spelling, grammar and any other deficiencies 
> 
> On 30 Jun 2015, at 5:28 am, Bratzler, Loren <Loren.Bratzler at nscorp.com <mailto:Loren.Bratzler at nscorp.com>> wrote:
> 
> I’m not sure how I am going to be able to tell from within the EDIT method if the document is “COMPLETE” or not.  The method code is executing transaction MIR4 directly like this:
>  
>   begin_method edit changing container.
> 
>   DATA: xwfla1 LIKE boole-boole VALUE 'X'.                  "Note916729
>   SET PARAMETER ID 'RBN' FIELD object-key-invoicedocnumber.
>   SET PARAMETER ID 'GJR' FIELD object-key-fiscalyear.
>   SET PARAMETER ID 'CHG' FIELD 'X'.
>   EXPORT xwfla1 TO MEMORY ID 'FIENJOYWF'.                   "Note916729
>   CALL TRANSACTION 'MIR4' AND SKIP FIRST SCREEN.
> 
>   end_method.
>  
> Loren 
>  
>  
> From: sap-wug-bounces at mit.edu <mailto:sap-wug-bounces at mit.edu> [mailto:sap-wug-bounces at mit.edu <mailto:sap-wug-bounces at mit.edu>] On Behalf Of Ramki Maley
> Sent: Thursday, June 25, 2015 6:02 PM
> To: SAP Workflow Users' Group
> Subject: [EXTERNAL] Re: Advance With Dialog on Asynchronous Task
>  
> Loren,
> 
> Instead of a terminating event for your custom EDIT method, Try issuing an EXIT_CANCELLED if the document is not 'COMPLETE'. This will keep the workitem from completing.
> 
> Cheers,
> Ramki.
> On 6/25/15, 1:58 PM, Bratzler, Loren wrote:
> Hello Wuggers,
>  
> Hope someone can help me here:
>  
> I have a requirement in a workflow to have a two-part approval process for the Incoming Invoice (BUS2081) business object.  The first part of the approval process is to have the approver open the document in Edit mode and review and make revisions to a restricted number of fields.  Once their review is done, we want them to click “Save as Complete” and then automatically advance to the second part of the approval process where the user decision (approve or reject buttons) appear.
>  
> For the first step of the process, I am using the standard EDIT method of the object and when I define my task for using this method, I assign the terminating event “COMPLETED” so that the task will only complete when the user clicks “Save as Complete”.
>  
> The problem is that the EDIT method for this object is asynchronous:
>  
> <image001.png>
>  
> So the “advance with dialog” option does not work to automatically advance to the user decision step where the approve/reject buttons will appear.
>  
> I tried to create my own custom synchronous method in the object that was a copy of the standard method.  I then created a new task to execute this new method and defined the same terminating event.  However, the problem with that is when I insert the task into the workflow, there are two outcome paths.  One path is for the terminating event I assigned but the other path is the normal “advance” path.  This causes the workflow to advance to the user decision step when we don’t want it to.  We only want it to advance when they click “save as complete” and raise the COMPLETED event.  With this configuration, the step advances when they click other options on the screen like “back”, “exit” or “cancel”.
>  
> <image002.png>
>  
> The workflow builder will not allow me to deactivate the “Step executed” outcome for the step:
>  
> <image003.png>
>  
> Error message that occurs when you try to deactivate this outcome:
>  
> <image004.png>
>  
> So I’m trying to figure out is there some way for me to get around these limitations?
>  
> Loren Bratzler
> Norfolk Southern Corporation
> 
> 
> 
> 
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu <mailto:SAP-WUG at mit.edu>
> http://mailman.mit.edu/mailman/listinfo/sap-wug <http://mailman.mit.edu/mailman/listinfo/sap-wug>
>  
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu <mailto:SAP-WUG at mit.edu>
> http://mailman.mit.edu/mailman/listinfo/sap-wug <http://mailman.mit.edu/mailman/listinfo/sap-wug>_______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu <mailto:SAP-WUG at mit.edu>
> http://mailman.mit.edu/mailman/listinfo/sap-wug <http://mailman.mit.edu/mailman/listinfo/sap-wug>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20150705/c8b3bb4a/attachment-0001.htm


More information about the SAP-WUG mailing list