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
thanks

You 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

Similar Messages

  • Image not displayed in pdf generated using Java API for Forms service

    Hi,
    I am creating a pdf document using Java API for Forms Service.
    I am able to generate the pdf but the images are not visible in the generated pdf.
    The image relative path is coming in the xml as defined below. The images are stored dynamically in the Livecycle repository each time a request is fired with unique name before the xml is generated.
    <imageURI xfa:contentType="image/png" href="../Images/logo.png"></imageURI>
    Not sure if I need to specify specify specific URI values that are required to render a form with image.
    The same thing is working when I generate pdf document using Java API for Output Service.
    As, I need to generate interactive form, I have to use Forms service to generate pdfs.
    Any help will be highly appreciated.
    Thanks.

    Below is the code snippet:
                //Create a FormsServiceClient object
                FormsServiceClient formsClient = new FormsServiceClient(myFactory);
                //Specify URI values that are required to render a form
                URLSpec uriValues = new URLSpec();
                                  // Template location contains the whole rpository path for the form
                uriValues.setContentRootURI(templateLocation);
               // The base URL where form resources such as images and scripts are located.  Whole Image path is passed in BaseUrl in the http format.
                      String baseLocation = repositoryPath.concat(serviceName).concat(imagesPath);   
                                  uriValues.setBaseURL(baseLocation);                                        
                // Set run-time options using a PDFFormRenderSpec instance
                PDFFormRenderSpec pdfFormRenderSpec = new PDFFormRenderSpec();
                pdfFormRenderSpec.setCacheEnabled(new Boolean(true));           
                pdfFormRenderSpec.setAcrobatVersion(com.adobe.livecycle.formsservice.client.AcrobatVersio n.Acrobat_8);
                                  //Invoke the renderPDFForm method and write the
                //results to a client web browser
                String tempTemplateName =templateName;
                FormsResult formOut = formsClient.renderPDFForm(tempTemplateName,
                                              inXMDataTransformed,pdfFormRenderSpec,uriValues,null);
                //Create a Document object that stores form data
                Document outputDocument = formOut.getOutputContent();
                InputStream inputStream = outputDocument.getInputStream();

  • How to send records to the MDM workflow using Java APIs

    Hi All,
        Using Java APIs i want to send group/single records to the backend MDM workflows for further processing. Can this be acheived? Please provide me with some code samples if you have any
    Regards
    Suresh

    Hi,
    Just go through this URL
    https://help.sap.com/javadocs/MDM/current/index.html
    In this <b>com.sap.mdm.workflow.commands </b> will Provide u commands for managing workflows.
    I hope this helps you.
    Regards
    Nisha
    Message was edited by:
            Nisha Lalwani

  • Image resize : loss of quality by using Java API. What's wrong ?

    We actually have a problem with the resizing of pictures.
    We use jdk 1.4.2.
    We are trying to transform some picture from approx. 2000*1600 to 500*400.
    The result is poor (loss of colors, blur ...)
    We use an affineTransform and some renderingHints.
    There is actually no effect when we change the renderingHints parameters. Why ?
    Here's the code we use:
    import java.awt.geom.AffineTransform;
    import java.awt.image.*;
    import java.io.*;
    import javax.imageio.ImageIO;
    import java.awt.*;
    import javax.swing.*;
    public class Jpeg
        public Jpeg()
        // i  = la largeur de l'image redimensionner
        // s  = le chemin d'acces � l'image original
        // s1 = le chemin d'acces � l'image retaill�e
        public boolean resize(int i, String s, String s1)
           try
                File file  = new File(s);
                File file1 = new File(s1);
                //Parametrage de la lecture
                ImageIO.setUseCache (true);
                BufferedImage src = ImageIO.read(file);
                double d  = src.getWidth();
                double d1 = src.getHeight();
                double d2 = i;
                double d3 = d2 / d;
                if(d1 * d3 > d2)
                    d3 = d2 / d1;
                if(d3 > 0.8D)
                    d3 = 1.0D;
                int j = (int)(d * d3);
                int k = (int)(d1 * d3);
             AffineTransform  tx = new AffineTransform ();
                tx.scale (d3, d3);
                RenderingHints  rh = new RenderingHints (RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
                rh.put (RenderingHints.KEY_ALPHA_INTERPOLATION, RenderingHints.VALUE_ALPHA_INTERPOLATION_QUALITY);
                rh.put (RenderingHints.KEY_COLOR_RENDERING, RenderingHints.VALUE_COLOR_RENDER_QUALITY);
                rh.put (RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BICUBIC);
                rh.put (RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY);
                rh.put (RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
                rh.put (RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
                AffineTransformOp  op    = new AffineTransformOp (tx, rh);
                BufferedImage      biNew = new BufferedImage (j, k, src.getType ());
                op.filter(src, biNew);
                ImageIO.write (biNew, "jpg", new File (s1));
            catch (Exception  e)
                e.printStackTrace ();
                return  false;
            return  true;
        public static void main(String args[])
            Jpeg jpeg = new Jpeg();
            jpeg.resize (Integer.parseInt (args [0]), args[1], args[2]);
    }Here's the original picture http://193.252.12.20/bugimage/14457.jpg
    Here's the resized picture http://193.252.12.20/bugimage/bur.jpg
    Here's the paintshop pro resized picture http://193.252.12.20/bugimage/psp.jpg
    Is there another way to resize pictures ?
    Can we have a better result by using jdk 1.5.0 ?
    Thanks for your help.

    Nothing wrong - it's a feature :).
    "Loss of colours" is connected with Java embedded JPEG decoder. If you transcode to for example PNG format using any image processing program and then resize using Java then colors will be OK.
    "Blur..." is connected with bad implementation of interpolation algorithms in JDK/JRE and can't be fixed :)
    I'm close to finish developing own resizing library which produced the next results from your image (it's a very good image to test). "from_png" means that the source image is PNG.
    <b>Box interpolation</b> (also known as nearest neighbour, but it's the honest implementation, not JDK fake):
    http://www.chainline.com/Box.jpg
    http://www.chainline.com/Box_from_png.jpg
    Well-known <b>Lanczos 3</b>:
    http://www.chainline.com/Lanczos_3.jpg
    http://www.chainline.com/Lanczos_3_from_png.jpg
    Not-well-known <b>Ideal 5S</b> but one of the most qualified:
    http://www.chainline.com/Ideal_5S.jpg
    http://www.chainline.com/Ideal_5S_from_png.jpg
    And 2 interesting s.c. "sharp" filters which make the result sharpen:
    <b>Sharp Light 5</b>:
    http://www.chainline.com/Sharp_Light_5.jpg
    http://www.chainline.com/Sharp_Light_5_from_png.jpg
    <b>Sharp 5</b>:
    http://www.chainline.com/Sharp_5.jpg
    http://www.chainline.com/Sharp_5_from_png.jpg

  • Adding Record in a MDM table using Java APIs

    While inserting records in a table, we have to make sure that if there is any field of type lookup, particular value entered is either present in the lookuptable or we insert in the lookup table.
    two questions/clarifications
    1.     if there are more than one lookup tables, we have to do the same thing for all the tables????
    2.    to insert in the lookup tables, i have to find the record ID of the particular entry in the lookup table and then use the recordid to enter value in the main table. Is it correct??
    Thanks and Regards
    Nitin Mahajan
    Edited by: Nitin Mahajan on May 14, 2008 12:34 PM
    Edited by: Nitin Mahajan on May 14, 2008 12:36 PM

    Hi Nitin,
    You will need to have the value present in the lookup table and then take the record id of that entry from the lookup table to make an entry in the main table record (for all the fields in the main table which are of type lookup).
    Sample code: This code is from MDM 5.5 sp4.
    A2iFields Fields = new A2iFields();
    Fields = addField(<recordid from the lookup table>, <Field code in main table>, Fields);
    int RID = catalog.AddRecord(<repository>,Fields, 0, 0);
    Hope it helps.
    Thanks,
    Avinash.

  • 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,
    Mausam

    Hi 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

  • Image upload using Java API

    Hi all,
    I am trying to upload an image into MDM repository using the Java MDM4J API. I have referred to the earlier posting in this forum for the same problem I am not able to add images into Catalog thru java API. However I am working on SP3 version of MDM software and looks like the Images table structure changed a bit and the code in the earlier posting isn't working.
    I am getting an error code <b>-5586944</b> and the message that gets printed on the console is
    <i>a2i.core.StringException: AddRecord error
         at a2i.common.CatalogData.AddRecord(Unknown Source)
         at a2i.common.CatalogData.AddRecord(Unknown Source)</i>
    Here is the code that I am using to upload the image
    String filePath = "C:\temp\Sunset.jpg";
    File file = new File(filePath);
    byte[] bytes = new byte[(int) file.length()];
    try{
         //read byte from file, and set the large data
         FileInputStream inputStream = new FileInputStream(file);
         inputStream.read(bytes);
         mdmFields.Add(new A2iField("Data ID", new Value(bytes)));
    }catch(IOException ioex){
         ioex.printStackTrace();
    int dataGroupId = 0;//Hardcoded it to 0. There is one group already in the repository
    mdmFields.Add(new A2iField("Data Group ID", new Value(dataGroupId)));
    //adding the name
    mdmFields.Add(new A2iField("Name", new Value(file.getName())));
    mdmFields.Add(new A2iField("Original Name", new Value(file.getName())));
    //adding OrigLocationId
    int origLocationId =0;
    try{
         origLocationId = catalog.AddDataLocation(filePath, 0, DataLocationType.ComputerLocation);
         System.out.println("Location id generated is " +origLocationId);
    }catch(StringException ex){
         System.out.println("Error while generating the location id");
         ex.printStackTrace();
    mdmFields.Add(new A2iField("Original Location ID", new Value(origLocationId)));
    try {
         //adding the image to the "Images" table
         int newImageId = catalog.AddRecord("Images", mdmFields, 0, 0);
    } catch (StringException e) {
         // TODO Auto-generated catch block
         System.out.println("Error while adding the image record " + e.GetErrorCode() + "  " + e.GetRCMessage(e.GetErrorCode()));
         e.printStackTrace();
    I am not able to figure out what is causing the problem. Any ideas would be greatly helpful. Thanks in advance.
    Suman.

    Hi Mausam,
    Thanks for your help. However, the problem doesn't seem to be going.
    I printed the records in the <b>Data Groups</b> table using a program to find the record ids that are already existing. My Data Groups table has 3 records. Here are the values.
    ID :1 Value :MyGroup
    ID :2 Value :Group2
    ID :3 Value :Group3
    I tried passing all the above 3 values (1,2,3) as input to the <b>Data Group ID</b> field. However, this time, I am getting a different error code this time
    Error while adding the image record -2147483647  No message for RC (0x80000001)
    a2i.core.StringException: AddRecord error
         at a2i.common.CatalogData.AddRecord(Unknown Source)
         at a2i.common.CatalogData.AddRecord(Unknown Source)
         at images.MyImageUpload.uploadImage(MyImageUpload.java:82)
    The error code <b>2147483647</b>  from the javadocs says <b>RC_BADPARAM</b>. Not able to figure out what exactly is causing the problem with Data Group ID.
    Any ideas or pointers to solve this would be greatly helpful. Thanks in advance.
    Regards
    Suman
    > Hi Suman,
    >
    > If you look at the description for the error code,
    > you get RC_CM_DATAGROUPNOTFOUND.
    >
    > Try giving some other value ( 1 worked for me ) in
    > the Data Group or try following the code given for
    > the Data Group in other forum post that you have
    > mentioned.
    >
    > Regards,
    > Mausam

  • Uploading files to KM repository using Webdynpro APIs

    Hi All,
    I was reading the following blog /people/rohit.radhakrishnan/blog/2005/05/27/uploading-files-to-km-repository-using-webdynpro-apis and I was trying to upload a document from a URL for example http:/ntek.com.mx/wp-content/uploads/2008/12/sap_logo1.gif
    So far I am getting the following error:
    http:/ntek.com.mx/wp-content/uploads/2008/12/sap_logo1.gif (No such file or directory (errno:2))
    Any Ideas?
    Regards,
    Orlando Covault

    Hi Jay,
    So far I think I followed all the intructions given in the links you provide. This is the snipped code
    IWDMessageManager manager = wdComponentAPI.getMessageManager();
              try {
                   String path = "/documents";
                   IResourceContext resourceContext = buildResourceContext();
                   //       get a resource factory
                   IResourceFactory resourceFactory = ResourceFactory.getInstance();
                   //       Get a RID from the current path to display the according content
                   RID pathRID = RID.getRID(path);
                   //       Get a Iresource object to work on          
                   ICollection folder =
                        (ICollection) resourceFactory.getResource(
                             pathRID,
                             resourceContext);
                   String templateUrl =
                        WDURLGenerator.getResourcePath(
                             wdComponentAPI.getDeployableObjectPart(),
                             "PositionModPDFView_InteractiveForm.xdp");
                   File file = new File(templateUrl);
                   FileInputStream template = new FileInputStream(file);
                   manager.reportWarning(template.toString());
                   if (template != null) {
                        template.read();
                        Content content = new Content(template, "byte", -1L);
                        manager.reportWarning(content.getContentType());
                        IResource newResource =
                             folder.createResource("sap_logo1.gif", null, content);
                        template.close();
                   }else{
                        manager.reportException("Documento Vacio",false);
              } catch (ResourceException e) {
                   // TODO Auto-generated catch block
                   manager.reportException(e.getLocalizedMessage(), false);
              } catch (FileNotFoundException e) {
                   // TODO Auto-generated catch block
                   manager.reportException(e.getLocalizedMessage(), false);
              } catch (IOException e) {
                   // TODO Auto-generated catch block
                   manager.reportException(e.getLocalizedMessage(), false);
              } catch (ContentException e) {
                   // TODO Auto-generated catch block
                   manager.reportException(e.getLocalizedMessage(), false);
              } catch (WDAliasResolvingException e) {
                   // TODO Auto-generated catch block
                   manager.reportException(e.getLocalizedMessage(), false);
    But I am still getting the same error:  http://ntek.com.mx/wp-content/uploads/2008/12/sap_logo1.gif(No such file or directory (errno:2)) . Any Idea of what could be wriong?
    Regards,
    Orlando Covault

  • 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,
    Simni

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

    Hi 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

  • 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

  • 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

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

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

  • 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

  • Need Sample Code for Vendor creation using JAVA API

    Hi,
    I have a scenario like Vendor creation using <b>Java API</b>.
    1.I have Vendors (Main) Table.
    2.I have <b>look up</b> tables like Account Group.
    3.Also <b>Qualifier table</b>(Phone numbers) too.
    Could you please give me the sample code which helps me to create Vendor records using Java API?
    <b>I need Code samples which should cover all of the above scenario.</b>
    <b>Marks will be given for the relevent answers.</b>
    Best Regards
    PK Devaraj

    Hi Devraj,
    I hope the below code might solve all your problem:-
    //Adding Qualified field
    //Creating empty record in Qualifed table 
    //Adding No Qualifiers
    Record qualified_record = RecordFactory.createEmptyRecord(new TableId(<TableId>));
    try {
    qualified_record.setFieldValue(new FieldId(<fieldId of NoQualifier), new StringValue(<StringValue>));//Adding No Qualifier
    catch (IllegalArgumentException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
    catch (MdmValueTypeException e2) {
    // TODO Auto-generated catch block
    e2.printStackTrace();
    //Creating Record in Qualified table
    CreateRecordCommand create_command = new CreateRecordCommand(connections);
    create_command.setSession(sessionId);
    create_command.setRecord(qualified_record);
    try
    create_command.execute();
    catch(Exception e)
    System.out.println(e.toString());
    RecordId record_id = create_command.getRecord().getId();
    //Adding the new record to Qualifed Lookup value and setting the Yes Qualifiers
    QualifiedLookupValue lookup_value = new QualifiedLookupValue();
    int link = lookup_value.createQualifiedLink(new QualifiedLinkValue(record_id));
    //Adding Yes Qualifiers
    lookup_value.setQualifierFieldValue(0 , new FieldId(<FieldID of Yes Qualifier>) , new StringValue(<StringValue>));
    //Now adding LookUP values
    //Fetch the RecordID of the value selected by user using the following function
    public RecordId getRecordID(ConnectionPool connections , String sessionID , String value , String Fieldid , String tableid)
    ResultDefinition rsd = new ResultDefinition(new TableId(tableid));
    rsd.addSelectField(new FieldId(Fieldid));
    StringValue [] val = new StringValue[1];
    val[0] = new StringValue(value);
    RetrieveRecordsByValueCommand val_command = new RetrieveRecordsByValueCommand(connections);
    val_command.setSession(sessionID);
    val_command.setResultDefinition(rsd);
    val_command.setFieldId(new FieldId(Fieldid));
    val_command.setFieldValues(val);
    try
         val_command.execute();
    catch(Exception e)
    RecordResultSet result_set = val_command.getRecords();
    RecordId id = null;
    if(result_set.getCount()>0)
         for(int i = 0 ; i < result_set.getCount() ; i++)
         id = result_set.getRecord(i).getId();     
    return id;
    //Finally creating the record in Main table
    com.sap.mdm.data.Record empty_record = RecordFactory.createEmptyRecord(new TableId("T1"));
    try {
         empty_record.setFieldValue(new FieldId(<FieldId of text field in Main table>),new StringValue(<StringValue>));
         empty_record.setFieldValue(new FieldId(<FieldId of lookup field in Main table>), new LookupValue(<RecordID of the value retrieved using the above getRecordID function>));
    empty_record.setFieldValue(new FieldId(<FieldId of Qualified field in Main table>), new QualifiedLookupValue(<lookup_value>));//QualifiedLookUp  value Retrieved above
    } catch (IllegalArgumentException e1) {
    // TODO Auto-generated catch block
         e1.printStackTrace();
    } catch (MdmValueTypeException e1) {
         // TODO Auto-generated catch block
         e1.printStackTrace();
    //Actually creating the record in Main table
    CreateRecordCommand create_main_command = new CreateRecordCommand(connections);
    create_main_command.setSession(sessionId);
    create_main_command.setRecord(empty_record);
    try
         create_main_command.execute();
    catch(Exception e)
         System.out.println(e.toString());
    Thanks
    Namrata

Maybe you are looking for