Data retrieval from MDM 5.5 using Java API
Hi,
Does anyone have a sample Java code snippet that can be called via XI to retrieve data from a repository in MDM 5.5 ?
Cheers
Colin.
Colin,
What exactly do you want to do?
If you want to retrieve data from MDM, you need to have Java application call the API's provided.
Where is XI coming into picture?
Other way of doing it is to develop a web service and call that via XI and send the data.
Here is quick snippet to get some data.
Sample code for FreeForm search:
SearchParameters sparam = search.GetParameters ();
FreeFormTableParameter fftParam =
sparam.NewFreeFormTableParameter(ProductsTable);
FreeFormParameterField ffParamField =
fftParam.GetFields().New(PartNumberField);
ffParamField.GetValues().NewString(
partNoValue,FreeFormParameter.PrefixSearchType);
search.Add(fftParam);
Regards,
Ravi
Note : Please reward the posts that help you.
Similar Messages
-
Need help in getting MDM relationship details using Java Apis
Hi,
Is it possible to search records which are in relationship using Java Apis? Suppose Record A is Parent record and Record B,C,D ... are child records.
I have to search all the records which are in relationship with record A.
Can any one send code snippet on this.
Regards,
NirajHi Niraj,
You can use RetrieveRelationshipsCommand api to get the relationship child of the Anchor Record.
RetrieveRelationshipsCommand command = new RetrieveRelationshipsCommand(connectionAccesor);
command.setSession(session);
command.setAnchorRecord(anchorRecord); / command.setAnchorRecordId(anchorRecordId); (use any of the two statements)
command.setRelationship(relationshipId); //For child int type is 10, and for Parent_child int type is 5
command.setMemberResultDefinition(resultDefinition);
command.execute();
//Get Member Records' resuld definition
ResuldDefinition rd = command.getMemberResultDefinition();
Hope this helps you. -
Req. Sample code for the Updation of Master record in MDM using Java API..
Hi All,
Can anyone provide me the same code for Updation of master record in MDM using Java API ??Hi SakthiNarayananD,
You can additionally go through the following links to work with MDM and Java API:
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2d18d355-0601-0010-fdbb-d8b143420f49 (Java API)
http://help.sap.com/javadocs/MDM/SP05/(Java api programs)
https://help.sap.com/javadocs/MDM/current/index.html (java api codes)
http://help.sap.com/javadocs/MDM/SP06P2/index.html (Java Docs for SP06)
Reg: Using JAVA API - Search
Re: Retrieving Drop Down List Value using JAVA API - Lookup values
How to retreive records from Lookuptable of type flat - Lookup Values
Reg: MDM with webdynpro - READ,INSERT,MODIFY
Hope It Helped
Thanks & Regards
Simona Pinto -
How to upload Image to MDM 5.5 SP3 using Java APIs
Hi,
I am trying to upload Image to Images table in MDM 5.5 using JAVA API for MDM. But. I'm not able to find particular field in Images table where I need to set the Blob object ( Image data ).
I'm not aware of the method to set the Blob, there is one for getting the Image data.
I have gone through I am not able to add images into Catalog thru java API forums posts and tried the code. But with no luck....
I think this code is for some other MDM version as the fields mentioned are not present in the Images table e.g. DataObject - this field is used in the above posts to set the Blob data but this field does not exist in Images table in MDM 5.5
Can anyone suggest the solution?
Thanks and Regards,
MausamHi Mausam,
Please try the following:
// adding to a image table
// get the bytes for the image
byte[] imageBuf = readFile("C:\pic.bmp");
// setup A2iFields
fields = new A2iFields();
fields.Add(new A2iField("DataObject", new
Value(imageBuf))); // the image binary (required)
fields.Add(new A2iField("Name", new Value("pic.bmp")));
// a name for the image
fields.Add(new A2iField("OrigName", new
Value("pic.bmp"))); // the original image file name
(required)
fields.Add(new A2iField("DataGroupId", new Value(888)));
// the data group to add to (required)
fields.Add(new A2iField("OrigLocationId", new
Value(999))); // the data location of the image
(required)
fields.Add(new A2iField("Description", new Value("a
short description"))); // a short description here
// add the image
String imageTable = "Images";
catalog.AddRecord(imageTable, fields, -1, -1);
It's taken out of the API guide for SP3 (the example for method AddRecord.
Best regards,
Amit -
How to build a small application using Java API
Hai expertise,
I want to retreive MDM repository info using JAVA API, i am following these blogs:
/people/andreas.seifried/blog/2006/03/26/performing-free-form-searches-with-mdm-java-api
/people/udi.katz/blog/2005/08/21/retrieving-data-from-mdm-server-using-the-mdm-java-api
/people/udi.katz/blog/2005/07/17/mdm-connectivity-to-java-application
<b>where to get the jar and sda files to build the application??
In Developer Studio.. Windows -> Preferences -> Java -> Classpath variables. Is this the only place where we need to give the jar file path??
Are there any other configurations to do(except setting container variable to MDM4J jar file) to connect my java application to MDM repository???</b>
Regards,
Chand.Hi Govada,
(1)You need to add the MDM4j and other JAR files at:-
right click on project -> Java Build Path -> Libraries -> Add External JARs
(2)If the project is Web Dynpro project one
then right click on project -> Web Dynpro Reference -> Library Reference -> and add sap.com/com.sap.mdm.tech.mdm4j
Are you using JAVA API 1 or 2???
Thanking you
Namrata Dixit -
How to retrieve data from MDM using java API
hi experts
Please explain me the step by step procedure
how to retrieve data from MDM using java API
and please tell me what are the
important classes and packages in MDM Java API
thanks
ramuHi Ramchandra,
You can refer to following links
MDM Java API-pdf
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/2d18d355-0601-0010-fdbb-d8b143420f49
webinr of java API
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/89243c32-0601-0010-559d-80d5b0884d67
Following Fourm Threads will also help.
Java API
Java API
Re: usage of java API ,
Matching Record
Need Java API for Matching Record
Thanks and Regards,
Shruti.
Edited by: Shruti Shah on Jul 16, 2008 12:35 PM -
How to cache images retrieved from MDM on Java WebAS
Hello Colleagues,
We have a scenario where we are trying to retrieve image records from the MDM using Java APis. Instead of hitting the DB everytime, is there a way to implement caching? For instance, is it possible to cache the images on the java WebAS and return the path of the images instead of returning the byte stream everytime?
Thanks and Regards,
Nisha
Edited by: Nisha NC on Sep 1, 2009 7:35 AMHi Nisha,
You can use the Class ObjectCache from the Java API.
For more information please refer to:
http://help.sap.com/javadocs/MDM71/current/API/index.html
Hope this helps,
Idan -
Best option to push Mass data using Java API
Hi All,
Can any one let me know how Java API push data to MDM? Is it a good option when ti comes to perfromance point of view? We have around 2000/5000 records to be imported every time using Java API and wondering what would be best way to acheive this using Java API?
Is java API is best option than Web services?
Thanks
RajeevRajeev,
It is perfectly fine to use API to push data into MDM, you just need to make sure that your API does all those tasks which import manager does by default. For example, it should know when to insert and when to update. if an error happens during insertion of record, you should be able to notify the users.
Having said that, where does the number 2000/5000 comes in? will you be creating users in batch and then invoke MDM API to store these in a single shot or willl it be a delta insert/update from Java to MDM?
Thanks
Aamir -
How to create a taxonomy using MDM 5.5 SP05 JAVA API?
Hi ALL,
I have a requirement in which i have to create a taxonomy using MDM 5.5 SP05 JAVA API.
Can anyone tell me how that functionality can be achieved?
Thanks in Advance.
Rajat.HI, Rajat.
For exposing hierarchy in WD view you need to use node with recursive children in the context and Tree/TreeNodeType UI elements in view layout.
For load hierarchy records you have to use RetrieveLimitedHierTreeCommand. You can load whole hierarchy (as I know, SP05 API have a bug - only first 1000 record can be loaded) or load hierarchy nodes on demand (using OnLoadChildren action of TreeNodeType element).
Refer to this example of loading child records:
// Context structure:
// Tree (model node, model class built from com.sap.mdm.data.Record interface)
// |-- Children (recursive child node repeating Tree node)
// |-- DisplayValue (string value attribute, TreeNodeType's text property bound here)
// |-- HasChildren (boolean value attribute, TreeNodeType's hasChildren property bound here)
// parentElem is element of node Tree or Children for which we must load child records, null for first level of hierarchy
private void fillNodeWithChildren(IPrivateHierarchySelectView.ITreeElement parentElem) {
// Determining RecordId of parent record and context node to which child records belong
RecordId parentRecordId = null;
if (parentElem != null) parentRecordId = parentElem.modelObject().getId();
IPrivateHierarchySelectView.ITreeNode parentNode =
parentElem == null
? wdContext.nodeTree()
: parentElem.nodeChildren();
// Loading children with RetrieveLimitedHierTreeCommand
try {
RetrieveLimitedHierTreeCommand retTreeCmd = new RetrieveLimitedHierTreeCommand(...); // use suitable constructor
if (parentRecordId != null) retTreeCmd.setRootNode(parentRecordId);
retTreeCmd.setResultDefinition(...); // don't forget set ResultDefinition
retTreeCmd.execute();
HierNode subRoot = retTreeCmd.getTree()
parentNode.invalidate();
// Processing loaded child records - add elements into parentNode
if (subRoot == null) return;
IPrivateHierarchySelectView.ITreeElement childElem;
HierNode childRecord;
HierNode[] children = subRoot.getChildren();
int count = children == null ? 0 : children.length;
for (int i = 0; i < count; i++) {
childRecord = children<i>;
childElem = parentNode.createTreeElement(childRecord);
childElem.setDisplayValue(childRecord.getDisplayValue());
childElem.setHasChildren(!childRecord.isLeaf());
parentNode.addElement(childElem);
if (parentElem != null) parentElem.setHasChildren(count > 0);
} catch (/* Some MDM Exceptions */) {}
Don't forget call fillNodeWithChildren(null) in wdDoInit for load first level of hierarchy. -
Tell me how to format a date retrieved from a MS SQL Server 2000 database?
Tell me how to format a date retrieved from an MS SQL Server 2000 database for various uses in my JSP page?
Or if you want to use JSTL instead of a scriptlet see:
http://forum.java.sun.com/thread.jspa?threadID=676754&tstart=0 -
Search for a Multilingual value in MDM using JAVA API
Good day,
Could you kindly assist.
I am trying to search for a field in MDM, from Portal using JAVA API. I do retrieve the value in English, but the problem is when I am trying to retrieve it in other languages. Please see sample code:
private Search getSearch(MDMConnection mdmconnection,String value, TableId tableid){
Search search =null;
FieldSearchDimension fielddimension=null;
TextSearchConstraint textcontrain=null;
RepositorySchema reposchema =mdmconnection.reposchema;
if(value!=null)
search= new Search(tableid);
fielddimension=new FieldSearchDimension(reposchema.getFieldId("ATTR_VAL_ABBR","TEXT_VALUE"));
textcontrain=new TextSearchConstraint(value,TextSearchConstraint.EQUALS);
search.addSearchItem(fielddimension,textcontrain);
search.setComparisonOperator(Search.AND_OPERATOR);
return search;
Thank you in advance.
Regards,
SimniHi ,
Mdm- Multilingual value in MDM using JAVA API:
you can check the first point as its reagrdign youisue related pdf and soloutions for your question.
1. http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0e8aedc-cdfe-2c10-6d90-bea2994455c5?QuickLink=index&overridelayout=true
2. http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b0e8aedc-cdfe-2c10-6d90-bea2994455c5?QuickLink=index&overridelayout=true
Hope this information helps you in solving the issue!!
Thanks&Regards
AswinChandraGirmaji -
How to compare 2 dates in SQL Server 2000 DB using Java?
How do you compare 2 dates in SQL Server 2000 DB using Java?
Let's say we have two fields: Date Reported and Target Finish Date.
Date Reported is 09-10-2004 09:55:55: PM
Target Finish Date is 09-12-2004 11:59:59: PM
What i want to happen is i want to convert both dates to days and get the difference of the two.
can SQL Server 2000 DB do this?it doesnt wrk.
ok here's what i did:
iv tested a simple code for this case.
I created a table name tblDate which has 3 columns namely date_ID, date_From (datatype datetime), date_To (datatype datetime).
I inserted 1 row: date_ID has the value 1, date_From has the value 10/22/2004, and date_To has the value 10/24/2004.
i run the java code below:
int days = 0;
String query = "SELECT date_From, date_To cast(date_From-date_To AS int) AS Diff FROM tblZoo WHERE date_ID = '1'";
try
DBConnect db = new DBConnect();
db.openCon();
ResultSet rs = db.execute(query);
while(rs.next())
days = rs.getInt("Diff");
db.closeCon();
catch (Exception ex)
System.out.println("Error on Execution: " + ex);
return days;___________
an error occurred: Error on Execution: java.lang.nullpointerexception -
Uploading images whit thumbnail to MDM repository using Java API
Hello,
can someone tell me how to upload images whit thumbnail to MDM repository using Java API?
i get following message using setHasThumbnail(true):
com.sap.mdm.commands.CommandException: com.sap.mdm.internal.protocol.manual.ServerException: Ungültiger Wert für Parameter
thanksYou can upload images to MDM via the API, but the only way to create thumbnails is via the MDM Data Manager application which uses some embedded libraries to do the work.
Walter -
How to retrieve CPU id in linux using java?
Hello everyone!!
I want to retrieve CPU Id from a liux system using java code.
Please reply with code if possible.
Thank you in advance.Open "/proc/cpuinfo" and parse.
-
Modifying record in MDM using JAVA API
hello all
I have created record in MDM using JAVA API now I want to update record using API. I used ModifyRecordCommand. But this requires input as Record but I have RecordID of the record to be modified. How do I get Record value from RecordID.Hi,
You can use RetrieveRecordsByIdCommand to get the record by Record Id.
RetrieveRecordsByIdCommand recordbyidcom = new RetrieveRecordsByIdCommand(con);
recordbyidcom.setSession(session);
recordbyidcom.addId(recordid);
recordbyidcom.setResultDefinition(resultdefinition);
recordbyidcom.execute();
RecordResultSet rs = recordbyidcom.getRecords();
Record record = rs.getRecord(0);
//Modify the record
record.setFieldValue(fieldid,value);
ModifyRecordCommand modify = new ModifyRecordCommand(con);
modify.setSession(session);
modify.setRecord(record);
modify.execute();
Regards,
Sreenivasulu Thimmanapalli.
Edited by: Sreenivasulu Thimmanapalli on Dec 8, 2008 2:36 AM
Maybe you are looking for
-
E72 - Contacts quick search doesn't work correctly
Hello! I have over 1,500 contacts in Outlook and has successfully synchronized them with Nokia E72 (last firmware). But quick search in Contacts application simply doesn't work - I can find only few contacts - others just dissapear when I start typi
-
My desktop (hp Pavilion) is not reading anything from my cd/dvd drive
I was having problem with my desktop (no hardware issue. So I decided to wipe it clean by re-installing the Windows vista. I had my DVD' s so I went ahead and redid the installing, At the end of the installation I got an error message saying there wa
-
i have a cinema display and i just downloaded the new mac os x lion. the problem is that i can't use full screen with my display, when i push the full screen button the app moves to my macbook, but i want it to stay at the display.
-
Visio 2013 free trial crashes every time I try to open it
I just got done downloading a trial version of the 32-bit Visio Professional 2013. Every time I try to open the program, the program freezes & I get the following message on the Visio startup screen: Microsoft Visio has stopped working. A problem ca
-
I usually don't like to wake up to a blaring beep in the morning, so I used my ipod and my nice com. speakers as my alarm instead. But recently, the alarm didn't activate at all. I tried restoring, updating, and resetting everything I could think of.