cancel
Showing results for 
Search instead for 
Did you mean: 

SDK PAPI CreateTrackableServiceInterface

olivier_thiry
Participant
0 Kudos

Hello,

I tried to create trackable SFC using the related PAPI through SDK...

If I look at the request in the famous API javadoc, it looks like this :

<complexType name="CreateTrackableSfcRequest">

<complexContent>

<extension base="ProductionRequest">

<sequence>

<element name="ruleSet" type="CreateTrackableRuleSet" minOccurs="0"/>

<element name="markSfcAsDone" type="boolean"/>

<element name="requireShopOrder" type="boolean"/>

<element name="qty" type="Qty"/>

<element name="itemRef" type="Handle"/>

<element name="bomRef" type="Handle" minOccurs="0"/>

<element name="priority" type="Priority" minOccurs="0"/>

<element name="parentBomRef" type="Handle" minOccurs="0"/>

<element name="parentComponentRef" type="Handle" minOccurs="0"/>

<element name="sequence" type="Sequence" minOccurs="0"/>

</sequence>

</extension>

</complexContent>

</complexType>

So I fill in what seems to be required :

newSfc.setMarkSfcAsDone(true);

newSfc.setRequireShopOrder(false);

newSfc.setQty(qty);

newSfc.setItemRef(itemBO.toString() + "," + revision);

try {

service.createTrackableSfc(newSfc);

...

But then I got error message telling me the "event" field is required! What is this "event" field (ok, I can see it's a string, but..)? What should I put there ?

Thanks

Olivier

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hello Olivier,

It is unfortunate that your experience with PAPI was not positiive.

Let me try to help.

The CreateTrackableSfcRequest as well as a lot of other production requests is derived from the ProductionRequest. You might notice that in the javadoc and even in the XSD snippet:


<complexType name="CreateTrackableSfcRequest">
<complexContent>
<extension base="{http://www.visiprise.com/sapme/5.2/production}ProductionRequest">

The ProductionRequest in turn defines extra required fields and unfortunately it is easy to overlook. The event field is one of them.

The value of field is for example baseRelease:SFC that maps to the ActivityLogConfig.event (ACITIVITY_LOG_CONFIG.EVENT field). It is needed in order to identify what activity log configuration should apply.

Now when invoking PAPI method you need to make sure that you are properly autheticated (for 6.0 and above authenticated through UME and for 5.2 authenticated through the ME login module which requires site to be passed in). If you are running in an unsecured context (for example from an unprotected webservice) you can use com.sap.me.security.RunAsServiceLocator to pass site/user information at your own risk. This should eliminate the missing site error.

Hope that helps.

Regards,

Mikhail

olivier_thiry
Participant
0 Kudos

Hi Mikhail,

Thanks for you very usefull reply... Problem for us is that we are quite "dummy" in Java. For dummies like us, it will be very helpfull to have example of PAPI call in the javadoc, but I know documentation is not always the priority...

I copied the code from a previous WS I did, and for which no authorisation was set, as in this one I didn't call any PAPI.

So I will try to set authorisation passing user/pwd as you suggested, and tell you the result.

Regards

Olivier

PS:I tried the way you suggested, and it's working now, ready to post another PAPI question ;o)

Thanks

Edited by: Olivier Thiry on Feb 1, 2012 1:18 PM

Answers (1)

Answers (1)

olivier_thiry
Participant
0 Kudos

And if I put a "guessed" value, like "CREATE", I got the error : site is missing, but there is no site field!

Except in the ItemRef, which is of type ItemBo, but the site is well defined in it.

It's really a pitty everytime we try to use a PAPI, we are facing such issues, never knowing what to pass... And finally having to develop our own function using direct SQL or other...