Material Master Workflow
Kisloff, Philip B
Philip.Kisloff at astrazeneca.com
Fri Jul 21 06:44:25 EDT 2006
Hi Vijay,
The problem with creation of one material master view completing all other
parallel workitems view can be solved by creating a "view-specific" check
function to the terminating event binding. Hope the example code helps (its
from four years ago, so I'm a bit rusty on the details)
Phil
FUNCTION z_multi_view_maintenance.
*"----------------------------------------------------------------------
*"*"Local interface:
*" IMPORTING
*" VALUE(EVENT) LIKE SWETYPECOU-EVENT
*" VALUE(RECTYPE) LIKE SWETYPECOU-RECTYPE
*" VALUE(OBJTYPE) LIKE SWETYPECOU-OBJTYPE
*" VALUE(OBJKEY) LIKE SWEINSTCOU-OBJKEY
*" VALUE(EXCEPTIONS_ALLOWED) LIKE SWEFLAGS-EXC_OK DEFAULT 'X'
*" EXPORTING
*" VALUE(REC_ID) LIKE SWELOG-RECID
*" TABLES
*" EVENT_CONTAINER STRUCTURE SWCONT
*" EXCEPTIONS
*" INVALID_MATCH
*"----------------------------------------------------------------------
INCLUDE <cntain>.
DATA: old_wi_id LIKE swwwihead-wi_id.
DATA: local_wi_header LIKE swwwihead.
* search work item from receiver
swc_get_element event_container evt_receiver_id old_wi_id.
local_wi_header-wi_id = old_wi_id.
* read workitem container
CLEAR wi_container. REFRESH wi_container.
CALL FUNCTION 'SWW_WI_CONTAINER_READ'
EXPORTING
wi_id = local_wi_header-wi_id
TABLES
wi_container = wi_container
EXCEPTIONS
container_does_not_exist = 01.
READ TABLE wi_container WITH KEY element = 'VIEW'.
CASE wi_container-value.
WHEN 'V'. " Sales
READ TABLE wi_container WITH KEY element = 'PLANT'.
READ TABLE event_container WITH KEY element = 'PLANT'.
IF wi_container-value(4) <> event_container-value(4).
RAISE invalid_match.
ENDIF.
when 'L'.
READ TABLE wi_container WITH KEY element = 'STORAGELOCATION'.
READ TABLE event_container WITH KEY element = 'STORAGELOCATION'.
************************
tables indx.
export wi_container-value event_container-value
to database indx(wf) id 'test1'.
************************
IF wi_container-value+5(4) <> event_container-value(4).
RAISE invalid_match.
ENDIF.
READ TABLE event_container WITH KEY element = 'PLANT'.
IF wi_container-value+1(4) <> event_container-value(4).
RAISE invalid_match.
ENDIF.
WHEN 'S'. " Warehouse
READ TABLE wi_container WITH KEY element = 'WAREHOUSE'.
READ TABLE event_container WITH KEY element = 'WHSENUMBER'.
IF wi_container-value+9(3) <> event_container-value(3).
RAISE invalid_match.
ENDIF.
WHEN 'D'. " MRP
READ TABLE wi_container WITH KEY element = 'PLANT'.
READ TABLE event_container WITH KEY element = 'PLANT'.
IF wi_container-value(4) <> event_container-value(4).
RAISE invalid_match.
ENDIF.
WHEN 'E'. " Purchasing
READ TABLE wi_container WITH KEY element = 'PLANT'.
READ TABLE event_container WITH KEY element = 'PLANT'.
IF wi_container-value(4) <> event_container-value(4).
RAISE invalid_match.
ENDIF.
WHEN 'B'. " Accounting
READ TABLE wi_container WITH KEY element = 'PLANT'.
READ TABLE event_container WITH KEY element = 'VALUATIONAREA'.
************************
export wi_container-value event_container-value
to database indx(wf) id 'test3'.
************************
IF wi_container-value(4) <> event_container-value(4).
RAISE invalid_match.
ENDIF.
WHEN OTHERS.
ENDCASE.
ENDFUNCTION.
-----Original Message-----
From: sap-wug-bounces at mit.edu [mailto:sap-wug-bounces at mit.edu]On Behalf Of K
Vijayasekar
Sent: 21 July 2006 05:04
To: SAP WF User group
Subject: Re : Material Master Workflow
Hi Friends ,
Presently i'm given a task of creating workflow for
material master creation. Following is the scenario...
1. One user ( Initiator ) will create a basic data 1 & 2 and the workflow
should be triggered .
2. Other views like Sales , MRP , Scheduling will be created by different
people , hence each user should receive a workitem in their sap inbox for
creating the required view.
I have identified business object BUS1001006 for this workflow and i'm
planning to use the following methods and events.
Events :
Created --> to trigger the workflow
ViewCreated --> terminating event for the Workitem ( for view
creation )
Methods :
GetMissedViews --> to get all the required views to be created for this
material.
CreateView --> to create required for the material.
I'm facing two problems......
1. Using "GetMissedViews" i'm getting all the missing view details in a
multiline container element . I have created parallel task ( by putting
multiline container element in the "Others" tab . Terminating event for this
task is "ViewCreated".
Depending on the no. of views in the multiline item , that many workitem
gets created.
The issue is if once view gets created all the other workitems are removed
from my inbox ( status completed ).
2. At the time of creation of basic data1 & 2 , the org. elements are not
required . I want to determine the agent for rest of the views by the
org.elements . How can we acheive it ???
Help me to reslove above 2 issues ......If any done workflow material master
please do share you technical expetise...
Regards,
Vijay
_____
Yahoo! Messenger with Voice. Make
<http://us.rd.yahoo.com/mail_us/taglines/postman1/*http://us.rd.yahoo.com/ev
t=39663/*http://voice.yahoo.com> PC-to-Phone Calls to the US (and 30+
countries) for 2¢/min or less.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mit.edu/pipermail/sap-wug/attachments/20060721/18133ff1/attachment.htm
More information about the SAP-WUG
mailing list