cancel
Showing results for 
Search instead for 
Did you mean: 

AsBuilt functionality using AssemblyServiceInterface

Former Member
0 Kudos

Hi,

Does any body used AssemblyServiceInterface.assembleAsBuiltComponents(AssembleAsBuiltComponentsRequest req) method to fetch the assembly details of a particular SFC.

Or

does anybody know how to retrive the assembled component and to perform the change in the component through AsBuilt functionality?

please find my code snippet, which i tried to fetch the details of the particular SFC.

AssembleAsBuiltComponentsRequest req= new AssembleAsBuiltComponentsRequest();

req.setSfcRef("SFCBO:ABC,"+sfcnumber);

While trying to execute the below given statement i am getting exception.

AssembleComponentsResponse res= assemblyService.assembleAsBuiltComponents(req);

kindly let to me know how to get the assembled components details and perform change in the assembled component using AsBuilt functionality.

regards,

Joe.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

It depends on what kind of change you are trying to perform, for example add new components, Remove (scrap) existing components, etc.

If BOM component ref is known that adding additional components Iindeed can be done by the

com.sap.me.production.AssemblyServiceInterface.assembleAsBuiltComponents(AssembleAsBuiltComponentsRequest)

alternatively if bom component ref is not known (for example you have just inventory id) you can use

com.sap.me.production.AssemblyServiceInterface.assembleAsBuiltIdentifiers(AssembleAsBuiltIdentifiersRequest)

AssembleAsBuiltIdentifiersRequest request 

                                               AssemblyIdentifier assemblyIdentifier = new AssemblyIdentifier();
		assemblyIdentifier.setIdentifier(inventoryID);
		assemblyIdentifier.setQty(BigDecimal.ONE);
		List<AssemblyDataField> assyDataFields = createInventoryAssemblyDataFields(inventoryID);
		assemblyIdentifier.getAssemblyDataFields().addAll(assyDataFields);

com.sap.me.production.AssemblyServiceInterface.assembleNonBomComponents(AssembleNonBomComponentsRequest)

In the request object you need to specify just the new components. Use the following method to populate com.sap.me.production.AssembleComponentsRequest.setComponentList(List<AssemblyComponent>)

Please be aware that you are not supposed to construct the sfcRef object the way you showed in the example. Ref objects must be obtained through finders only (for example com.sap.me.production.SfcStateServiceInterface.findSfcByName(FindSfcByNameRequest)).

Removal of a component can be done using:

com.sap.me.production.RemoveComponentServiceInterface.removeComponents(RemoveComponentsRequest)

You can retrieve all the information related to the assembly state using

com.sap.me.production.RetrieveComponentsServiceInterface

For example:

com.sap.me.production.RetrieveComponentsServiceInterface.findAssembledAsBuiltComponents(GroupAssembledAsBuiltComponentsRequest)

Former Member
0 Kudos

Thanks Mikhail - your solution helped me a lot to handle the situation.

I am using SAP ME SDK2.0.2 version.

In your response you specified that - we can use the below given method to fetch the sfcRef details by inputing the SFC number.

com.sap.me.production.SfcStateServiceInterface.findSfcByName(FindSfcByNameRequest))

But no such method "findSfcByName(FindSfcByNameRequest)" was found in the API list for SfcStateServiceInterface interface.

can you please let to me know what version of SDK are you using and where you find this method.

regards,

Joe

Former Member
0 Kudos

Hi Joe,

I was referring to the method that was added on ME 6.0 (SDK 2.1). For your SDK version please use com.sap.me.production.SfcStateServiceInterface.findSfcById(String) which sort of provides identical functionality.

I verified that this method is available in ME 5.2.5 and above.

Regards,

Mikhail

Former Member
0 Kudos

Hi Mikhail,

Thanks for your response - i am not able to find findSfcById(String) in SfcStateServiceInterface in the supported API list.

My SAP ME version is 5.2.4.7 & my SDK Version is 2.0.2.

I fetched the details of the assembled components by constructing the SFCRef manually for the time being using RetrieveComponentsServiceInterface.findAssembledAsBuiltComponents() method.

After getting the details i tried to remove a trackable component using the RemoveComponentServiceInterface.removeComponents(RemoveComponentsRequest) method.

The RemoveComponentsRequest contains the RemoveComponentlist.

I constructed the list as given below and setted to the request object.

RemoveComponentServiceInterface removeComponentInf= Services.getService("com.sap.me.production","RemoveComponentService");

RemoveComponentsRequest removeCompReq= new RemoveComponentsRequest();

RemoveComponent removecomp= new RemoveComponent();

removecomp.setComponentRef(ComponentRef);

removecomp.setQty(qty);

removecomp.setSfcAssyRef(InventoryRef);

removecomp.setSfcRef(SfcRef);

List<RemoveComponent> removeComponentList= new ArrayList();

removeComponentList.add(removecomp);

removeCompReq.setRemoveComponentList(removeComponentList);

and while trying to execute the removeComponents(removeCompReq) as given below i am getting an exception "com.sap.me.frame.domain.RequiredValueValidationException".

RemoveComponentsResponse removeCompRes=removeComponentInf.removeComponents(removeCompReq);

kindly share me the detail on how to resolve this issue.

regards,

Joe

Former Member
0 Kudos

Hi Joe,

As far as findSfcById: I suppose it was added on 5.2.5, and I recommend that you upgrade to the latest ME service pack/patch (for better API support, better quality).

In general if you catch RequiredFieldvalidationException (or any other exception that derives from FieldValidationException) you can get access to the following properties of the exception for troubleshooting:

RequiredValueValidationException.getField() - name of the field that failed the validation

RequiredValueValidationException.getForClass() - DTO class that failed the validation

RequiredValueValidationException.getValue() - this one will be null

In this case I believe that you are missing the event field in the RemoveComponent (it is inherited from the BaseProductionRequest). The value of field is for example baseSrap:SFC that maps to the ActivityLogConfig.event (ACITIVITY_LOG_CONFIG.EVENT field).

The field is needed in order to decide whether activity logging is needed. I agree that this one is probably not that obvious from the outside.

Thanks,

Mikhail