Check FM does not work

Flavio Oliveira oliveiraflavio at hotmail.com
Wed Oct 24 08:29:00 EDT 2001


Another possible solution (that I normally use) is to use the function
moduloe "ENQUEUE_READ" to verify if the document being created is blocked or
not by someone.
 
If you put this function in a loop (do-->enddo), you can read the document
at the moment that it is not blocked anymore (that means, that it is
completely created).
 
By doing this you can verify what you want and let the event be raised or
not.
 
Regards.
Flavio.
 
>From: "Van Heerde, Arnoud" <arnoud.van.heerde at sap.com>
>Reply-To: SAP Workflow Users' Group <SAP-WUG at MITVMA.MIT.EDU>
>To: SAP-WUG at MITVMA.MIT.EDU
>Subject: Re: Check FM does not work
>Date: Wed, 24 Oct 2001 03:25:36 +0200
>
>Hi Patrick,
>
>Document type is a field defined in BKPF, so why not use BKPF.Created as a
>triggering event. You can customize this in the Open-FI interface, just
>link
>a function module to business transaction event 00001050. In the interface
>of the sample function module you can see that BSEG is passed as a table as
>well.
>
>Hope this helps,
>
>Arnoud
>
>
>-----Original Message-----
>From: de Valensart Schoenmaeckers, Patrick
>[mailto:deValensartSchoenmaeckers.Patrick at pmintl.ch]
>Sent: Wednesday, October 24, 2001 1:43 AM
>To: SAP-WUG at MITVMA.MIT.EDU
>Subject: Check FM does not work
>
>Hi workflowers.
>
>I want to trigger an approval workflow for all FI-AP documents, except for
>a
>FI document type "ZR". I have then linked my workflow to the event
>BSEG.CREATED with a "check" function module that raise an exception if the
>document type is ZR (via transaction SWE2).
>However, it looks like when posting an FI document, the function module is
>called before that the table BKPF is updated. So my select statement does
>not select anything, and the FM does therefore not raise an exception as
>expected. When I try to use the test tool "generate event" (transaction
>SWUE), it works fine (which is normal, because I am then working on an
>existing document.)
>
>I searched OSS to solve this problem without success. I also tried to put a
>"commit work" statement in the function module, but that gives an error
>message (a sap office Express info "Update was terminated") when trying to
>post the document, and it is not posted. Any help or tip to solve this
>would
>be very much appreciated.
>
>Thanks in advance & Kindest regards to all.
>
>Patrick de Valensart
>Associate IS Analyst
>Philip Morris Benelux M&S
>
>
>P.S. Here is my FM :
>
>FUNCTION Z_AP_WF_EVENT_CHECK_NOT_ZR.
>*"----------------------------------------------------------------------
>*"*"Update function module:
>*"
>*"*"Local interface:
>*"       IMPORTING
>*"             VALUE(OBJTYPE) LIKE  SWETYPECOU-OBJTYPE
>*"             VALUE(OBJKEY) LIKE  SWEINSTCOU-OBJKEY
>*"             VALUE(EVENT) LIKE  SWEINSTCOU-EVENT
>*"             VALUE(RECTYPE) LIKE  SWETYPECOU-RECTYPE
>*"       TABLES
>*"              EVENT_CONTAINER STRUCTURE  SWCONT
>*"       EXCEPTIONS
>*"              DO_NOT_TRIGGER
>*"----------------------------------------------------------------------
>   INCLUDE <CNTAIN>.
>   DATA : BEGIN OF KEY,
>            BUKRS LIKE BSEG-BUKRS,
>            BELNR LIKE BSEG-BELNR,
>            GJAHR LIKE BSEG-GJAHR,
>            BUZEI LIKE BSEG-BUZEI,
>          END OF KEY.
>   CLEAR KEY.
>   KEY = OBJKEY.
>* commit work.
>   SELECT SINGLE * FROM BKPF WHERE BUKRS = KEY-BUKRS
>                               AND BELNR = KEY-BELNR
>                               AND GJAHR = KEY-GJAHR.
>   IF BKPF-BLART EQ 'ZR'.
>     RAISE DO_NOT_TRIGGER.
>   ENDIF.
>
>ENDFUNCTION.
 
 
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
 


More information about the SAP-WUG mailing list