Save binary object via API 2
How do I save a file via the API 2?
Any exsample will help me alot!
I'm trying to save a object to the table Binary_Objects, but I get the error: "com.sap.mdm.internal.protocol.manual.ServerException: Server error (0xffaab000)"
I assume you are trying to create a BinaryBlobRecord in the Binary_Object Table.
Here is some code that works:
BinaryBlobRecord record = RecordFactory.createEmptyBinaryObjectRecord(tableId);
record.setBinary(new BinaryValue(bytes));
record.setDataSize(new IntegerValue(size));
record.setHasOriginal(new BooleanValue(true));
record.setDataGroupId(node.getId()); // get the node using RetrieveGroupTreeCommand command.
record.setSource(new LookupValue(new RecordId(1))); // see below
record.setCode(name); // The code has to be unique, so you can add a random number to the name.
record.setName(new StringValue(name))
CreateRecordCommand createRecordCommand = new CreateRecordCommand(connection);
createRecordCommand.setSession(authenticatedUserSession);
createRecordCommand.setRecord(record);
createRecordCommand.execute();
If you don't set the source properly , you will get that error. For setSource method, you need to set a Location ID. With API 5.5 SP5, most likely there is no way to create a new location ID and we have to use one of the existing Location IDs. Just to make the code work, I used "new LookupValue(new RecordId(1)) ", which requires having at least one file uploaded to the table via MDM Data manager and use the first part of its location ID.
For setDataGroupID, first create the group node in the MDM Data Manager and find the node in the GroupTree with API. To get the GroupTree, use RetrieveGroupTreeCommand.
Similar Messages
-
Is is possible to programmatically create PCD objects such as iViews/Pages etc.?
Hi,
The way to create PCD objects such as iViews and pages is documented in the following link in the help portal (Portal --> Developer Guide --> Developing Applications --> Creating Content --> Managing iViews and Other PCD Objects:
http://help.sap.com/saphelp_nw04/helpdata/en/fd/ea5c42da4de92ce10000000a1550b0/frameset.htm
Here's an overview for creating an iView from a PAR and adding it to the folder at pcd:portal_content/myFolder :
IiViews iViewSrv = (IiViews)
PortalRuntime.getRuntimeResources().getService(IiViews.KEY);
INewObjectDescriptor IVtoCreate = (INewObjectDescriptor)
iViewSrv.instantiateDescriptor(CreateMethod.NEW,
"par:/applications/myProject/components/myComponent",
request.getUser());
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(Context.SECURITY_PRINCIPAL, request.getUser());
env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
InitialContext iCtx = null;
try
iCtx = new InitialContext(env);
String folderName = "pcd:portal_content/myFolder";
Context ctx = (Context)iCtx.lookup(folderName);
ctx.bind("myNewHelloIV", IVtoCreate);
catch(Exception e)
Hope this helps.
Daniel -
Creating an opportunity linked to a contact via API
Hi,
We are trying to create opportunity records against a contact but don't understand how to link the 2 objects via API as my development team can't find a direct link when looking in the WSDL.
I can see in the UI that the primary contact can be stored against the object, would just like to know how to do this via API.
Thanks for your help in advance.
LeslieHello Leslie,
There are a number of ways to accomplish this. As you mentioned in your post there are often Id fields exposed on a parent object that allow one to associate to a record of a different type, in this case you can send a request for the parent object, in this case Contact and specify the ID of an existing Opportunity record.
You can also use the child object structure to create an association. For example, if you are entering a new Contact and a new Opportunity you can use the <ListOfOpportunity> within a Contact Insert request to also insert a new Opportunity. I have attached a sample SOAP request below.
I would recommend your team review the WS User Guide as well as the sample code provided at samplecode.oracle.com for further details. Please see the announcements at the top of the forum for additional links.
I hope this helps.
Thanks,
Sean
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<ContactWS_ContactInsert_Input xmlns="urn:crmondemand/ws/contact/10/2004">
<ListOfContact>
<Contact>
<ContactFirstName>Bruce</ContactFirstName>
<ContactLastName>Wayne</ContactLastName>
<ListOfOpportunity>
<Opportunity>
<OpportunityName>Capture the Joker!</OpportunityName>
<CloseDate>04/10/2011</CloseDate>
<Priority>High</Priority>
<Status>Pending</Status>
<SalesStage>Selected</SalesStage>
</Opportunity>
</ListOfOpportunity>
</Contact></ListOfContact></ContactWS_ContactInsert_Input></soap:Body></soap:Envelope> -
Send XML and receive binary data via SOAP
Hi folks,
following idea (Client-Server-Rendering-Architecture):
1. Send XML as JavaScript variable via SOAP to the InDesign Server
2. Attached the XML String to a new document or template
3. Apply several XMLRules to the docuument
4. Render to document as JPG|PDF whatever
5. Transmit the JPG (means binary) via SOAP back to the client
Following problems raised by implementing this
1. Build a new XML-Object with new XML() works, but how to attach this object to the document, i've just found importXML() but from file, not string and xmlElements.add() for adding just a tag not a whole xml tree. The importXML() performance from a File object is not that fast ...
2. How to render a document not to a file with exportFile() but into a variable, object etc.?
3. How to send a binary object (from an object, a variable or File object if not possible as describe in Q#2) back to the client via SOAP (scriptResult)? Do I have to expand the WSDL (and|or C++ API), any examples?
Thanks for your help, by the way, the describe scenario is what I expect of a rendering server not more not less ...
Tinofor one thing, don't use == to compare strings... You have that all over the place, like:
if(currentElement=="region") { -
Hi all!
Is it possible to create and change worksets dynamically via API? I have found documentation how to read pcd objects and their properties but not how to edit pcd objects:
https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6112ecb7-0a01-0010-ef90-941c70c9e401
best regards
MichaelHi Michael,
(1) To change workset attributes, get the IPcdContext object for the workset, then do something like this:
ModificationItem[] mods = new ModificationItem[1];
mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE,new BasicAttribute("com.sap.portal.navigation.MergePriority", new Double("75")));
myPcdContext.modifyAttributes("",mods);
(2) To create, you could simply bind a new context to the folder you want to place the workset, and set all the attributes (most important, object class and name). This is a little tricky, and there may be side effects I haven;t thought of.
For iView, you would use the IiViews semantic object to create the iView, and this object would take care of almost everything for you. But there is no workset object.
Hope this helps.
Daniel -
AddRecord error when adding binary object
Hi all,
I am getting a2i.core.StringException: AddRecord error when trying to add binary object in the repository using Java API. The code used is as below:
//Adding values in binary table
byte[] fileBuf = file;
A2iFields fields = new A2iFields();
fields.Add(new A2iField("Data ID", new Value(file)));
fields.Add(new A2iField("Name",new
Value("FileName.extn"));
fields.Add(new A2iField("Original Name",new
Value("FileName.extn"));
fields.Add(new A2iField("Data Group ID",new Value(1)));
fields.Add(new A2iField("Data Size", new
Value(file.length)));
fields.Add(new A2iField("Original Location ID", new
Value(999)));
fields.Add(new A2iField("Description",new Value("a
short description ")));
boolean hasOriginal = false;
fields.Add(new A2iField("Has Original", new
Value(hasOriginal)));
String binaryTable = "<Table Name>";
int recID = catalog.AddRecord(imageTable, fields, -1,
-1);
//Adding values in Products table
A2iFields a2iFields = new A2iFields();
a2iFields.Add(new A2iField("<Field1 Name>", new
Value("<Value1>")));
a2iFields.Add(new A2iField("<Field2 Name>", new
Value("<Value2>")));
a2iFields.Add(new A2iField("<Field3 Name>", new
Value("<Value3>")));
a2iFields.Add(new A2iField("<Field4 Name>", new
Value("<Value4>")));
a2iFields.Add(new A2iField( "<Field name for binary
object>", new Value(recID)));
int id = catalog.AddRecord("Products", a2iFields, 0,
0);
Best Regards,
JaydeepHi Jaydeep,
Have you got any solution for this problem ?
We are also facing the same issue. Let us know if you can throw some light on this.
Regards
Vinay. -
Resize an Object via javascript
Resize an Object via javascript
How do I...
I want to select an object in my document, onscreen, (an image, or text) then run a script that will discern the object selected, and show a dialog box that will allow me to input a sizing percentage for that object (with anchor corner/center)(Press enter and object resizes).No they don't.
Acrobat may be bundled with Creative Suite collections but the APIs has nothing in common other than the use of JavaScript. CS apps use the ExtendScript system, Acrobat has its own internal API and an SDK for inter-application control.
PDF is an end-destination format - the page content is not designed to be edited, so while there are tools in the user interface to allow touchups and corrections to page objects those features are not available for automation. The JavaScript engine does not have access to the low-level document structure, it can only see markup (comments and form elements) and a limited range of document properties.
bdmasha wrote:
They are all part of a suite of tools that share a common access to internal api's via scripting/programming languages.
InDesign is not Photoshop is not Illustrator, but they have much in common when accessing their api's that Acrobat does not allow--and Acrobat is part of that Adobe suite.
Thanks again. -
Error while saving activity - it was not possible to save all objects
Hi
We are on ECC6 EHP4 and having just started to config EIC ERP, we have done some configuration and have referred to various SAP notes, the main note being 1052082 to set up case management. We have managed to create an activity but on saving we get the following messages:
Error whilce saving activity (message class HREIC_APPL - message number 246)
Activity was saved
It was not possible to save all objects successfully (message class CRM_BOL - message number 010)
We are not sure how to correct this, we have searched and cannot find anything relating to these messages, I hope someone can be of assistance.
many thanks
JulieHi Julie
There are list of items that dont transport or need to be updated via manual configuration such as number ranges, surveys, email addresses and several others.
Glad you figured out this one.
Jarret -
How to populate Values in Value Set via API or Interface
Dear frds:
i need to know is there any API or interface available to load thousands of values in particular valueset via API or Interface. I know Dataload is the alternative but i don't want to use that as the data is too much so its not feasible.
waiting for your response
Thanks.There is no API for fnd_flex_values.
You will have to do a direct table insert (or call FND_FLEX_VALUES_PKG which does nothing but a direct table insert).
Sandeep Gandhi -
Save different Objects in one file by two different streams
Hi all,
I have a issue to read two Objects from one file if I write those in two different streams.
I open the ObjectOutputStream and save an Object to the file. Then I close this stream and file. Then I open the new ObjectOutputStream and save the second Object in the same file. It works Ok. Then I open the ObjectInputStream and try to read those two objects and get java.io.StreamCorruptedException.
This exception happes only when app tryes to read the second Object.
this is the code example:
//Write part
for (int i=0;i<2;i++)
File file = new File("test.swp");
FileOutputStream fileOut = new FileOutputStream(file,true);
ObjectOutputStream objOut = new ObjectOutputStream(fileOut);
JobObject jobObj = new JobObject();
jobObj.setID(i);
objOut.writeObject(jobObj);
objOut.flush();
objOut.close();
fileOut.close();
//Read part
FileInputStream fileOut = new FileInputStream("test.swp");
ObjectInputStream objOut = new ObjectInputStream(fileOut);
for (int i=0;i<2;i++)
JobObject jobObj = (JobObject)objOut.readObject();
objOut.close();
fileOut.close();
Thank for any help.Maybe try closing the ObjectInputStream (and re-creating it as needed) within your for loop?
- Saish
"My karma ran over your dogma." - Anon -
Hallo,
I want to start a
discussion, to find a best practice method to change several related master
data objects via BDT. At the moment we are faced with miscellaneous requirements,
where we have a master data object which uses BDT framework for maintenance (in
our case an insured objects). While changing or creating the insured objects a
several related objects e.g. Business Partner should also be changed or
created. So am searching for a best practices approach how to implement such a
solution.
One Idea was to so call a
report via SUBMIT AND RETURN in Event DSAVC or DSAVE. Unfortunately this implementation
method has only poor options to handle errors. Second it is also hard to keep LUW
together.
Another idea is to call an additional
BDT instance in the DCHCK-event via FM BDT_INSTANCE_SELECT and the parameters
iv_xpush_classic = ‘X’ and iv_xpop_classic = ‘X’. At this time we didn’t get
this solution working correctly, because there is always something missing
(e.g. global memory is not transferred correctly between the two BDT instances).
So hopefully you can report
about your implementations to find a best practice approach for facing such
requirements.
Hallo
ich möchte an der Stelle eine Diskussion starten um einen Best Practice
Ansatz zu finden, der eine BDT Implementierung/Erweiterung beschreibt, bei der
verschiedene abhängige BDT-Objekte geändert werden. Momentan treffen bei uns
mehrere Anforderungen an, bei deinen Änderungen eines BDT Objektes an ein
anderes BDT Objekte vererbt werden sollen. Sprich es sollen weitere Objekte geänderte
werden, wenn ein Objekt (in unserem Fall ein Versicherungsvertrag) angelegt
oder geändert wird (zum Beispiel ein Geschäftspartner)
Die erste unserer Ideen war es, im Zeitpunkt DSAVC oder DSAVE einen
Report per SUBMIT AND RETURN aufzurufen. Dieser sollte dann die abhängigen Änderungen
durchführen. Allerdings gibt es hier Probleme mit der Fehlerbehandlung, da
diese asynchrone stattfinden muss. Weiterhin ist es auch schwer die Konsistenz der
LUW zu garantieren.
Ein anderer Ansatz den wir verfolgt hatten, war im Zeitpunkt
DCHCK per FuBA BDT_INSTANCE_SELECT und den Parameter iv_xpush_classic = ‘X’ and
iv_xpop_classic = ‘X’ eine neue BDT Instanz zu erzeugen. Leider konnten wir diese
Lösung nicht endgültig zum Laufen bekommen, da es immer Probleme beim
Übertragen der globalen Speicher der einzelnen BDT Instanzen gab.
Ich hoffe Ihr könnt hier eure Implementierungen kurz beschreiben, dass wir
eine Best Practice Ansatz für das Thema finden können
BR/VG
Dominik -
CS3 New smart object via copy not working
1. I open an image in Photoshop CS3 from camera raw (CR) as a smart object.
2. I right click on the layer and choose "new smart object via copy."
3. I double click on the thumb nail to open the image in CR.
4. I make new edits on the image in CR.
5. I click OK.
6. In CS3 both the new layer and the original layer show the edits done in # 4.
I uninstalled and reinstalled CS# to no avail.
I am running CS3 on a Win Vista 64 bit.
If anyone can make a suggestion, I thank you in advance.
JBI should say I am trying to learn this software and stumbling through Mr. Kelby's 7 Point System book.
I found my error. I was highllighting the layers not clicking the eye icons off and on.
Thanks for all who look.
JB -
Open saved draft report via API/UI
How could I open an saved Draft report via API/UI.
I have draft an report via API/UI and now I would show this report on Desktop/SAPSorry for my mismatched formulation of this problem
I would open it via code
z.B. application.forms.items("")
because I get the Docnum of my before safed draft but It wouldn´t shown at the SAP now so I have to open it via code gg
but also thx to you -
In which table the initial balances will be stored when loading via api
Hi all,
I am doing initial balances migration...
In which table the initial balances will be stored when loading though an api.. (pay_balance_upload.process).
First I have loaded data in to pay_balance_batch_headers and pay_balance_batch_lines tables..
Then called the api pay_balance_upload.process. and the data was reflecting correctly in front end.
But we need to reconcile the loaded data.. for that, can anyone please tell me in which the loaded balances would be stored..
I have identified two tables, pay_assignment_latest_balances
and pay_latest_balances
when I try to create a balance from frontend I can see the data in pay_latest_balances table..
But when I load via api I am not able to find it in any of these tables..
In addition to that can anyone please tell me when the data will be populated in pay_assignment_latest_balances and pay_latest_balances tables.
Awaiting for your help and quick response..
Thanks and Regards
KishoreYou have followed the correct process..As Vignesh said, you can use pay_balance_pkg.get_value to make sure you have the correct values uploaded but otherwise if you are able to see the values in the front end I wouldn't worry about the latest balances tables. These tables, as the name indicate, hold only the latest values and if a payroll (ran post the initial balance upload) has been rolled back, these are deleted since they are no longer available.
You can refer the below Metalink notes for a detailed explanation:
The Secret Life of Initial Balance Upload with Screenshots Example [ID 60057.1] -
Script throwing error" Object required: 'API'
Hi All,
We need help in one issue. We have following script which is running fine when we ran it from script editor, but when use this as expression in import format is throwing error
Error: An error occurred importing the file.
Detail: Object required: 'API'
At line: 12
Script:
Function ME_to_LE(strField, strRecord)
ME_to_LE =API.SqlMgr.fMapItemLookup (749, "UD8", Left(strField,3))
End Function
We have created few other Scripts which are running fine and producing required result when we check them with MsgBox. But when we are using these scripts in import format it is saying: Object required: 'API'
IF I can not use API object in import script, how can I process multiple column with one script. We need to derive three-four column based on one input column and we don't want to write separate import script for each column. How and where we can write this script?
Are we missing any step? Any help will be highly appreciated. Looks I asked long question :)
Thanks,
Shivendra
Edited by: shiv2 on Sep 16, 2011 9:30 AM
Edited by: shiv2 on Sep 16, 2011 10:36 AMHi Robb,
"It looks like you and James are on the same project" That is correct.
OK. In requirment we have three-four column based on these column we need to derive few other column. We want to do spilitting and validation in Import itself. This is mainly a Validation requirment.
There is one column which may have 12,13,14,17 or any other number of character in it. first three will represent one dimension but exact value be a mapped result based on these three digits.
There are many validation based on the number on charaters and most importantly we don't want to process other column is validation get failed at any stage.
Do we have anything like Import Action? Probably we want to change that script. Or if we can write something like integration script. We need every column to be processed in one shot.
I don't think it is self explantry. Can we have your email please?
Thanks,
Shivendra
Edited by: shiv2 on Sep 16, 2011 8:52 PM
Maybe you are looking for
-
How can I get iCal to NOT print the time of an event? I entered the event as an all-day event and it prints it with a time in front (eg. "11:00AM Meeting"). I want it to just print "Meeting." Please help!
-
Hi .. A never before seen problem for me .. While working in PS with large files , the program freezes for a moment and bright pixels of flourescent colors of purple and green fill parts of the background screen behind Photoshop. Its getting worse ?
-
Updating Administrators(built-in) with item-level targeting on an enforced policy
I need help with this. In our Computers OU, we have an enforced GPO with a computer policy that adds local admins to the computers on our network. The policy is Computer Configuration >> Policies >> Windows Settings >> Security Settings >> Local Pol
-
Don't see my Xbox from my Microsoft Surface (Devices)
Hi, I just switched from RCN to FiOS Internet. I was able to add my Xbox to the devices (Microsoft Surface), but currently my MS Surface don't see Xbox. The XBox directly connected to the WiFi router and my surface is connected wirelessly. Maybe I sh
-
Hi All, We have three ISE engines in a cluster but one of them consistently develops database error. It happened more than four times already to this ISE box since deployment, which is also the Secondary (Admin) and Pri (M&T) for the cluster. We upgr