Attachments using MDM java API
Hi
How to store attachments in MDM repository using MDM java API.
Could you please suggest us.
Thanks
Sowmya
Hi Sowmya,
You can store attachments using MDM Java API. You can use the following piece of code.
BinaryBlobRecord record2 = RecordFactory.createEmptyBinaryObjectRecord(tableID);
//Attachment to be saved
String filePath = wdContext.currentContextElement().getVa_Resource().getUrl(0);
IWDResource resource = wdContext.currentContextElement().getVa_Resource();
FileInputStream stream = (FileInputStream)resource.read(true);
int length = 0;
while(stream.read() != -1)
length++;
byte[] b = new byte[(int) length];
stream.read(b);
stream.close();
record.setName(new StringValue("filename"));
record.setOriginalName(new StringValue("filename"));
record.setHasOriginal(new BooleanValue(true);
RetrieveGroupTreeCommand groupTreeCommand = new RetrieveGroupTreeCommand(wdContext.currentContextElement().getVa_ConnectionStr());
groupTreeCommand.setSession(wdContext.currentContextElement().getVa_SessionID());
groupTreeCommand.setGroupType(GroupTypes.DATA_GROUP_TYPE);
groupTreeCommand.execute();
//Set data location and data group ID
record.setDataLocationId(new GroupNodeId("GN2"));
record.setDataGroupId(new GroupNodeId("GN2"));
record.setBinary(new BinaryValue(b));
CreateRecordCommand createRecComm =
new CreateRecordCommand(wdContext.currentContextElement().getVa_ConnectionStr());
createRecComm.setSession(wdContext.currentContextElement().getVa_SessionID());
createRecComm.setRecord(record);
createRecComm.execute();
//Link this record to the main table record
Record QRec = RecordFactory.createEmptyRecord(mainTable);
//Setting the above created record in main table record object
QRec.setFieldValue(attachmentField, new LookupValue(record.getId()));
CreateRecordCommand createRecComm =
new CreateRecordCommand(wdContext.currentContextElement().getVa_ConnectionStr());
createRecComm.setSession(wdContext.currentContextElement().getVa_SessionID());
createRecComm.setRecord(QRec);
createRecComm.execute();
Now the main table record is created with an attachment.
Hope this helps you.
Regards,
Sruti
Similar Messages
-
How to retrieve the data from MDM hierarchy table using MDM Java API
Hi,
I had a hierarchy table in MDM. This table had some column say x. I want to retrieve the values of this x column and need to show them in a drop down using MDM Java API.
Can anyone help me to solve this?
Regards
VallabhaneniHi,
Here is your code...
TableId Hier_TId = repository_schema.getTableId(<hierarchy table id>);
java.util.List list = new ArrayList();
ResultDefinition Supporting_result_dfn = null;
FieldProperties[] Hier_Field_props =rep_schema.getTableSchema(Hier_TId).getFields();
LookupFieldProperties lookup_field = null;
TableSchema lookupTableSchema = null;
FieldId[] lookupFieldIDs = null;
for (int i = 0, j = Hier_Field_props.length; i < j; i++) {
if (Hier_Field_props<i>.isLookup()) {
lookup_field = (LookupFieldProperties) Hier_Field_props<i>;
lookupTableSchema =repository_schema.getTableSchema(lookup_field.getLookupTableId());
lookupFieldIDs = lookupTableSchema.getFieldIds();
Supporting_result_dfn = new ResultDefinition(lookup_field.getLookupTableId());
Supporting_result_dfn.setSelectFields(lookupFieldIDs);
list.add(Supporting_result_dfn);
com.sap.mdm.search.Search hier_search =new com.sap.mdm.search.Search(Hier_TId);
ResultDefinition Hier_Resultdfn = new ResultDefinition(Hier_TId);
Hier_Resultdfn.setSelectFields(rep_schema.getTableSchema(Hier_TId).getDisplayFieldIds());
ResultDefinition[] supportingResultDefinitions =
(ResultDefinition[])list.toArray(new ResultDefinition [ list.size() ]);
RetrieveLimitedHierTreeCommand retrieve_Hier_tree_cmd =
new RetrieveLimitedHierTreeCommand(conn_acc);
retrieve_Hier_tree_cmd.setResultDefinition(Hier_Resultdfn);
retrieve_Hier_tree_cmd.setSession(Auth_User_session_cmd.getSession());
retrieve_Hier_tree_cmd.setSearch(hier_search);
retrieve_Hier_tree_cmd.setSupportingResultDefinitions(supportingResultDefinitions);
try {
retrieve_Hier_tree_cmd.execute();
} catch (CommandException e5) {
// TODO Auto-generated catch block
e5.printStackTrace();
HierNode Hier_Node = retrieve_Hier_tree_cmd.getTree();
print(Hier_Node,1);
//method print()
static private void print(HierNode node, int level) {
if (!node.isRoot()) {
for (int i = 0, j = level; i < j; i++) {
System.out.print("\t");
System.out.println(node.getDisplayValue());
HierNode[] children = node.getChildren();
if (children != null) {
level++;
for (int i = 0, j = children.length; i < j; i++) {
print(children<i>, level);
//end method print()
Best regards,
Arun prabhu S
Edited by: Arun Prabhu Sivakumar on Jul 7, 2008 12:19 PM -
How to access the SAP MDM destinations using mdm java api in 7.1
hi,
I have SAP MDM 7.1 SP11 and SAP Portal 7.3 and developing the custom webdynpro application using the JAVA MDM API. I want configure the SAP MDM destinations in SAP Portal .
How to access the MDM destinations in java code using API? and how to create the connection with MDM using the MDM destinations.
Please provide the code for access the SAP MDM destinations in java code using MDM java api and creating the connection to MDM.
ThanksJun,
Thanks for the reply and api information.
I have got this api information from the following sap documentation. But i am looking for the code by implementing this class and creating the mdm connection.
Creating an MDM Connection Using Java Code - SAP NetWeaver Master Data Management (MDM) - SAP Library
if any thing can you share it.
Thanks -
How to populate boolean fields using MDM Java API's
Hi Experts!
I am trying to populate Boolean fields in main table of my repository using MDM JAVA API SP 05 patch 2.
Problem is i am geting syntax error for any value that i try to put in.
Please provide me sample code for the purpose.
Thanks in advance!Hi,
Here is the code snippet to populate boolean values from Main Table in the Repository:
Populating boolean values from Main Table in the Repository:
wdContext.currentNodeElement().setABC(Boolean.valueOf((strABC).toString()).booleanValue());
Putting boolean values in the main table:
Record objEmptyRecord = RecordFactory.createEmptyRecord(new TableId(strTableId));
boolean bFieldValue = ((Boolean)strABC).booleanValue();
objEmptyRecord.setFieldValue(new FieldId(strFieldId),new
BooleanValue(bFieldValue));
Hope this helps.
Regards
Neha Sharma -
How to create relationship between two records using MDM Java APIs
Hi,
I am trying to create relationship between two records using Java Apis. Please guide me in doing this.
Regards,
NirajHi Niraj,
There is ModifyRelationshipsCommand:
http://help.sap.com/javadocs/MDM/SP06/com/sap/mdm/data/commands/ModifyRelationshipsCommand.html
Retrieve Relationship command:
http://help.sap.com/javadocs/MDM/current/com/sap/mdm/schema/commands/GetRelationshipListCommand.html
Also, please refer similar thread, MDM Java API and relationships.
Hope it helps..
Regards,
Mandeep Saini -
Use MDM java Api for saving an image to mdm image table
Hi experts
I want to save an image from web dynpro java to MDM image table using java Api's
Can anyone provide a code snippet .
I am using MDM 7.1 sp6.
Thanks and regards
SureshHello Suresh
Unfortunatly, this is no possible, i mean, to load images to mdm repository through JAVA API.
Sure you can do it directly to database ( but for that you need to do saome investigation)
Here you can found JAVA API classes for MDM:
http://help.sap.com/javadocs/MDM71/
Next two classes are working with BLOBs (pdf, images, video, etc.) in MDM repository:
com.sap.mdm.blobs
com.sap.mdm.blobs.commands
Regards
Kanstantsin chernichenka
Edited by: kanstantsin_ch on Sep 8, 2011 2:36 PM -
Retrieving lookup field values from a main table using MDM JAVA APIs
Hi all,
am trying to retrieve the main table data...., i could able to retrieve all the data except lookup field values..., iam facing some runtime exceptions and i dont know why exactly it is throwing this exception..., i pasted piece of code where exactly the error is and the exception also.
in the below sode i set some result set definitions and passing them to retrieveLimitedRecordsCommand. it is showing some exception at retrieveLimitedRecordsCommand.execute(); command.
//*** Code ***//
supportingMainResultDefinitions = new ResultDefinition[] { rdQual ,rdFlat, rdqFlat };
retrieveLimitedRecordsCommand.setResultDefinition(rd);
retrieveLimitedRecordsCommand.setSearch(new Search(tableId));
retrieveLimitedRecordsCommand.setSession(sessionId);
retrieveLimitedRecordsCommand.setSupportingResultDefinitions(supportingMainResultDefinitions);
try {
retrieveLimitedRecordsCommand.execute();
PrintRecords.toConsole(retrieveLimitedRecordsCommand.getRecords());
} catch (CommandException e) {
e.printStackTrace();
//*** Below is the Exception raised ***//
java.lang.UnsupportedOperationException: Unexpected field type -1
at com.sap.mdm.internal.schema.PropertiesHelper.createField(PropertiesHelper.java:274)
at com.sap.mdm.internal.schema.PropertiesHelper.convertFrom(PropertiesHelper.java:281)
at com.sap.mdm.internal.data.RecordMetadata.<init>(Unknown Source)
at com.sap.mdm.internal.data.RecordsLoader.<init>(Unknown Source)
at com.sap.mdm.internal.data.RecordsLoader.<init>(Unknown Source)
at com.sap.mdm.internal.data.RecordResultSetHelper.convertFrom(Unknown Source)
at com.sap.mdm.data.commands.RetrieveLimitedRecordsCommand.execute(Unknown Source)
at com.sap.mdm.apitutorial.lesson2.RecordsDisplay.getDisplayRecords(RecordsDisplay.java:303)
at org.apache.jsp.Sample_jsp._jspService(Sample_jsp.java:190)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:362)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:825)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:738)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:526)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:534)
If anyonw worked on this concept..., please provide me the solution
Regards
Praveen kWhich version are you using? Can you please try and narrow down to the offending field? You can do this by limiting the fields you provide to ResultDefinition.
-
How to add record in Qualified table using MDM Java API
Hi experts,
I am trying to add a record into a Table.
but I am facing the problem in setFieldValue method.
//Getting Field-ID to pass in setFieldValue() method.
FieldId[] fields = new FieldId[6];
fields[0] = repSchema.getFieldId("GTINs", "Description");
fields[1] = repSchema.getFieldId("GTINs", "Unit_Descriptor");
fields[2] = repSchema.getFieldId("GTINs", "GTIN");
fields[3] = repSchema.getFieldId("GTINs", "Alternate_Item_Classifications");
fields[4] = repSchema.getFieldId("GTINs", "Country_Of_Origin");
fields[5] = repSchema.getFieldId("GTINs", "Bar_Coded");
Record rec = RecordFactory.createEmptyRecord(mainTableId);
rec.setFieldValue(fields, );
but I am not getting how to assign the value to these fields using MDMvalue Interface.
Can anyone provide me the code sample or Code flow so that I can do this.
Plz help me it'll be great help for me.
Thanks
Tarun
Edited by: Tarun Sharma on Feb 4, 2008 11:39 AM
==========================================================================================
Hi Gurus
I found the way to add the MDMValue in setFieldValue Method.
we can set like this:
setFieldValue(<fieldId object like fieldId[], <MdmValue like this> new StringValue("ABC"));
Now I am facing problem in adding value to lookup flat table.
According to the setFieldValue method we can assign the loookup like this:
setFieldValue(<fieldId[0]>, new LookpValue(<here we have to pass the recordID of lookup table>);
so I want to know how I can pass the recordId of lookup table here.
Please suggest.
Thanks
Tarun Sharma
Edited by: Tarun Sharma on Feb 4, 2008 3:15 PM
Edited by: Tarun Sharma on Feb 4, 2008 3:25 PM
Edited by: Tarun Sharma on Feb 8, 2008 6:58 PMHi Andrea,
I tried your suggestion but now i am getting Type Mismatch Error.
Please suggest me what I can do?
//TableId for Lookup[Flat].
TableId lookupTableId = repSchema.getTableId("Return_Goods_Policies");
FieldId[] ReturnGoodsPolicyTableIdFields = new FieldId[1];
ReturnGoodsPolicyTableIdFields[0] = repSchema.getFieldId("Return_Goods_Policies", "Name");
Record recLookup = RecordFactory.createEmptyRecord(lookupTableId);
try{
recLookup.setFieldValue(ReturnGoodsPolicyTableIdFields[0], new StringValue("New_Brand"));
}catch(Exception ex){
System.out.println(ex);
//Creating Record in Qualified Table - Request Details
CreateRecordCommand createLookupcommand = new CreateRecordCommand(simpleConnection);
createLookupcommand.setSession(session);
createLookupcommand.setRecord(recLookup);
createLookupcommand.execute();
//Getting the recordId of Lookup record.
RecordId lookupRecordId = createLookupcommand.getRecord().getId();
//Table Id for Qualified table.
TableId qualifiedTableId = repSchema.getTableId("Ext_Hardlines");
FieldId[] ExtHardlinesFields = new FieldId[3];
ExtHardlinesFields[0] = repSchema.getFieldId("Ext_Hardlines", "Name");//Text
ExtHardlinesFields[1] = repSchema.getFieldId("Ext_Hardlines", "Pieces_Per_Trade_item");//Integer
ExtHardlinesFields[2] = repSchema.getFieldId("Ext_Hardlines","Return_Goods_Policy");
Record recQualified = RecordFactory.createEmptyRecord(qualifiedTableId);
try{
recQualified.setFieldValue(ExtHardlinesFields[0], new StringValue("Qualified Value"));
recQualified.setFieldValue(ExtHardlinesFields[1], new StringValue("Qualified Description"));
recQualified.setFieldValue(ExtHardlinesFields[2], new LookupValue(lookupRecordId));
}catch(Exception ex){
System.out.println(ex);
//Creating Record in Qualified Table - Request Details
CreateRecordCommand createQualifiedCommand = new CreateRecordCommand(simpleConnection);
createQualifiedCommand.setSession(session);
createQualifiedCommand.setRecord(recQualified);
createQualifiedCommand.execute(); I am getting this Type match here, but i m not getting what mistake i did.
RecordId qualifiedRecordId = createQualifiedCommand.getRecord().getId();
//Adding to Main Table
TableId mainTableId = repSchema.getTableId("GTINs");
FieldId[] gtinsFields = new FieldId[1];
gtinsFields[0] = repSchema.getFieldId("GTINs","Ext_Hardlines");
Record recMain = RecordFactory.createEmptyRecord(mainTableId);
//Adding the new record to Qualifed Lookup value and setting the Yes Qualifiers
QualifiedLookupValue qualifiedLookupValue = new QualifiedLookupValue();
qualifiedLookupValue.createQualifiedLink(qualifiedRecordId);
try{
recMain.setFieldValue(gtinsFields[0], new QualifiedLookupValue(qualifiedLookupValue));
}catch(Exception ex){
System.out.println(ex);
CreateRecordCommand createCmd = new CreateRecordCommand(simpleConnection);
createCmd.setSession(session);
createCmd.setRecord(recMain);
createCmd.execute();
Could you help me out?
Thanks
Tarun -
While creating connection to MDM repository using MDM JAVA API
I am getting the following error message:
Unexpected field type 28
I am able to debug that this error message is being displayed after executing the following line of code:
/** Get the Repository schema */
GetRepositorySchemaCommand repositroySchemaCommand =
new GetRepositorySchemaCommand(simpleConnection);
repositroySchemaCommand.setSession(repositorySession);
repositroySchemaCommand.execute();
Now can anyone please explain how to resolve this error?
Thanks in Advance.
Rajatpublic void getRepositoryConnection(
java.lang.String hostName,
java.lang.String repositoryName,
java.lang.String userId,
java.lang.String passWord) {
//@@begin getRepositoryConnection()
try {
if (simpleConnection == null) {
simpleConnection =
SimpleConnectionFactory.getInstance(hostName);
// Establish TCP Connection to the server
if (simpleConnection != null) {
// wdComponentAPI.getMessageManager().reportSuccess("Got Connected");
/** Establish a repository session with the respository */
//Set the region properties
RegionProperties dataRegion = new RegionProperties();
/** Set region code for the session */
dataRegion.setRegionCode("engUSA");
/** Set the locale on data region */
dataRegion.setLocale(new Locale("en", "US"));
/** Set the name of data region */
dataRegion.setName("US");
// Createa repository identifier
RepositoryIdentifier repositoryID =
new RepositoryIdentifier(
repositoryName,
hostName,
DBMSType.MS_SQL);
/** Create the User Session */
CreateUserSessionCommand createUserSessionCommand =
new CreateUserSessionCommand(simpleConnection);
/** Set the repository identifier (mandatory)*/
createUserSessionCommand.setRepositoryIdentifier(
repositoryID);
/** Set the region properties for the session (mandatory) */
createUserSessionCommand.setDataRegion(dataRegion);
createUserSessionCommand.execute();
/** Get the session identifier */
this.userSession =
createUserSessionCommand.getUserSession();
AuthenticateUserSessionCommand authenticateUserSessionCommand =
new AuthenticateUserSessionCommand(simpleConnection);
/** Set session identifier (mandatory)*/
authenticateUserSessionCommand.setSession(userSession);
/** Set id of repository user(mandatory) */
authenticateUserSessionCommand.setUserName(userId);
/** Set password (mandatory)*/
authenticateUserSessionCommand.setUserPassword(passWord);
/** Establish the session */
authenticateUserSessionCommand.execute();
SetUnicodeNormalizationCommand unicodeNormalizationCommand =
new SetUnicodeNormalizationCommand(simpleConnection);
unicodeNormalizationCommand.setSession(userSession);
unicodeNormalizationCommand.setNormalizationType(
SetUnicodeNormalizationCommand.NORMALIZATION_COMPOSED);
unicodeNormalizationCommand.execute();
CreateRepositorySessionCommand repositorySessionCommand =
new CreateRepositorySessionCommand(simpleConnection);
/** Set the repository identifier */
repositorySessionCommand.setRepositoryIdentifier(
repositoryID);
/** Obtain repository session */
repositorySessionCommand.execute();
/** Store the session id into the variable repositorySession */
this.repositorySession =
repositorySessionCommand.getRepositorySession();
/** Authenticate the users session */
AuthenticateRepositorySessionCommand authenticatedRepositorySession =
new AuthenticateRepositorySessionCommand(simpleConnection);
/** set the session id */
authenticatedRepositorySession.setSession(
repositorySession);
/** set id of the repository user */
authenticatedRepositorySession.setUserName(userId);
/** set password */
authenticatedRepositorySession.setUserPassword(passWord);
authenticatedRepositorySession.execute();
/** Get the Repository schema */
GetRepositorySchemaCommand repositroySchemaCommand =
new GetRepositorySchemaCommand(simpleConnection);
repositroySchemaCommand.setSession(repositorySession);
repositroySchemaCommand.execute();
this.schema = repositroySchemaCommand.getRepositorySchema();
} catch (Exception e) {
wdComponentAPI.getMessageManager().reportException(
e.getMessage(),
true);
//@@end -
How to start to work on MDM JAVA API by using webdynpro for java
Hi all
I have basic idea on MDM business package thru portal by using standard iViews.
now i am planning to work on MDM JAVA APIs by using Webdynpro for Java as UI.
1) can you please share the required documents on the same. how to start working on this by using MDM JAVA APIs in webdynpro for java
2) what are the JARs files are required and how to integrate those jar files into webdynpro for java application.
3) is there any SDN help on MDM JAVA API with webdynpro for java? . can you please send the link on the same.
4) can you please help by providing sample code on how to use JAVA APIs for retrieving,deleting,inserting and Updating the data in the database.
if anybody helps on the same then it is the great help to me.
points are always rewardable...
Regards
Suresh babuHi Suresh,
You can have the MDM JAVA API javadocs from the link
http://help.sap.com/javadocs/MDM/SP06P2/index.html
There you can see a package named com.sap.mdm.examples.The classes in it contains some examples using which you can start understanding the code.
You need to have MDM JAR files for it. And these JAR files to be used at build time can be added to the project thru :-
Right click on project-> properties->Java Build Path - > Add external JARs
At run time you can add them the reference in
Right click on project-> properties->web dynpro references->library reference.
Thanks
Namrata -
MDM Java API (Creation of table)
Hi,
can anyone help me for creation of tables in repository using MDM java API .
Can u Provide sample code for this.
Edited by: Srikanth Josyula on Jun 26, 2008 8:52 AMHi Srikanth,
Check with this code.It may be useful.
createflattable.java
Created on June 25, 2008, 5:08 PM
To change this template, choose Tools | Options and locate the template under
the Source Creation and Management node. Right-click the template and choose
Open. You can then make changes to the template in the Source Editor.
package tabletype;
import com.sap.mdm.commands.AuthenticateRepositorySessionCommand;
import com.sap.mdm.commands.CommandException;
import com.sap.mdm.commands.CreateRepositorySessionCommand;
import com.sap.mdm.commands.GetRepositoryRegionListCommand;
import com.sap.mdm.data.MultilingualString;
import com.sap.mdm.data.RegionProperties;
import com.sap.mdm.data.RegionalString;
import com.sap.mdm.net.ConnectionException;
import com.sap.mdm.net.ConnectionPool;
import com.sap.mdm.net.ConnectionPoolFactory;
import com.sap.mdm.schema.TableProperties;
import com.sap.mdm.schema.commands.CreateTableCommand;
import com.sap.mdm.schema.commands.GetFieldListCommand;
import com.sap.mdm.schema.commands.GetTableListCommand;
import com.sap.*;
import com.sap.mdm.server.DBMSType;
import com.sap.mdm.server.RepositoryIdentifier;
import java.util.Locale;
public class createflattable {
/** Creates a new instance of createflattable */
public createflattable() {
private static MultilingualString createMultilingualString(RegionProperties[] regionPropertiesList, String baseString)
MultilingualString mlString = new MultilingualString();
for (int i = 0; i < regionPropertiesList.length; i++)
Locale locale = regionPropertiesList<i>.getLocale();
//Locale locale = regionPropertiesList<i>.getLocale();
String regionCode = regionPropertiesList<i>.getRegionCode();
String string = baseString + "_" + locale.getLanguage() + "_" + locale.getCountry();
RegionalString regionalstring = new RegionalString(string, regionCode);
mlString.set(regionalstring);
return mlString;
private static TableProperties createFlatTable(RegionProperties[] regionPropertiesList)
//MultilingualString tableName = createMultilingualString(regionPropertiesList, "NewTable" + System.currentTimeMillis());
MultilingualString tableName = createMultilingualString(regionPropertiesList, "first"+System.currentTimeMillis());
System.out.println("table is" +tableName);
TableProperties table = new TableProperties(TableProperties.FLAT);
table.setName(tableName);
table.setCode("NewCode" + System.currentTimeMillis());
table.setKeyMappable(true);
table.setDescription("");
return table;
public static void main(String[] args) {
// System Name
String tag = "";
ConnectionPool connections = null;
try {
connections = ConnectionPoolFactory.getInstance(tag);
catch (ConnectionException e)
e.printStackTrace();
return;
//////////////// specify the repository to use
//RepositoryName
String repositoryName = "";
//DataBase Name
String dbmsName = "";
RepositoryIdentifier reposId = new RepositoryIdentifier(repositoryName, dbmsName, DBMSType.MS_SQL);
/////// create a repository session
CreateRepositorySessionCommand sessionCommand = new CreateRepositorySessionCommand(connections);
sessionCommand.setRepositoryIdentifier(reposId);
try {
sessionCommand.execute();
catch (CommandException e) {
e.printStackTrace();
return;
System.out.println("Currently connected to "+reposId);
String sessionId = sessionCommand.getRepositorySession();
/////////// authenticate the repository session
String userName = "";
String userPassword = "";
AuthenticateRepositorySessionCommand authCommand = new AuthenticateRepositorySessionCommand(connections);
authCommand.setSession(sessionId);
authCommand.setUserName(userName);
authCommand.setUserPassword(userPassword);
try {
authCommand.execute();
catch (CommandException e) {
e.printStackTrace();
return;
//////////////////// retrieve the list of tables
GetTableListCommand tableListCommand = new GetTableListCommand(connections);
tableListCommand.setSession(sessionId);
try {
tableListCommand.execute();
catch (CommandException e) {
e.printStackTrace();
return;
// get change stamp
// this is required when we make any kind of changes to the repository
int changeStamp = tableListCommand.getChangeStamp();
//////get repository regionlist
//A command for retrieving the list of regions supported by the repository.
// retrieve the available regions (languages) for the repository
// we need this to set up the table name for each region
GetRepositoryRegionListCommand gm = new GetRepositoryRegionListCommand(connections);
gm.setRepositoryIdentifier(reposId);
try {
gm.execute();
catch (CommandException e) {
e.printStackTrace();
return;
// RegionProperties[] rs = gm.getRegions();
RegionProperties[] regionPropertiesList = gm.getRegions();
TableProperties newtable = createFlatTable(regionPropertiesList);
CreateTableCommand c = new CreateTableCommand (connections);
c.setSession(sessionId);
c.setTable(newtable);
c.setInChangeStamp(changeStamp);
try {
c.execute();
System.out.println("sdf");
catch (CommandException e) {
e.printStackTrace();
return; -
Hi,
I am using SAP MDM 5.5 SP05. Can someone guide me on how to install MDM Java API.
I referred to many threads on SDN but couldn't get through any.
I have already downloaded the java API which has one .sca file and two folders, each has some .jar files and javadoc folder.
Kindly help on how should i go with it.
Regards,
Chintan ShethHi Chintan,
You wont install MDM Java API as u install your MDM server or client.
<b>What the use of the MDM Java API?</b>
1. Stand-alone Java Applications.
U can use MDM java API for your stand-alone applications that runs locally on your PC etc... For this you can import the MDM Java jar file into to the library of yourstand alone java application project.
2. J2EE Application or custom MDM iview in EP or SAP Webdynpro Apllication.
U can deploy the .sca file in the SAP WAS Java using the SDM client and u can extend the MDM Java API in your J2EE Application or custom MDM iview in EP or SAP Webdynpro Apllication
get back for help...
Regards,
Vijay -
MDM java api search on Main table
Hi All,
I am developing MDM Web dynpro custom application using MDM java API 2. I am having difficulty while searching on main table by date field. The fields type in MDM as u201CTime Stampu201D how I make my search constraints. Please point me if there is any tutorial or sample code.
Thanks
John.Hi John,
Try using the following code snippet.
TableId tableId = schema.getTable("Products").getId();
FieldId fieldId = schema.getField("Products", "Update_Date").getId();
FieldSearchDimension searchDimension = new FieldSearchDimension(fieldId);
Calendar cal = Calendar.getInstance();
cal.set(2009, 11, 24);
DateTimeSearchConstraint dateConstraint = new DateTimeSearchConstraint(cal, DateTimeSearchConstraint.GREATER_THAN);
Search search = new Search(tableId);
search.addSearchItem(searchDimension, dateConstraint);
Here "Products" is the name of the table on which the search is done. "Update_Date" is a field of type Timestamp. I've hard-coded the date currently. You can use the various Date constructors to set the date dynamically.
Regards,
Anil Madhavan -
Some question about mdm java api and portal content
Hi Gurus,
I am new to MDM. I am going to develop some web dynpro application using mdm java api.
My question is regarding the relationship between MDM version and NW version:
for example
1.MDM5.5 JAVA api can be deployed to CE 7.11 server?
2.MDM7.1 JAVA API can be deployed to CE 7.11 server? or can only be deployed to CE server.
the same question for the MDM portal content.
the possible dev environment for our company would be:
1.MDM7.1
2.CE7.2(do we need another EP7 server for the UWL?)
Best regards,
JohnHi,
I am using Portal 7.0. MDM version is 7.1.
My problem is ... i am trying to connect WebDynpro (JAVA) to MDM7.1. But am unable to do so. I have a WD Frame in which i have a WD iView and the MDM iView. But i am unable to pass parameters from the WD iView to MDM Item Details iView.
Note:
1. I have deployed MDM JAVA API on NWDS
2. I have specified " * " as a parameter to pass from the URL in the Item Details iView.
Please help.
Every help that i have read talks about CE7.1 but not NW 7.0
-Alpana -
Deployment Issue with MDM Java API exposed as Webservice using EJBS
Hi Experts,
I am implementing MDM Java APIS in Stateless session bean.Exposed that bean as Webservice and using that webservice in
Webdynpro through Adaptive Webservice Model.
I am facing following issue:
Webservice works fine after deployment,after some number of execution webservice stops working and gives exception.After
Redeployment of the Webservice, it starts working again works fine some number of execution.
I am Using new MDMJava API.
MDM Server Details: MDM 5.5 SP06
I am using following code for connetion
//////////////*************Getting Connection************///////
ConnectionPool pool = null;
String sessionId = null;
try {
pool = ConnectionPoolFactory.getInstance("Server Ip");
} catch (ConnectionException e1) {
System.out.println(e1.getMessage());
//////////////*************Repository Session************///////
CreateRepositorySessionCommand repSeession =
new CreateRepositorySessionCommand(p_pool);
repSeession.setRepositoryIdentifier(p_repId);
try {
repSeession.execute();
} catch (CommandException e2) {
System.out.println(e2.getMessage().toString());
String repIID = repSeession.getRepositorySession();
// Authenticate Repository
AuthenticateRepositorySessionCommand autRepSeesion =
new AuthenticateRepositorySessionCommand(p_pool);
try {
autRepSeesion.setSession(repSeession.getRepositorySession());
autRepSeesion.setUserName(p_user);
autRepSeesion.setUserPassword(p_Password);
autRepSeesion.execute();
} catch (CommandException e3) {
System.out.println(
"RepSession Seesion" + e3.getMessage().toString());
return autRepSeesion.getSession();
//////////////*************user Session************///////
GetRepositoryRegionListCommand regionListCommand =
new GetRepositoryRegionListCommand(p_pool);
regionListCommand.setRepositoryIdentifier(p_repId);
try {
regionListCommand.execute();
} catch (CommandException e) {
System.out.println(e.getMessage().toString());
RegionProperties[] regions = regionListCommand.getRegions();
// create a user session
CreateUserSessionCommand UsersessionCommand =
new CreateUserSessionCommand(p_pool);
UsersessionCommand.setRepositoryIdentifier(p_repId);
UsersessionCommand.setDataRegion(regions[0]);
// use the first region
try {
UsersessionCommand.execute();
} catch (CommandException e) {
System.out.println("UserSession" + e.getMessage().toString());
String UsersessionId2 = UsersessionCommand.getUserSession();
AuthenticateUserSessionCommand authUserCommand =
new AuthenticateUserSessionCommand(p_pool);
authUserCommand.setSession(UsersessionCommand.getUserSession());
authUserCommand.setUserName(p_userId);
authUserCommand.setUserPassword(p_password);
try {
authUserCommand.execute();
} catch (CommandException e) {
System.out.println("User Seesion" + e.getMessage().toString());
return authUserCommand.getSession();
//////////////*************Destroy Session************///////
DestroySessionCommand destroySessionCommand =
new DestroySessionCommand(p_pool);
destroySessionCommand.setSession(p_repsession);
try {
destroySessionCommand.execute();
} catch (CommandException e) {
e.printStackTrace();
destroySessionCommand.setSession(p_Uesrsession);
try {
destroySessionCommand.execute();
} catch (CommandException e) {
e.printStackTrace();
Do we need to relase the connection pool object also?
Can anyone help me with the code how that can be achived?
Please Reply if anyone has come accross similar issue or know what can be the solution.
Thanks in Advance.
Regards Shruti
Edited by: Shruti Shah on Dec 18, 2008 12:52 PMHi Nitin,
Thanks for the prompt Response.
Even I am guessing that its becose of Connection pool.
I am destroying session as follows
DestroySessionCommand destroySessionCommand =
new DestroySessionCommand(p_pool);
destroySessionCommand.setSession(p_repsession);
try {
destroySessionCommand.execute();
} catch (CommandException e) {
e.printStackTrace();
destroySessionCommand.setSession(p_Uesrsession);
try {
destroySessionCommand.execute();
} catch (CommandException e) {
e.printStackTrace();
But I didnot find any method by which i can close realsse connection from connection pool.
It would be great if you can help me how close or realese those connection.In MDM Console i am able to see those sessions even after destroying them.
Regards Shruti.
Maybe you are looking for
-
Changing invite to another calendar requires follow up to accept again in the new calendar.
Here's the scenario... I have several calendars created in iCal. When I get an invite I will change the calendar to which I want it to apply. I'll hit accept and the invite will close. However, when I go to the relevant calendar, the invite does not
-
I am exporting a 1080p 24f 1hr 14min timeline that was in SD and using the Red Giant Instant HD plugin to up res it. Media Encoder is sitting at 17 seconds left to go for over an hour now and wont finish. It is still using CPU resources and memory bu
-
Hi! I'm trying to load dimensions by the OutlineLoad.bat to my planning app. Source import.csv file: Account, Parent, Alias: Default, Data Storage A1, Account, ,store A2, Account, ,store A3, Account, ,store A4, Account, ,store App name: Test Command
-
Automatic keyboard illumination
Hi, I've got a late 2011 macbook pro 13'' and seem to have a problem with the automatic keyboard illumination. When is set to automatic the backlight dims in low light conditions instead of brightening. I hold my finger in front of the light sensor a
-
I have a Mac Mini and wireless keyboard that have been terrific for about three years. My KB just stopped responding and I can't log on to diagnose the issue. When I turn the KB on, the green LED on the base of the KB lights up green then begins a pa