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,
Niraj

Hi 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

Similar Messages

  • How to create relationShip between two resources??

    Hi,
    Is there any manual process on workbench to create relationShip between two resources like repositoryClient.createRelationship() API does.
    Regards
    Sunil

    Hi 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

  • How to get relationship between two  views in the  reports

    How to get relationship between two  views in the  reports, I am doing a deletion program , it is fully relates to views , how to get relationship between them in the reports

    Hi,
    Please explain your question in detail...what do you want to read ?
    If you want to know about the navigation links between the views then you can use APIs  like
    wdComponentAPI.getComponentInfo().findInWindows("windowName").getViewUsageByID("Name").getNavigationLinks();
    Iterate through the navigationLinkInfo from above collection and can read the other properties .
    I haven't tried the above , but it should work !!!
    Regards,Anilkumar

  • How to create Trust between two domain

    How to create Trust between two domain:
    please help

    Hi,
    By default, two-way, transitive trusts are automatically created when a new domain is added to a domain tree or forest root domain using the Active Directory Installation
    Wizard. The two default trust types are defined in the following table. However there have others many types of the AD trust, please refer the following KB to determine which type you need:
    Trust types
    http://technet.microsoft.com/en-us/library/cc775736%28v=ws.10%29.aspx
    More relate KB:
    Creating Domain and Forest Trusts
    http://technet.microsoft.com/en-us/library/cc740018(WS.10).aspx
    The related third party article:
    How to configure Forest Level Trust in Windows Server
    http://blogs.interfacett.com/how-to-configure-forest-level-trust-in-windows-server
    *** This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control
    these sites and has not tested any software or information found on these sites; therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the
    use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet. ***
    Hope this helps.
    We
    are trying to better understand customer views on social support experience, so your participation in this
    interview project would be greatly appreciated if you have time.
    Thanks for helping make community forums a great place.

  • 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.
    Thanks

    Jun,
    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 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
    Vallabhaneni

    Hi,
    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

  • 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

  • How to give relationship between two tables with comon column with between oprator

    Hi Folks,
    I am using Sql Server 2008R2. I am getting a problem to establish relationship between two tables. 
    I have two Tables, 1.Inventory Details Table another one is Inventory Header Table.
    Inventory Details Table having a column Card No and inventory Header Table having columns  From card No and To Card No.
    I want to give relationship between these two tables with Card no. Could you please provide me the Sql Query.
    Your help would be greatly appreciated .
    Regards
    hasthi.
    email:[email protected]

    Hi Raju,
     We have two way that we can relate to the table either join or quality condition use following syntax/Query  for relating two tables 
    select * from Inventory_Details ID inner join  Inventory_Header IH on ID.CardNo between IH.FrmCardno and IH.ToCardNo
    or 
    Select * from  Inventory_Details ID ,Inventory_Header IH where ID.CardNo=IH.CardNo OrSelect * from  Inventory_Details ID ,Inventory_Header IH where ID.CardNo between IH.FrmCardno and IH.ToCardNo
    Hope this will help you 
    Niraj Sevalkar

  • Subject: How to do join between two tables using something like SE16

    SE16, SE11 provide form based interface query information from a single table. Is there a way to do join between two tables without creating an infoset erc? I am looking for something similar to sql join but in SAP BI 7.0
    Thanks.

    Hi
    Pls look into below links. Hope this helps you.
    1. http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb45bf455611d189710000e8322d00/content.htm
    2. http://help.sap.com/saphelp_46c/helpdata/EN/d2/cb45a5455611d189710000e8322d00/content.htm
    Regards
    Sirigiri

  • 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
    Suresh

    Hello 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

  • How do I create links between two pdfs using FrameMaker 9, while both files remain open?

    In FrameMaker 9 is there a way to create cross reference to a particular page on another doc (without closing the current/source doc)?
    I tried using "openpage filename:pagenumber" option, the link takes me to page 1 of the referenced doc not to the specified page, and as it is a hyper link when page 1 of the referenced doc gets displayed the souce doc closes.
    When a link is clicked in the source doc, it is required that the source doc remians open.
    This is an urgent requirement, can anyone please reply soon?

    I think you've already asked this in this thread - http://forums.adobe.com/message/5613200#5613200 - and it's been answered there.

  • How to create IT0128 subtype-02 record using HR_INFOTYPE_OPERATION

    Hi All,
    Can anyone suggest how to use HR_INFOTYPE_OPERATION to create/insert a record in IT0128 for an employee from an ABAP program.
    Some background:::
    Note that the field - "Short Title" which is mandatory in this Infotype. And it uses a Q-structure for its processing. Also it stores this field using a combination of text object, text id, language and text name.
             Text object = HRMESS
             Text id  =  HR_P
    Goto SE16 of an employee and check PA0128, you will notice above fields. The actual value is stored somewhere in system memory using a combination of above 4 fields.
    When i try using my program, it gives me an error "Make an entry in all required fields" (so not able to find how/what should i pass for field "Short Title").  Can anyone suggest how should i use HR_INFOTYPE_OPERATION to create an IT0128 record for subtype 02.
    Appreciate any help asap!!
    Best Regards,
    Abbasi Sadikot
    PS: Please dont post your reply if you dont have any idea of what this is.

    Hi
    HR_INFOTYPE_OPERATION -> calls -> HR_MAINTAIN_MASTERDATA -> this Func. Mod. then creates a batch and calls ->
    -> IF DIALOG_MODE EQ '0'.
    ->    CALL DIALOG 'HR_MAINTAIN_MASTER_DATA' USING BDCDATA MODE 'N'
    ->         EXPORTING
    the SY-SUBRC value after this should be zero. But it isn't. Can anybody suggest something. Or have any idea as what could be going wrong ??
    Here is my program by which i am trying to create IT0128 subtype-02:
    REPORT  ZABTWTEST                                 .
    data: it0128 like p0128 occurs 0 with header line.
    data: return like BAPIRETURN1.
    it0128-pernr = '20123001'.
    it0128-subty = '2'.
    it0128-begda = '20090101'.
    it0128-endda = '20090131'.
    it0128-SPRSL = 'EN'.
    it0128-OBJCT = 'HRMESS'.
    it0128-TXTID = 'HR_P'.
    it0128-OBNAM = '<internally assigned name>'.
    append it0128.
    CALL FUNCTION 'BAPI_EMPLOYEET_ENQUEUE'
      EXPORTING
        number              = '20123001'
        validitybegin       = '19000101'   .
    loop at it0128.
    CALL FUNCTION 'HR_INFOTYPE_OPERATION'
      EXPORTING
        infty                  = '0128'
        number                 = '20123001'
        VALIDITYEND            = it0128-endda
        VALIDITYBEGIN          = it0128-begda
        record                 = it0128
        operation              = 'COP'
        TCLAS                  = 'A'
        NOCOMMIT               = 'X'
      IMPORTING
        RETURN                 = return   .
    endloop.
    CALL FUNCTION 'BAPI_EMPLOYEET_DEQUEUE'
      EXPORTING
        number              = '20123001'
        validitybegin       = '19000101'   .
    write return.   .
    Kindly correct me if i am wrong anywhere.
    Regards,
    Abbasi

  • 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 PM

    Hi 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

  • How to read "Customixed Information" in UME using WebDynpro Java APIs

    Dear All
    In our Portal UME we have defined 3 custom fields that appear in the "Customized Information"
    tab in the standard Portal "Identity Mangagement" application ie:
    krb5principalname :
    How can I retrieve the custom fields and values using WebDynpro APIs?
    I have the following basic code to retrieve the standard user session information, but
    do not know how to extend it to extract the values of the custom fields.
    Full points will be awarded to whoever answers question with suggestion that works.
    Many thanks in advance
    Mike

    Hi Mike,
    Following code is for just one custom attribute <custom attribute>
                                  String namespaces[] = umeUser.getAttributeNamespaces();
                                  String ns = null;
                                  for (int i = 0; i < namespaces.length; i++) {
                                       if (i > 0)
                                            ns = namespaces[ i ];
                                       String attrNames[] = umeUser.getAttributeNames(ns);
                                       if (ns != null){                                   
                                   if(ns.equals("<name-space>")){     
                                       for (int j = 0; j < attrNames.length; j++) {
                                            if(attrNames[j].equals("<custom attribute>")){                                        
                                                 Object attr[] = umeUser.getAttribute(ns, attrNames[j]);
                                                 for (int k = 0; k < attr.length; k++){
                                                      if(!(null == attr[k])|| !(attr[k].toString().length() == 0)){                                                  
                                                           //attr[k].toString() has the custom attribute value
                                                      break;
                                            }else
                                                 continue;               
                                   }else
                                       continue;
    Where <name-space> is the same value you set in config tool or on portal UME configuration.
    Config Tool: Global Service Configuration>services->com.sap.security.core.ume.service>ume.virtual_groups.user_attribute.namespace
    Portal
    System Administration>System Configuration>UME configuration> User Admin UI tab>
    Custom attributes of the user profile
    Administrator-Managed Custom Attributes: add ;<name-space>:<custom-attribute>
    Hope this helps

Maybe you are looking for