working with sap mdm java api’s - community archive...working with sap mdm java api’s . sap mdm...

19
Working with SAP MDM Java API’s Applies to: SAP MDM Java 2 API’s. For more information, visit the Master Data Management homepage . Summary This tutorial contains the Data Structure and Table Structure in the Java API’s point of View, and example of Searching, Creating, Modifying and Deleting Records in different tables using the SAP MDM Java API’s. Author: Priyadharsini Dhamodaran Company: Tata Consultancy Services Ltd. Created on: 23 July 2008 Author Bio Priya is working in TCS (Tata Consultancy Services) as a SAP MDM Consultant. Skill set includes SAP MDM especially the Java API’s and i2 MDM. SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 1

Upload: others

Post on 11-Apr-2020

42 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

Applies to: SAP MDM Java 2 API’s. For more information, visit the Master Data Management homepage.

Summary This tutorial contains the Data Structure and Table Structure in the Java API’s point of View, and example of Searching, Creating, Modifying and Deleting Records in different tables using the SAP MDM Java API’s.

Author: Priyadharsini Dhamodaran

Company: Tata Consultancy Services Ltd.

Created on: 23 July 2008

Author Bio Priya is working in TCS (Tata Consultancy Services) as a SAP MDM Consultant. Skill set includes SAP MDM especially the Java API’s and i2 MDM.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 1

Page 2: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

Table of Contents Acknowledgement ..............................................................................................................................................3 SAP MDM ...........................................................................................................................................................3

SAP NetWeaver ..............................................................................................................................................3 SAP NetWeaver Master Data Management ...................................................................................................3

SAP MDM Architecture.......................................................................................................................................5 Table Structure at the Backend ..........................................................................................................................5 Data Structure at the Backend ...........................................................................................................................6 Working with the API’s........................................................................................................................................6

Connection and Authentication .......................................................................................................................6 Properties........................................................................................................................................................8 Search...........................................................................................................................................................10 Create............................................................................................................................................................13 Modify............................................................................................................................................................15 Delete............................................................................................................................................................16

Related Content................................................................................................................................................18 Disclaimer and Liability Notice..........................................................................................................................19

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 2

Page 3: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

Acknowledgement I would like to express my gratitude to all those who helped to learn SAP MDM, and improve my skills on it. I would like to express my sincere thanks to Venkataraman Subramanian, Senior SAP MDM Consultant and SAP MDM Specialist in Tata Consultancy Services and Ronak Gajjar SAP MDM Specialist in Tata Consultancy Services, whose help, stimulating suggestions and encouragement, helped me in all the time of the learning process and developing the SAP MDM skills.

SAP MDM SAP has supplemented its Net Weaver package with MDM, which can manage master data from any mySAP Business Suite product.

SAP's MDM software has three main components: content consolidation for organizing data, master data harmonization for cleansing data and central master data management for a single enterprise repository for master

information.

SAP NetWeaver SAP NetWeaver is a web-based, open integration and application platform that serves as the foundation for enterprise service-oriented architecture (enterprise SOA) and allows the integration and alignment of people, information, and business processes across business and technology boundaries. It utilizes open standards to enable integration with information and applications from almost any source or technology. SAP NetWeaver is the foundation of SAP xApps and SAP Business Suite solutions, and also powers partner solutions and customer custom-built applications

SAP NetWeaver Master Data Management With SAP NetWeaver Master Data Management (SAP NetWeaver MDM), organizations can provide a single version of the truth for customer, product, employee, supplier, or user-defined data object. SAP NetWeaver MDM integrates with SAP and non-SAP systems, enabling the same data to be consolidated and harmonized, and available to multiple systems. It supports the following functionality:

• Master data consolidation: SAP NetWeaver MDM consolidates and cleanses master data objects from disparate systems and stores the data in a centralized repository.

• Synchronization and distribution of master data: Using global attributes, you can ensure that all systems receive the same master data during distribution, and enrich the distributed data objects with additional attribute values in the target systems.

• Centralized management of master data: SAP NetWeaver MDM supports company-wide quality standards by ensuring that central control of master data begins as soon as the data is created.

• Administration of master data: A powerful interface supports administrative tasks such as data exception-handling and assignment of role-based access to business processes and information.

• Management of internal content: SAP NetWeaver MDM collects and centralizes all your content, including parametric information and rich content such as images, paragraphs of text, PDF documents, and organizational intelligence about content, in an enterprise-wide repository.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 3

Page 4: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

• Catalog search: Intuitive interfaces help you locate items internally, publish Web catalogs on e-commerce storefronts and in supplier-enablement programs, and integrate easy-to-search catalogs into e-procurement solutions — all from a centralized repository and all at speeds surpassing normal SQL-based queries.

• Print catalog customization: SAP NetWeaver MDM disseminates product information directly from a centralized catalog repository to desktop-publishing programs and automatically generates fully formatted and populated page layouts.

• Multichannel syndication of product catalog content: It publishes restructured and reformatted extracts or incremental updates of your product catalog content — and distributes them to trading partners in several delimited text and XML formats — on either a regular or an unscheduled basis.

• Business-process support: SAP NetWeaver MDM handles communications in a heterogeneous environment and inserts master data into other systems.

• Business analytics and reporting: It uses synchronized data for reliable analysis and accurate reporting.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 4

Page 5: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

SAP MDM Architecture

Table Structure at the Backend

The above Diagram shows, how the Tables are linked in SAP MDM at the backend:

Table Properties – contains Table ID, Table Name, Table Code and other properties. All the Table’s are referred through Table ID while using java API, so, irrespective of user entered, Table Code or Table Name, it is mandatory to retrieve the Table Id, to make any operation on it.

Field Properties – contains Field Id, Field Code, Field Name, Field Type and other Properties. All the Field’s are referred through Field Id.

Lookup Field Properties – contains Lookup Table Id. Attribute Properties – contains Attribute Id, Attribute Type and other Properties.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 5

Page 6: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

Data Structure at the Backend

Working with the API’s

Connection and Authentication

To execute any command a connection accessory and a session is required.

Steps for creating an connection and authentication are:

Create a Connection and Set the Repository Identifier:

// Setting a connection ConnectionPool connections = null; connections = ConnectionPoolFactory.getInstance(serverName); // Getting the repository Id RepositoryIdentifier reposId = new RepositoryIdentifier(repositoryName,dbmsName, DBMSType.ORACLE); // Fetch regions from repository GetRepositoryRegionListCommand regionList = new GetRepositoryRegionListCommand(connections); regionList.setRepositoryIdentifier(reposId); try { regionList.execute(); } catch (CommandException e) { e.printStackTrace();

}

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 6

Page 7: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

Create a User Session

// Creating a User session CreateUserSessionCommand sessionCommand = new CreateUserSessionCommand(connections); sessionCommand.setRepositoryIdentifier(reposId); sessionCommand.setDataRegion(regions[0]); try { sessionCommand.execute(); } catch (CommandException e) { e.printStackTrace(); } // Fetch the session Id String sessionId = sessionCommand.getUserSession();

Authenticate the User

// Authenticate the User AuthenticateUserSessionCommand authCommand = new AuthenticateUserSessionCommand(connections); authCommand.setSession(sessionId); authCommand.setUserName(userName); authCommand.setUserPassword(userPassword); try { authCommand.execute(); } catch (CommandException e) { e.printStackTrace(); }

Destroy a User Session

// Destroy a User session

DestroySessionCommand destroySessionCommand = new DestroySessionCommand(connections);

destroySessionCommand.setSession(sessionId);

try

{

destroySessionCommand.execute();

}

catch (CommandException e)

{

e.printStackTrace();

}

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 7

Page 8: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

Properties

Retrieving Different Id’s:

Table Properties

// Get the list of tables present in the schema. Inputs -- Connection Parameter and Session Id. GetTableListCommand tableListCommand = new GetTableListCommand(connections); tableListCommand.setSession(sessionId); try { tableListCommand.execute(); } catch (CommandException e) { e.printStackTrace(); } // List of Tables are stored in the tables array of type Table Properties TableProperties[] tables = tableListCommand.getTables(); // From the List of Tables, we can find out the table the we require, either using the Table Code or Table Name or Table Id or Table Type. The selected Table Properties contains the Table ID, which will be used by other classes, to refer the selected table.

Field Properties

// Getting the Field Properties of all the fields for a given table. Inputs -- session id and table id. GetFieldListCommand getFieldListCommand = new GetFieldListCommand(connections); getFieldListCommand.setSession(sessionId); getFieldListCommand.setTableId(tableName.getId()); try { getFieldListCommand.execute(); } catch (CommandException e) { e.printStackTrace(); } // Assigning all the fields in an array of type Field Properties. FieldProperties[] fields = getFieldListCommand.getFields(); // From the List of Fields, we can find out the field the we require, either using the Field Code or Field Name or Field Id or Field Type. The selected Field Properties contains the Field ID, which will be used by other classes, to refer the selected field.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 8

Page 9: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

Lookup Field Properties

// Retrieve Lookup Field Properties, when Field Properties is given as input.

LookupFieldProperties lookupFieldSer = (LookupFieldProperties) fieldProp;

// The Lookup Field Properties contains the Lookup Table Id (i.e. the Table id, of the Lookup table, to which this Lookup field is mapped).

Attribute Properties

// To retrieve the List of Attribute Properties for a given Taxonomy table. Inputs -- session id and taxonomy table id. RetrieveAttributesCommand attProp = new RetrieveAttributesCommand(connections); attProp.setSession(sessionId); attProp.setTaxonomyTableId(taxonomyTabProp.getId()); try { attProp.execute(); } catch (CommandException e1) { e1.printStackTrace(); } // Assigning all the attributes in an array of type Attribute Properties. AttributeProperties[] attributes = attProp.getAttributes(); // From the List of Attributes, we can find out the attribute that we require, either using the Attribute Code or Attribute Name or Attribute Id. The selected Attribute Properties contains the Attribute ID, which will be used by other classes, to refer the selected Attribute. // To Retrieve a Single Attribute Property, when the Attribute Id, Taxonomy Table Id and session Id is given as input. RetrieveAttributeCommand attProp = new RetrieveAttributeCommand(connections); attProp.setSession(sessionId); attProp.setTaxonomyTableId(taxonomyTabProp.getId()); attProp.setAttributeId(attId); try { attProp.execute(); } catch (CommandException e1) { e1.printStackTrace(); } // Assigning the attribute to a variable of type Attribute Properties. AttributeProperties finalAttName = attProp.getAttribute();

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 9

Page 10: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

// The selected Attribute Properties contains the Attribute ID, which will be used by other classes, to refer the selected Attribute.

Search

Creating Search Parameters for different Field Types:

Numeric Field Type

// Create a Field Search Dimension for the entered field. Field Id is given as input FieldSearchDimension fsdMaintableType = new FieldSearchDimension(FieldId); // Create a Numeric Search Constraint for the entered numeric value. GREATER_THAN or LESS_THAN or NOT_EQUAL etc can also be used instead of EQUAL. NumericSearchConstraint tscTypeRoot = new NumericSearchConstraint(serFieldValue, NumericSearchConstraint.EQUALS); // Creating a Search Parameter , Table on which search is made is given as imput. Search seSearchMainRoot = new Search(serTableId); // Add the parameters to the search seSearchMainRoot.addSearchItem(fsdMaintableType, tscTypeRoot);

Text Field Type

// Create a Field Search Dimension for the entered field. Field Id is given as input FieldSearchDimension fsdMaintableType = new FieldSearchDimension(FieldId); // Create a Text Search Constraint for the entered String value. STARTS_WITH or ENDS_WITH etc can also be used instead of CONTAINS.

.

TextSearchConstraint tscTypeRoot = new TextSearchConstraint(serFieldValue, TextSearchConstraint.CONTAINS); // Creating a Search Parameter, Table on which search is made is given as input. Search seSearchMainRoot = new Search(serTableId); // Add the parameters to the search seSearchMainRoot.addSearchItem(fsdMaintableType, tscTypeRoot);

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 10

Page 11: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

Lookup Field Type

// Array of MDM Values for Search. The array contains the Record Id of the Lookup Value. MdmValue[] lookupSerValues = {new LookupValue(RecordId1), new LookupValue(RecordId2)}; // Create a Pick List Search Constraint for the entered values. PickListSearchConstraint tscMainTypeRoot = new PickListSearchConstraint(lookupSerValues); // When Multiple Values are present in the array, an AND condition is added to the Search Constrain. tscMainTypeRoot.setAndMultivaluedSearch(true); // Create a Field Search Dimension for the entered field FieldSearchDimension fsdMaintableType = new FieldSearchDimension(FieldId); // Creating a Search Parameter, Table on which search is made is given as input. Search seSearchMainRoot = new Search(serTableId); // Add the parameters to the search seSearchMainRoot.addSearchItem(fsdMaintableType, tscTypeRoot);.

Taxonomy Field Type

// Create a Attribute Search Dimension for the entered field. Taxonomy Field Id and Attribute Field Id is given as input.

AttributeSearchDimension attLookupType =

new AttributeSearchDimension(serFieldName.getId(), serAttName.getId());

// Array of MDM Values for Search. The array contains the Value Id of the Attribute Value.

MdmValue[] lookupSerValues =

{new TextAttributeValue (attValueId), new TextAttributeValue (attValueId)};

// Create a Pick List Search Constraint for the entered values.

PickListSearchConstraint tscMainTypeRoot = new PickListSearchConstraint(lookupSerValues);

// Creating a Search Parameter, Table on which search is made is given as input.

Search seSearchMainRoot = new Search(serTableId);

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 11

Page 12: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

// Add the parameters to the search

seSearchMainRoot.addSearchItem(attLookupType, tscMainTypeRoot);

Retrieving Records from the Server:

Define the Result Definition

// Result Definition contains all the Field Id’s for this the Records will be retrieved. // Defining the Result Set , using the Table Id. ResultDefinition rdMain = new ResultDefinition(TableId); // Adding the Field Id to the Result Set, for which the values should be retrieved. rdMain.addSelectField(FieldId); // Result Set for Lookup Table. ResultDefinition rdlookup = new ResultDefinition(LookupTableId); // Adding the Lookup Field Id, to the Lookup Result Set. rdlookup.addSelectField(new FieldId(fieldlookupProp[h].getId())); // Defining the Result set array for the Lookup Tables. ResultDefinition[] lookupValues ={ rdlookup }; //To Load the attribute Values. rdMain.setLoadAttributes(true);

Retrieve Data

// Retrieve records from the server. Inputs are Connection Pool, Session Id, Search Parameter, Result Definition and Lookup Table Result Defintion(Optional). RetrieveLimitedRecordsCommand recordsCommand = new RetrieveLimitedRecordsCommand(connections); recordsCommand.setSession(sessionId); recordsCommand.setSearch(ssearch); recordsCommand.setResultDefinition(rdSet); recordsCommand.setSupportingResultDefinitions(rdlookupSet); try { recordsCommand.execute(); } catch (CommandException e1) { e1.printStackTrace(); } //Array of Records Retrieved. Record[] recs = recordsCommand.getRecords().getRecords();

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 12

Page 13: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

Create

Create Records:

// Create an empty Record, for the table in which the new record should be added. Input is Table Id.

Record newRec = RecordFactory.createEmptyRecord(TableId);

// To Add a Text Value. Inputs are Field Id and Field Value.

newRec.setFieldValue(FieldId, new StringValue(entValues));

// To Add a Integer Value. Inputs are Field Id and Field Value.

newRec.setFieldValue(FieldId, new IntegerValue (entValues));

// To Add a Date Time Value. Inputs are Field Id and Field Value.

newRec.setFieldValue(FieldId, new DateTimeValue (entValues));

// To Add a Double Value. Inputs are Field Id and Field Value.

newRec.setFieldValue(FieldId, new DoubleValue (entValues));

// To Add a Lookup Value. Inputs are Field Id and Lookup Record Id.

newRec.setFieldValue(FieldId, new LookupValue (LookupRecordId));

//Array of MDM Values

MdmValue[] = { new StringValue(entValues1), new StringValue(entValues2)}

// To Add Multi Value. Inputs are Taxonomy Field Id and Attribute Id and Attribute Value Id.

newRec.setFieldValue(FieldId, new MultiValue (MdmValue[]);

// To Add Attribute Value. Inputs are Field Id and Mdm Value.

newRec.setAttributeValue(TaxonomyFieldId,AttributeId, new TextAttributeValue (attValueId);

// Create the Record . Inputs are Connection Pool, Session Id, created Record with values.

CreateRecordCommand crRec = new CreateRecordCommand(connections);

crRec.setSession(sessionId);

crRec.setRecord(getRecValue);

try

{

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 13

Page 14: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

crRec.execute();

}

catch (CommandException e)

{

e.printStackTrace();

return;

}

Create Text Attributes:

// Create Attribute Properties Inputs, Taxonomy Table Id, Attribute Name and Attribute Alias Name. TextAttributeProperties textAttribute = new TextAttributeProperties(); textAttribute.setTableId(taxTableId); // Attribute Name. MultilingualString attributeName = new MultilingualString(); attributeName.set(regProp.getRegionCode(),attName); // Attribute Alias Name. MultilingualString attributeAliasName = new MultilingualString(); attributeAliasName.set(regProp.getRegionCode(),attAliasName); // Add to Attribute Properties. textAttribute.setName(attributeName); textAttribute.setAlias(attributeAliasName); // Create an Attribute. Inputs are Connection Pool, Session Id and Attribute Properties. CreateAttributeCommand createatt = new CreateAttributeCommand(connections); createatt.setSession(sessionId); createatt.setAttribute(attribute); try { createatt.execute(); } catch (CommandException e) { e.printStackTrace(); }

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 14

Page 15: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

Modify

Modify Records:

// Create an empty Record, for the record that should be modified. Inputs are Table Id and Record Id. Record newRec = RecordFactory.createEmptyRecord(TableId,RecordId); // To Add a Text Value. Inputs are Field Id and Field Value. newRec.setFieldValue(FieldId, new StringValue(entValues)); // To Add a Integer Value. Inputs are Field Id and Field Value. newRec.setFieldValue(FieldId, new IntegerValue (entValues)); // To Add a Date Time Value. Inputs are Field Id and Field Value. newRec.setFieldValue(FieldId, new DateTimeValue (entValues)); // To Add a Double Value. Inputs are Field Id and Field Value. newRec.setFieldValue(FieldId, new DoubleValue (entValues)); // To Add a Lookup Value. Inputs are Field Id and Lookup Record Id. newRec.setFieldValue(FieldId, new LookupValue (LookupRecordId)); //Array of MDM Values MdmValue[] = { new StringValue(entValues1), new StringValue(entValues2)} // To Add Multi Value. Inputs are Taxonomy Field Id and Attribute Id and Attribute Value Id. newRec.setFieldValue(FieldId, new MultiValue (MdmValue[]); // To Add Attribute Value. Inputs are Field Id and Mdm Value. newRec.setAttributeValue(TaxonomyFieldId,AttributeId, new TextAttributeValue (attValueId); // Modify the Record . Inputs are Connection Pool, Session Id, created Record with values. ModifyRecordCommand modRec = new ModifyRecordCommand (connections); modRec.setSession(sessionId); modRec.setRecord(getRecValue); try { modRec.execute(); } catch (CommandException e) { e.printStackTrace(); } Modify Text Attributes: // Create Attribute Properties Inputs are Attribute Id, Taxonomy Table Id, Attribute Name and Attribute Alias Name. TextAttributeProperties textAttribute = new TextAttributeProperties(AttributeId); textAttribute.setTableId(taxTableId);

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 15

Page 16: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

// Attribute Name. MultilingualString attributeName = new MultilingualString(); attributeName.set(regProp.getRegionCode(),attName); // Attribute Alias Name. MultilingualString attributeAliasName = new MultilingualString(); attributeAliasName.set(regProp.getRegionCode(),attAliasName); // Add to Attribute Properties. textAttribute.setName(attributeName); textAttribute.setAlias(attributeAliasName); // Create an Attribute. Inputs are Connection Pool, Session Id and Attribute Properties. ModifyAttributeCommand modAtt = new ModifyAttributeCommand (connections); modAtt.setSession(sessionId); modAtt.setAttribute(attributeProperties); try { modAtt.execute(); } catch (CommandException e) { e.printStackTrace(); }

Delete

Delete Records:

// Delete the Record. Inputs are Connection Pool, Session Id, Table Id and Record Id. DeleteRecordsCommand delRec = new DeleteRecordsCommand(connections); delRec.setSession(sessionId); delRec.setTable(TableId); delRec.setDeleteAnyway(true); delRec.addRecord(RecordId); try { delRec.execute(); } catch (CommandException e1) { e1.printStackTrace(); return; }

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 16

Page 17: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

Delete Text Attributes:

// Delete an Attribute. Inputs are Connection Pool, Session Id, Attribute Id and Taxonomy Table Id. DeleteAttributeCommand delAtt = new DeleteAttributeCommand(connections); delAtt.setSession(sessionId); delAtt.setAttributeId(attribute.getId()); delAtt.setTaxonomyTableId(attribute.getTableId()); try { delAtt.execute(); } catch (CommandException e) { e.printStackTrace(); }

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 17

Page 18: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

Related Content http://help.sap.com/javadocs/MDM/SP05

For more information, visit the Master Data Management homepage.

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 18

Page 19: Working with SAP MDM Java API’s - Community Archive...Working with SAP MDM Java API’s . SAP MDM Architecture . Table Structure at the Backend . The above Diagram shows, how the

Working with SAP MDM Java API’s

SAP DEVELOPER NETWORK | sdn.sap.com BUSINESS PROCESS EXPERT COMMUNITY | bpx.sap.com © 2008 SAP AG 19

Disclaimer and Liability Notice This document may discuss sample coding or other information that does not include SAP official interfaces and therefore is not supported by SAP. Changes made based on this information are not supported and can be overwritten during an upgrade.

SAP will not be held liable for any damages caused by using or misusing the information, code or methods suggested in this document, and anyone using these methods does so at his/her own risk.

SAP offers no guarantees and assumes no responsibility or liability of any type with respect to the content of this technical article or code sample, including any liability resulting from incompatibility between the content within this document and the materials and services offered by SAP. You agree that you will not hold, or seek to hold, SAP responsible or liable with respect to the content of this document.