Events for Change Documents - FM For Event Id

Khanna, Manish manish.khanna at amd.com
Thu Oct 20 00:48:27 EDT 2005


Hi Jerry,

I'm  working on a similar kind of scenario.

Hope the following helps.
1. I used  FM For Event Id

2a. You may face certain issues running the code in FM. This is because
this check FM is called in a update task and you would need to run your
code out of it. 
2b. The workaround is to "not" call the main FM directly. Create a stub
FM and call the main FM using
	CALL FUNCTION-MODULE XXXX STARTING NEW TASK "<ANYNAME>". 
2c. Moreover certain FMs might not run and you may need to add the
extension "IN BACKGROUND TASK" to the function call. 

3. You may use FM 'CHANGEDOCUMENT_READ' to get the change log where you
can compare entries.

4. To find active WF for a document can be both simple or complex
process. 
4a. If it always happens that the document block remains set when the WF
is in process, you may use that flag from the relevant DB tabs.
4b. Else you may use the following code

SELECT * FROM SWWVCONTWI INTO TABLE RELATED_WIS
           WHERE OBJTYPE EQ OBJTYPE AND
                 OBJKEY  EQ CHANGEDOCUMENT_HEADER-OBJECTID
             AND ( WI_STAT NE 'COMPLETED' AND
                   WI_STAT NE 'CANCELLED' ) .

IF SY-SUBRC = 0.
  SELECT * FROM SWWWIHEAD INTO TABLE WILIST
         FOR ALL ENTRIES IN RELATED_WIS
         WHERE WI_ID EQ RELATED_WIS-WI_ID.

  IF SY-SUBRC = 0.
**DELETE SUB WI
    DELETE WILIST WHERE NOT WI_CHCKWI IS INITIAL.
**DELETE OTHER WF FOR THE OBJ
    DELETE WILIST WHERE WI_RH_TASK <> TASK.
**DELETE OLD WF
    DELETE WILIST WHERE WI_STAT <> 'STARTED'.

    IF NOT WILIST[] IS INITIAL.
*WF already in process
      F_EXIT = 'X'.
    ENDIF.
  ENDIF.
ENDIF.
CHECK F_EXIT <> 'X'.

5. Finally you may also need to set block if its already released. Use
'BAPI_PO_RESET_RELEASE'.  If it do not work at first use extension
STARTING NEW TASK 'BLOCK'.

Let me know if you need more help.
 
Regards,
Manish
X-22156

-----Original Message-----
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Jerry.Martinek
Sent: Thursday, October 20, 2005 8:50 AM
To: 'SAP Workflow Users' Group'
Subject: RE: Events for Change Documents - FM For Event Id

Hi Anna & Mike,

Thank you both for your replies.

Mike, it's unfortunate that the help definition for this particular
functionality isn't as clear and easy to understand as your explanation.

Anna, I believe we have based but both myself and the functional person
are fairly new to this area. We believe that our requirement to restart
the requisition approval process(single step) if one is not in progress
after it's changed and the value is less then the set 10% variance is
not available in the standard config.

If it is, please let me know.

Thank you both.
Jerry Martinek


-----Original Message-----
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu]On Behalf
Of Hill, Anna
Sent: Wednesday, October 19, 2005 7:05 AM
To: SAP Workflow Users' Group
Subject: RE: Events for Change Documents - FM For Event Id


Hi Jerry

I'm assuming that the release strategy config can't help you here and
that you are only talking about situations where a new release code is
not being applied? The standard allows you to define tolerances which
determine whether a new release code is to be applied using
characteristics, such as value change outside a specific tolerance,
based on a percentage difference. Perhaps have a look at OMGS (under
release indicator) or speak to a purchasing person who can explain how
it all works if you haven't already taken this into account.

Cheers
Anna
SAP UK

-----Original Message-----
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu] On Behalf
Of Mike Pokraka
Sent: Wednesday, October 19, 2005 1:18 PM
To: SAP Workflow Users' Group
Subject: Re: Events for Change Documents - FM For Event Id

Hi Jerry,

Those FM's are to define the actual event details at runtime rather than
in your event definition. e.g. if you are monitoring a value field and
want to publish an INCREASED or DECREASED event depending on which way
it was changed you would leave the event name blank and use the event ID
FM to determine which event should be raised at runtime.

Similarly, you can leave the object blank and use a FM to determine the
object name - again only needed if you need events for different object
types relating to the same change doc.

HTH
Cheers
Mike

jerry martinek wrote:
> Hi Ramki,
>
> Thank you.
>
> Do you know how the 'FM for object type' and 'event container FM'
work?
> Like with the previous function module, until you have used them, it's

> pretty difficult to understand how to use them. The available help is
not
> that helpfull.
>
> Regards,
> Jerry Martinek
>
>
> Content-Type: multipart/alternative;
>
boundary="--------MailBlocks_8C7A23761D9609C_8BC_82CD_MBLK-M11.sysops.ao
l.com"
>
>
> ----------MailBlocks_8C7A23761D9609C_8BC_82CD_MBLK-M11.sysops.aol.com
> Content-Type: text/plain; charset="us-ascii"
>
> Hi Jerry,
>
> Yes, you can do what you need with the Event Id FM. The FM is executed

> before the event is created. The parameter CHANGEDOCUMENT has the
changes
> and EVENTS has the event which started the FM. You can examine the
changed
> fields and decide whether to raise the event or not. You can also
create
> additional events for the object by adding events to the EVENTS
parameter.
>
>
>    loop at changedocument_position where fname = 'FIELD1'.
> * This is just an example, you may have to do some manipulating to do 
> arithemetic on the old & new
>       Difference = changedocument_position-value_New -
>                          changedocument_position-value_Old.
>       If Difference > 10.
> * Do Nothing - Event will be created.
>       Else.
>          Refresh Events. "No Event Will be created
>       Endif.
>       EXIT.
>    endloop.
>
> *To raise additional events, you simply append the Event name to the 
> EVENTS parameter.
>
> HTH.
>
> Best Regards,
> Ramki Maley,
> WF Developer - USCBP.
>
>
> -----Original Message-----
> From: jerry martinek <jerry.martinek at shawbiz.ca>
> To: sap-wug at mit.edu
> Sent: Tue, 18 Oct 2005 10:03:55 -0700
> Subject: Events for Change Documents - FM For Event Id
>
>
> Hi,
>
> I've looked at the help for the 'FM For Event Id' in the Events for
Change
> Documents and unfortunately I don't understand the explanation. The 
> explanation
>
> "This function module is used to determine event names from the data 
> transferred by the change document. Its interface therefore has event 
> names as
output
> parameters and the change data which is to be saved as input
parameters:"
>
> doesn't answer my question which is what is this function module used
for.
>
> What I need to do is to create a new triggering event if a requisition

> changes when the value of the change is less than 10% and there is no 
> active workflow for a release relevant requisition.
>
> This is an SAP 46C system.
>
> I want to know whether change documents is the place to make this
check.
>
> Thanks,
> Jerry
>
>
>
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
>
> ----------MailBlocks_8C7A23761D9609C_8BC_82CD_MBLK-M11.sysops.aol.com
> Content-Type: text/html; charset="us-ascii"
>
> <HTML><BODY><DIV style='font-family: "Verdana"; font-size:
10pt;'><DIV>
> <DIV>Hi Jerry,</DIV>
> <DIV>&nbsp;</DIV>
> <DIV>Yes, you can do what you need with the Event Id FM.&nbsp;The 
> FM&nbsp;is executed before the event is created. The 
> parameter&nbsp;CHANGEDOCUMENT has the changes and EVENTS has the event

> which&nbsp;started the FM. You can examine the changed fields and
decide
> whether to raise the event or not. You can also create additional
events
> for the object by adding events to the EVENTS parameter.</DIV> 
> <DIV>&nbsp;</DIV> <DIV>&nbsp;</DIV> <DIV>&nbsp;&nbsp; loop at 
> changedocument_position where fname = 'FIELD1'.</DIV>
> <DIV>* This is just an example, you may have to&nbsp;do some
manipulating
> to do arithemetic on the old&nbsp;&amp; 
> new<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Difference = 
> changedocument_position-value_New -</DIV>
>
<DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&
nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> &nbsp;changedocument_position-value_Old.</DIV>
> <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;If&nbsp;Difference&nbsp;&gt;
> 10.&nbsp;<BR>*&nbsp;Do Nothing - Event will be created.</DIV> 
> <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> Else.<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Refresh
> Events. "No Event Will be created<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
> Endif.</DIV>
> <DIV>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; EXIT.<BR>&nbsp;&nbsp; 
> endloop.<BR></DIV> <DIV>*To raise additional events, you simply append

> the Event name to
the
> EVENTS parameter.</DIV>
> <DIV>&nbsp;</DIV>
> <DIV>HTH.</DIV>
> <DIV>&nbsp;</DIV>
> <DIV>Best Regards,</DIV>
> <DIV>Ramki Maley,</DIV>
> <DIV>WF Developer - USCBP.</DIV>
> <DIV>&nbsp;</DIV>
> <DIV>&nbsp;<BR>-----Original Message-----<BR>From: jerry martinek
> &lt;jerry.martinek at shawbiz.ca&gt;<BR>To: sap-wug at mit.edu<BR>Sent: Tue,
18
> Oct 2005 10:03:55 -0700<BR>Subject: Events for Change Documents - FM
For
> Event Id<BR><BR></DIV>
> <STYLE>
> .AOLPlainTextBody {
>     margin: 0px;
>     font-family: Tahoma, Verdana, Arial, Sans-Serif;
>     font-size: 12px;
>     color: #000;
>     background-color: #fff;
> }
>
> .AOLPlainTextBody pre {
>     font-size: 9pt;
> }
>
> .AOLInlineAttachment {
>     margin: 10px;
> }
>
> .AOLAttachmentHeader {
>     border-bottom: 2px solid #E9EAEB;
>     background: #F9F9F9;
> }
>
> .AOLAttachmentHeader .Title {
>     font: 11px Tahoma;
>     font-weight: bold;
>     color: #666666;
>     background: #E9EAEB;
>     padding: 3px 0px 1px 10px;
> }
>
> .AOLAttachmentHeader .FieldLabel {
>     font: 11px Tahoma;
>     font-weight: bold;
>     color: #666666;
>     padding: 1px 10px 1px 9px;
> }
>
> .AOLAttachmentHeader .FieldValue {
>     font: 11px Tahoma;
>     color: #333333;
> }
>
> </STYLE>
>
> <DIV class=AOLPlainTextBody
> id=AOLMsgPart_0_401fa95d-f97f-4785-a3f8-934b158e8458><PRE><TT>Hi,
>
> I've looked at the help for the 'FM For Event Id' in the Events for
Change
> Documents and unfortunately I don't understand the explanation. The 
> explanation
>
> "This function module is used to determine event names from the data 
> transferred by the change document. Its interface therefore has event 
> names as
output
> parameters and the change data which is to be saved as input
parameters:"
>
> doesn't answer my question which is what is this function module used
for.
>
> What I need to do is to create a new triggering event if a requisition

> changes when the value of the change is less than 10% and there is no 
> active workflow for a release relevant requisition.
>
> This is an SAP 46C system.
>
> I want to know whether change documents is the place to make this
check.
>
> Thanks,
> Jerry
>
>
>
> _______________________________________________
> SAP-WUG mailing list
> <A href="mailto:SAP-WUG%40mit.edu">SAP-WUG at mit.edu</A>
> <A href="http://mailman.mit.edu/mailman/listinfo/sap-wug"
> target=_blank>http://mailman.mit.edu/mailman/listinfo/sap-wug</A>
> </TT></PRE></DIV><!-- end of
> AOLMsgPart_0_401fa95d-f97f-4785-a3f8-934b158e8458
> --></DIV></DIV></BODY></HTML>
>
>
----------MailBlocks_8C7A23761D9609C_8BC_82CD_MBLK-M11.sysops.aol.com--
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
> _______________________________________________
> SAP-WUG mailing list
> SAP-WUG at mit.edu
> http://mailman.mit.edu/mailman/listinfo/sap-wug
>


Mike Pokraka
Senior Consultant
Workflow Connections Ltd.
Mobile: +44 (0)7786 910 855
_______________________________________________
SAP-WUG mailing list
SAP-WUG at mit.edu
http://mailman.mit.edu/mailman/listinfo/sap-wug

_______________________________________________
SAP-WUG mailing list
SAP-WUG at mit.edu
http://mailman.mit.edu/mailman/listinfo/sap-wug

_______________________________________________
SAP-WUG mailing list
SAP-WUG at mit.edu
http://mailman.mit.edu/mailman/listinfo/sap-wug





More information about the SAP-WUG mailing list