Skip to Content
0
Mar 01, 2011 at 08:11 AM

Unable to read custom field data from routing step

105 Views

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?