on 03-01-2011 8:11 AM
use case:
A routing step is completed and the SFC is queued for the next routing step(s). (We use simultaneous groups) A custom field is defined on the u201CRouting Step (Operation)u201D called u201CIS_REWORKu201D. The routing step needs to be completed automatically when the SFC has no NC and the routing step has custom field IS_REWORK with value true (we need to handle this in an activity hook, because the simultaneous group does not allow the creation of scripts).
problem statement/ questions:
I have created an activity hook at POST_COMPLETE (using SAP ME 5.2 SP5). That does the following:
- Retrieve SFC and open NCs
- if no open NCs, Retrieve the routing steps the SFC is queued at
- Collect the references to these routing steps (using an unsupported API)
- For each routing step
> Retrieve the custom data field for the routing step
>Check the custom data field value
>If custom data field = true
=>Do a Quick Complete (u201CPASSu201D) for the queued routing step
The completion part works but no custom data fields are returned.
The following code snippet shows how I try to retrieve the custom data:
//Collect Queued steps
SfcIdentifier sfcId = new SfcIdentifier();
sfcId.setSfcRef(dto.getSfcBO().getValue());
Collection<SfcStep> stepList = sfcStateService.findStepsSFCIsInQueueFor(sfcId);
while ( stepIt.hasNext() ){
SfcStep quickStep = stepIt.next();
//Unsupported: Get Step BOHandle
RouterBOHandle routerBO = new RouterBOHandle(quickStep.getRouterRef());
BOHandle routerStepBO = RouterBOHandle.buildStepHandle(routerBO, quickStep.getStepId());
//Read custom field on routing step
ReadCustomDataRequest cdateRequest = new ReadCustomDataRequest();
cdateRequest.setObjectAlias(ObjectAliasEnum.ROUTER_STEP.value());
cdateRequest.setRef(routerStepBO.getValue()); //Using unsupported BOHandle
//Collect custom field information
Collection<CustomValue> routeStepCData = customDataService.readCustomDataForObject(cdateRequest);
//routeStepCData.size() is always 0, what is wrong?
}
Likely problem cause I found:
The reference used for the u201CReadCustomDataRequestu201D is for instance:
RouterStepBO:RouterBO:TEST,S03,U,A,060
The (u201Csameu201D) reference stored in the database (CUSTOM_FIELDS table) is for instance:
RouterOperationBO:RouterStepBO:RouterBO:TEST,S03,U,A,060
It seems like there should be an RouterOperationBO class, but I cannot find it.
How to retrieve custom data fields from Routing Steps the SFC is queued for?
Hi
The easiest workaround is to create a handle similar to one in the database
...
cdateRequest.setRef("RouterOperationBO:"+routerStepBO.getValue());
...
You may also want to report an OSS ticket for this issue.
Thanks
Ivan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You also need to set a different object alias if you are playing with handles:
request.setObjectAlias("ROUTER_OPERATION");
Eventually, I believe router operation ALIAS will be added to the ObjectAliasEnum.
I don't think that the behavior that you observed is a bug. Behind the scenes when saved in Routing Maintenance, the custom data is associated with the router operation object as opposed to the router step. These are the implementation details. In fact, it could have gone to a different table if core ME needed it for whatever reason.
The contract for the Custom data public API is that whatever is saved with the public API can also be retrieved with it. However, it surely could have been made more intuitive for the customers.
Mikhail
User | Count |
---|---|
100 | |
11 | |
11 | |
6 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.