Skip to Content
0
Former Member
Mar 18, 2012 at 09:29 AM

how to create,start and complete a SFC in an activity hook at PRE_START

56 Views

Hi experts,

I am new to SAP ME SDK 2.0 development.I want to Create,Start and Complete SFC in an activity hook at PRE_START. I am using the following API's

1. CraeteSfcServiceInterface. 2 SfcStartServiceInterface. 3.SfcCompleteServiceInterface. And I am trying to create, start a SFC as folllows.however I am unable to Create ,Start and Complete a SFC.

// SFC Create

CreateSfcServiceInterface createSfcService = Services.getService ("com.sap.me.production", "CreateSfcService");

CreateSfcRequest sfcReq = new CreateSfcRequest();

sfcReq .setOperationRef(""); //Operation

sfcReq .setQuantity(new BigDecimal(1.0)); // SFC Qty

sfcReq .setResourceRef(value); //the resource to the operation

sfcReq .setSfc("") // gennerated SFC Number

createSfcService.createSFC(sfcReq);

// SFC Start

ServiceReference serviceRef = new ServiceReference("com.sap.me.production", "SfcStartService");RunAsServiceLocator serviceLocator = new RunAsServiceLocator(user,site, null);

SfcStartServiceInterface service = serviceLocator.getService(serviceRef, SfcStartServiceInterface.class);

List<StartSfcRequest> sfcStartReqList = new ArrayList<StartSfcRequest>();

StartSfcRequest sfcStartReq = new StartSfcRequest();

sfcStartReq .setOperationRef(""); //Operation

sfcStartReq .setQuantity(new BigDecimal(1.0)); // SFC Qty

sfcStartReq .setResourceRef(value); //the resource to the operation

sfcStartReq .setSfc("") // gennerated SFC Number

sfcStartReqList.add(sfcStartReq);

service .start(sfcStartReqList);

my SFC Start code is working fine.however the SFC is showing the status as "In Work" instead of "In Queue". where and what I am missing in the above code.Can anybody help me in this.

Thanks in advance,

Eswaraiah