cancel
Showing results for 
Search instead for 
Did you mean: 

Unable to read custom field data from routing step

Former Member
0 Kudos

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?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

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

Former Member
0 Kudos

Yes, I tried that already. Did not mention, sorry. This action results in an ObjectNotFoundException. Do you think it is a bug?

Former Member
0 Kudos

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

Former Member
0 Kudos

Thanks Mikhail! That was the missing piece! Works!!!

(Too bad the RouterOperationBO is not part of the api and the enumeration is incomplete. That would indeed increase intuitivity)

Answers (0)