cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Writing Characteristic Values to New Documents - ECTR

SOR1
Discoverer
0 Kudos
217

I'm attempting to use the SAP Engineering Control Center connector API to set the characteristics of a document. I've gotten as far as the below snippet for reading those classification just fine, but when it comes time to write characteristics back to a document record, I've hit a brick wall

All of the methods found in the documention that could handle this seem to be deprecated. What is the current recommened method for modifying an existing documents classification OR creating a new document and setting those characteristics at creation?

 

 public static void readProperties(IPlmConnector conn, string docNum, string docType, string docStatus)
        {
        //Initialize The Search for the input document info....
            DocSearch docSearch = new DocSearch();
            docSearch.DocNumber = docNum;
            docSearch.DocType = docType;
            docSearch.DocStatus = docStatus;
            //docSearch.LoadWithComponents = true;
            //Query ECTR for the Document
            PlmRequestPartList ListParts = new PlmRequestPartList();
            IPlmResponse plmResponse = conn.SearchDocument(ListParts, docSearch, Com.Dscsag.Plm.Comm.SelectionMode.MULTI);
            string partFileName = plmResponse.Parts[0].Filename;

        //Among the results, the most recently created file will filter to the top, so Part[0] is almost always the desired option.
            IPlmRequestPart part = new
            PlmRequestPartImpl(partFileName);
            PlmRequestPartList parts = new PlmRequestPartList();
            parts.Add(part);
            IPlmResponse response = conn.ProvideInfo(parts, true, false, true);
            PlmResponsePartList provideInfoParts = response.Parts;
        //Extract Data From the Part
            foreach (IPlmResponsePart responsePart in provideInfoParts)
            {
                PartInfo info = responsePart.PartInfo;
               

                if (responsePart.Action == PartAction.DO_NOTHING && info != null)
                {
                    Console.WriteLine("Results of Provide Info Process for: " + responsePart.Filename);
                    Console.WriteLine("Param: IS_OK: " + info.Ok);
                    if (info.Ok)
                    {
                        // trace description
                        string partDescription;
                        info.Metadata.TryGetValue("DESCRIPTION", out partDescription);
                        Console.WriteLine("Descripton: " + partDescription);
                        // trace all meta data
                        Console.WriteLine("MetaData...");
                        foreach (var entry in info.Metadata)
                            Console.WriteLine(" NAME: " + entry.Key + " VALUE:" + entry.Value);
                        foreach (var entry in info.Classification[0].Chars)
                            Console.WriteLine(" NAME: " + entry.Name + " VALUE:" + entry.Value);

                        Console.WriteLine("Descripton: " + partDescription);
                    }
                }
            }
        }

 

Accepted Solutions (0)

Answers (0)