10-13-2006 10:47 AM
Hi workflow gurus
I am trying to implement my own method in a subtyped object type, my requirement is that
if a particular condition is true then a particular outcome should be active.
For example
begin_method mymethod changing container.
select * from xxx where fff = ccc.
case xxx-ggg.
when 'aaa'.
//I want the corresponding outcome to be active
when 'bbb'.
//I want the corresponding outcome to be active
endcase.
end_method.
these outcome should show up in my workflow step.
Can any of the gurus help me out on this.
Regards
Narendiran Rathinavelu
10-13-2006 5:52 PM
Hi,
I am giving you sample code with which your issue will be resolved. in case if you have any problem please ask.
CALL FUNCTION 'Y_WF_PREQ_AUTO_PO_CHG_POSSIBLE'
EXPORTING P_BANFN = OBJECT-KEY-PURCHASEREQUISITION
P_EKGRP = OBJECT-KEY-PURCHASINGGROUP
TABLES T_EBAN_REDUC = T_EBAN_REDUC
T_EKPO_REDUC = T_EKPO_REDUC
T_COMPARISON = T_COMPARISON
T_DIFFERENCE = T_DIFFERENCE
T_MESSAGES_TEXT = T_MESSAGES
T_ENDORSER = T_ENDORSER
EXCEPTIONS PURCHASE_REQ_FIELD_EMPTY = 1
NO_PURCHASE_REQ_DATA_FOUND = 2
NO_PURCHASE_ORDER_DATA_FOUND = 3
FUNCTION_PROBLEM = 4
CURRENCY_CONVERSION_FAILED = 5
NO_ENTRY_IN_T024 = 6
NO_VALID_BUYER_FOUND = 7
QTY_UNIT_CONVERSION_FAILED = 8
NOT_ALL_ITEMS_APPROVED = 9
ALL_CHANGED_REQ_ITEMS_DELETED = 10
SEVERAL_PO_ITEMS = 11.
IF SY_SUBRC <> 0.
CASE SY_SUBRC.
WHEN 1.
EXIT_RETURN 9001 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 2.
EXIT_RETURN 9002 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 3.
EXIT_RETURN 9003 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 4.
EXIT_RETURN 9004 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 5.
EXIT_RETURN 9005 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 6.
EXIT_RETURN 9006 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 7.
EXIT_RETURN 9007 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 8.
EXIT_RETURN 9008 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 9.
EXIT_RETURN 9009 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
Also at Object's Method level you have to define the exceptions which the method can throw.
now when you select the method in your task level, then exceptions defined at this method level will be shown at Task level.
Thanks,
sksingh
10-13-2006 5:52 PM
Hi,
I am giving you sample code with which your issue will be resolved. in case if you have any problem please ask.
CALL FUNCTION 'Y_WF_PREQ_AUTO_PO_CHG_POSSIBLE'
EXPORTING P_BANFN = OBJECT-KEY-PURCHASEREQUISITION
P_EKGRP = OBJECT-KEY-PURCHASINGGROUP
TABLES T_EBAN_REDUC = T_EBAN_REDUC
T_EKPO_REDUC = T_EKPO_REDUC
T_COMPARISON = T_COMPARISON
T_DIFFERENCE = T_DIFFERENCE
T_MESSAGES_TEXT = T_MESSAGES
T_ENDORSER = T_ENDORSER
EXCEPTIONS PURCHASE_REQ_FIELD_EMPTY = 1
NO_PURCHASE_REQ_DATA_FOUND = 2
NO_PURCHASE_ORDER_DATA_FOUND = 3
FUNCTION_PROBLEM = 4
CURRENCY_CONVERSION_FAILED = 5
NO_ENTRY_IN_T024 = 6
NO_VALID_BUYER_FOUND = 7
QTY_UNIT_CONVERSION_FAILED = 8
NOT_ALL_ITEMS_APPROVED = 9
ALL_CHANGED_REQ_ITEMS_DELETED = 10
SEVERAL_PO_ITEMS = 11.
IF SY_SUBRC <> 0.
CASE SY_SUBRC.
WHEN 1.
EXIT_RETURN 9001 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 2.
EXIT_RETURN 9002 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 3.
EXIT_RETURN 9003 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 4.
EXIT_RETURN 9004 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 5.
EXIT_RETURN 9005 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 6.
EXIT_RETURN 9006 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 7.
EXIT_RETURN 9007 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 8.
EXIT_RETURN 9008 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
WHEN 9.
EXIT_RETURN 9009 W_SY-MSGV1 W_SY-MSGV2 W_SY-MSGV3 W_SY-MSGV4.
Also at Object's Method level you have to define the exceptions which the method can throw.
now when you select the method in your task level, then exceptions defined at this method level will be shown at Task level.
Thanks,
sksingh