Creating PCD object via API

Is is possible to programmatically create PCD objects such as iViews/Pages etc.?

Hi,
The way to create PCD objects such as iViews and pages is documented in the following link in the help portal (Portal --> Developer Guide --> Developing Applications --> Creating Content --> Managing iViews and Other PCD Objects:
http://help.sap.com/saphelp_nw04/helpdata/en/fd/ea5c42da4de92ce10000000a1550b0/frameset.htm
Here's an overview for creating an iView from a PAR and adding it to the folder at pcd:portal_content/myFolder :
IiViews iViewSrv = (IiViews)
    PortalRuntime.getRuntimeResources().getService(IiViews.KEY);
INewObjectDescriptor IVtoCreate = (INewObjectDescriptor)
    iViewSrv.instantiateDescriptor(CreateMethod.NEW,
        "par:/applications/myProject/components/myComponent",
            request.getUser());
Hashtable env = new Hashtable();
env.put(Context.INITIAL_CONTEXT_FACTORY,
    IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
env.put(Context.SECURITY_PRINCIPAL, request.getUser());
env.put(Constants.REQUESTED_ASPECT, PcmConstants.ASPECT_SEMANTICS);
InitialContext iCtx = null;
try
    iCtx = new InitialContext(env);
    String folderName = "pcd:portal_content/myFolder";
    Context ctx = (Context)iCtx.lookup(folderName);
    ctx.bind("myNewHelloIV", IVtoCreate);
catch(Exception e)
Hope this helps.
Daniel

Similar Messages

  • Create PCD folder via API

    How can i create a new folder in pcd via java APIs??
    Regards

    Hi,
    The following code creates a folder under the Portal Content directory:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, IPcdContext.PCD_INITIAL_CONTEXT_FACTORY);
    env.put(Context.SECURITY_PRINCIPAL, request.getUser());
    InitialContext iCtx = null;
    try {
         iCtx = new InitialContext(env);
    //   Get the fathetr context
         IPcdContext myPcdContext = (IPcdContext) iCtx.lookup("portal_content");
    //   Create an attribute for the name
         Attribute myAttr = new BasicAttribute("com.sap.portal.pcm.Title","New Folder Name");
         Attributes myAttrs = new BasicAttributes();
         myAttrs.put(myAttr);
    //   Create a subcontext with the predefined attributes
         myPcdContext.createSubcontext("NewFolder", myAttrs);
    } catch (NamingException e) {
         e.printStackTrace();
    Best regards,
    Avishai Zamir

  • Creating HR objects via IDoc HRMD_A05

    Hi to all
    I want to create HR objects via IDoc HRMD_A05 and want the objects numbered using INTERNAL number range.
    The IDoc documentation says to pass an exclamation mark '!' to OBJID to make the system generate new number. However, the field is numeric and can not contain '!'.
    Has anybody tried this way before and achieved to create objects numbered internally?
    Thanks

    Hi
    I have told the issue to the SAP OSS and their feedback was:
    "As explained in note 741165:
    'There is no provision to carry out an internal number assignment using
    ALE in the target system. Therefore, the numbers must be assigned when
    the IDOCs are created in the source system.'
    The documentation in the Interface Repository is wrong.
    Regards
    *--Serdar

  • Save binary object via API 2

    How do I save a file via the API 2?
    Any exsample will help me alot!
    I'm trying to save a object to the table Binary_Objects, but I get the error: "com.sap.mdm.internal.protocol.manual.ServerException: Server error (0xffaab000)"

    I assume you are trying to create a BinaryBlobRecord in the Binary_Object Table.
    Here is some code that works:
    BinaryBlobRecord record = RecordFactory.createEmptyBinaryObjectRecord(tableId);
    record.setBinary(new BinaryValue(bytes));
    record.setDataSize(new IntegerValue(size));
    record.setHasOriginal(new BooleanValue(true));
    record.setDataGroupId(node.getId()); // get the node using RetrieveGroupTreeCommand command.
    record.setSource(new LookupValue(new RecordId(1))); // see below
    record.setCode(name); // The code has to be unique, so you can add a random number to the name.
    record.setName(new StringValue(name))
    CreateRecordCommand createRecordCommand = new CreateRecordCommand(connection);
    createRecordCommand.setSession(authenticatedUserSession);
    createRecordCommand.setRecord(record);
    createRecordCommand.execute();
    If you don't set the source properly , you will get that error. For setSource method, you need to set a Location ID. With API 5.5 SP5, most likely there is no way to create a new location ID and we have to use one of the existing Location IDs. Just to make the code work, I used "new LookupValue(new RecordId(1)) ", which requires having at least one file uploaded to the table via MDM Data manager and use the first part of its location ID.
    For setDataGroupID, first create the group node in the MDM Data Manager and find the node in the GroupTree with API. To get the GroupTree, use RetrieveGroupTreeCommand.

  • Create generic object with API

    Hi,
    i have created a document category and saved it to cFolders configuration directory. I can create this document category with a web ui but i have to do it with API from my program. I have found only function CFX_API_DOC_CREATE to create a folder content. Can I use this function to create my document category? When yes - how can I set the document category during create? Or should i use another function?
    Kind regards,
    Boguslaw

    Generic object can be created with function module CFX_API_DOC_CREATE. The category id have to set up with the parameter I_TYPE_ID.

  • Creating an opportunity linked to a contact via API

    Hi,
    We are trying to create opportunity records against a contact but don't understand how to link the 2 objects via API as my development team can't find a direct link when looking in the WSDL.
    I can see in the UI that the primary contact can be stored against the object, would just like to know how to do this via API.
    Thanks for your help in advance.
    Leslie

    Hello Leslie,
    There are a number of ways to accomplish this. As you mentioned in your post there are often Id fields exposed on a parent object that allow one to associate to a record of a different type, in this case you can send a request for the parent object, in this case Contact and specify the ID of an existing Opportunity record.
    You can also use the child object structure to create an association. For example, if you are entering a new Contact and a new Opportunity you can use the <ListOfOpportunity> within a Contact Insert request to also insert a new Opportunity. I have attached a sample SOAP request below.
    I would recommend your team review the WS User Guide as well as the sample code provided at samplecode.oracle.com for further details. Please see the announcements at the top of the forum for additional links.
    I hope this helps.
    Thanks,
    Sean
    <?xml version="1.0" encoding="UTF-8" standalone="no"?>
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
    <ContactWS_ContactInsert_Input xmlns="urn:crmondemand/ws/contact/10/2004">
    <ListOfContact>
    <Contact>
    <ContactFirstName>Bruce</ContactFirstName>
    <ContactLastName>Wayne</ContactLastName>
    <ListOfOpportunity>
    <Opportunity>
    <OpportunityName>Capture the Joker!</OpportunityName>
    <CloseDate>04/10/2011</CloseDate>
    <Priority>High</Priority>
    <Status>Pending</Status>
    <SalesStage>Selected</SalesStage>
    </Opportunity>
    </ListOfOpportunity>
    </Contact></ListOfContact></ContactWS_ContactInsert_Input></soap:Body></soap:Envelope>

  • How can create the object ? Via class.forName

    Hi,
    i want to create the object via class.forname?........
    i have tryed like this Class obj=Class.forName("sample.Employee");
    but it gives error like this......
    java.lang.InstantiationException: sample.Employee
         at java.lang.Class.newInstance0(Class.java:291)
         at java.lang.Class.newInstance(Class.java:259)
         at sample.ArrayListTest.main(ArrayListTest.java:22)

    The line
    Class obj=Class.forName("sample.Employee");does NOT create a new object of class
    sample.Employee. It only loads the class and creates
    the Class object. You have to call newInstance() to
    create a new instance of the class:
    Object obj =
    Class.forName("sample.Employee").newInstance();I guess you already did something like that, because
    forName() itself doesn't throw an
    InstantiationException.
    For this to work, class sample.Employee must be in
    the classpath and it must have a public constructor
    that takes no arguments.this is my full code it dosn't work i don,t know
    public class ArrayListTest {
    public ArrayListTest() {  }
    public static void main(String[] args) {
    ArrayList employees = new ArrayList();
    // create some employees
    /* Employee employee_1 = new Employee("John", 2000);
    Employee employee_2 = new Employee("Carl", 3000);
    Employee employee_3 = new Employee("Ron", 4000);*/
    /*instead of this Employee employee_1 i want to create the new obeject by using*/
    try{
    Object obj = Class.forName("sample.Employee").newInstance();
    catch(Exception e)
    e.printStackTrace();
    // add them to your list
    //employees.add(employee_1);
    //employees.add(employee_2);
    //employees.add(employee_3);
    // display only the names your list
    for(int j = 0; j < employees.size(); j++) {
    Employee temp = (Employee)employees.get(j);
    System.out.println("nr. "+(j+1)+": "+temp.getName()+"\nnr. "+(j+1)+": "+temp.getSalary());
    // invoke the toString()-method from Employee
    for(int j = 0; j < employees.size(); j++) {
    Employee temp = (Employee)employees.get(j);
    System.out.println(temp.toString());
    } // class ArrayListTest
    again the same error occur................

  • Accessing the password store (PSTORE) via API

    After having created portal users via API srcipt, we now would like to register users
    for an external application programmatically.
    I.e. we have a portal user and we know his account info ( user / passwd ) for the external application. Portal seems to store account infos for external applications in a "Password Store". So i am looking for an API to register portal users for external applications providing the known acount info,
    i.e. sth. like
    PSTORE.InsertExtAccount( PortalUser, ApplicationName, ExtUser, Extpasswd).
    I had a look at http://www-sso.us.oracle.com/
    but could not find API description or any hints when an API like that will go production.
    Can anyone help me with that issue ?
    Thanks a lot.
    null

    This is probably the wrong forum for this question - I would try the 9iAS Portal forum.

  • Creating a PCD Object(iview or page) thru API

    Hi All,
    I found some help regarding creating a PCD Object,
    This is the following code
    IiViews iViewSrv = (IiViews)
        PortalRuntime.getRuntimeResources().getService(IiViews.KEY);
    INewObjectDescriptor IVtoCreate = (INewObjectDescriptor)
        iViewSrv.instantiateDescriptor(CreateMethod.NEW,
            "par:/applications/myProject/components/myComponent",request.getUser());
    I am unable to find jar files to compile
    what are the jar files which consist of the interfaces Iiviews and IPage, IPages.And where can I find those?
    Thanks in Advance
    Rgds,
    Santhosh

    Hi Elda,
    First, thanks for a great API discovery for me (a pity I can't reward points to you).
    Do you have a link to online documentation on this?
    Second, there are 2 solutions:
    1. WinRar can search inside jars. Use it to search for the file IiViews.class on the server.
    2. Use the great classlocator plugin. See this post for details:
    How to use classlocator plugin?
    According to my last check the download link no longer works. If that's the case I can send it by e-mail.
    Hope that helps,
    Yoav.

  • Creating worksets via API

    Hi all!
    Is it possible to create and change worksets dynamically via API? I have found documentation how to read pcd objects and their properties but not how to edit pcd objects:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/6112ecb7-0a01-0010-ef90-941c70c9e401
    best regards
    Michael

    Hi Michael,
    (1) To change workset attributes, get the IPcdContext object for the workset, then do something like this:
    ModificationItem[] mods = new ModificationItem[1];
    mods[0] = new ModificationItem(DirContext.REPLACE_ATTRIBUTE,new BasicAttribute("com.sap.portal.navigation.MergePriority", new Double("75")));
    myPcdContext.modifyAttributes("",mods);
    (2) To create, you could simply bind a new context to the folder you want to place the workset, and set all the attributes (most important, object class and name). This is a little tricky, and there may be side effects I haven;t thought of.
    For iView, you would use the IiViews semantic object to create the iView, and this object would take care of almost everything for you. But there is no workset object.
    Hope this helps.
    Daniel

  • Re-using Segments Created via API or Re-creating Every Time?

    Hi All,
    Wanted to get your thoughts on this...
    We have been able to create Segments via the API, however, which way to go:
    OPTION 1: Re-use Segment if there are no additions or deletions (changes) to the list? or
    OPTION 2: Re-create the Segment every time via API.
    In Option 1, we will still need to compare the existing list to the new list before deciding to re-use. However, the comparison will be done outside of Eloqua.
    In Option 2, we may create a new list even though there are no changes but we will have the historical data and it will be easier to identify lists.
    In both scenarios, data processing may affect performance.
    For those who have done this or are familiar, what would you recommend?
    Hope it's clear.
    Pinging: TJ Fields-Oracle, 1065474, freejung
    Thanks!!

    In simpler terms of creating assets and storage, creating new segments each time should not be a problem. That said, the asset choosers might end up being slow if you're blowing past 100k which will ultimately result in a poor user experience for the marketers. Please see:
    Eloqua Product Thresholds
    Beyond that, you should also consider:
    - Developers creating a process where segments and campaigns are being created automatically, and the campaigns being left active for a long time with segments are set to run every hour. For static lists, it wouldn't really result in heavy calculating but you can run into delayed contact entry into campaigns if you have hundreds of segments feeding hundreds of campaigns - each with heavy filtering. At best it would be pointless to run segments (on the canvas) hourly if the lists are static, and at worst you're making everything slower. That doesn't sound like a major concern here but something to keep in mind.
    - API tools automatically updating segments which are currently referenced in live campaigns (again, running hourly segments). This means if you re-use assets for new campaigns there is a risk that they're being referenced by a currently live campaign and you end up adding the wrong contacts to the wrong flow. Since segments share a relationship to campaigns as their primary contact feeder, the API tools should only be updating the same segment asset with new contacts if the intent is to add those contacts to an existing campaign.
    - Although keeping shared lists or segments untouched gives you some historical tracking, do not assume the contacts in those assets are exactly the same ones which were used when the campaign was launched. For example, if you delete the bouncebacks and unsubscribes after the campaign has run and go back to your segment, even if it is a simple segment with a local list, it will not contain the deleted contacts. For any serious auditing task, let the API tool archive what contacts were added to what segment. Then you can use Bulk 2.0 activity exports to keep a list of what contacts received what emails from various campaigns.
    Regards,
    Bojan

  • How to Create Resource Object in OIM through SQL queries or OIM APIs

    Hello,
    I have to create few (100) resource Objects in OIM. I was creating manually through Design console one by one. In future we might need to create many more Resource Objects .It takes lot of time if we do it through Manually.
    Is there any possiblity we can create Resource Objects through SQL query or OIM APIs ???
    Thanks!!

    Yes. I do it all the time.
    If you are using 11G 11.1.1.3
    Go here
    http://fredforester.org/code/xmlstarters/
    Download the files.
    RESCFORM.xml is an example resource built from the template
    buildtemplate.sh is a shell script that creates a resource from the template
    index.php - you dont need this
    templateresource.xml - this is the template resource. it was created by building a simple resource with all its basic tasks and components then editing it and renaming things so I can find them with sed
    to create Resource C you would
    ./buildtemplate.sh RESCFORM "Resc Resource" "Resc Process"
    you would end up with a file called RESCFORM.xml where when imported would have
    UD_RESCFORM
    Resc Resource Resouce Defintion
    Resc Process Process Defition with basic tasks pointing to a dummy adapter.
    You can optionally create your own prepop so it will get assigned to the form when you import.
    Good luck

  • Create UDO object through DI API

    Hi folks,
    I want to create an UDO object directly from the code. Deep inside, I have an UDO that wraps an authorization document.
    How can I create an object from my AddOn and add it in SAP BO.
    Thanks in advance!
    Oscar S.M.

    example is for master data and masterdata lines UDO. For other types is almost same.
    Dim oUserObjectMD As SAPbobsCOM.UserObjectsMD
            oUserObjectMD = oCompany.GetBusinessObject(SAPbobsCOM.BoObjectTypes.oUserObjectsMD)
            oUserObjectMD.CanCancel = SAPbobsCOM.BoYesNoEnum.tNO
            oUserObjectMD.CanClose = SAPbobsCOM.BoYesNoEnum.tNO
            oUserObjectMD.CanCreateDefaultForm = SAPbobsCOM.BoYesNoEnum.tNO
            oUserObjectMD.CanDelete = SAPbobsCOM.BoYesNoEnum.tNO
            oUserObjectMD.CanFind = SAPbobsCOM.BoYesNoEnum.tNO
            oUserObjectMD.CanYearTransfer = SAPbobsCOM.BoYesNoEnum.tYES
            oUserObjectMD.ChildTables.TableName = "LINES"
            oUserObjectMD.Code = "DATA"
            oUserObjectMD.ManageSeries = SAPbobsCOM.BoYesNoEnum.tNO
            oUserObjectMD.Name = "Data"
            oUserObjectMD.ObjectType = SAPbobsCOM.BoUDOObjType.boud_MasterData
            oUserObjectMD.TableName = "DATA"
            lRetCode = oUserObjectMD.Add()
            If lRetCode <> 0 Then
                oCompany.GetLastError(lRetCode, sErrMsg)
                MsgBox(sErrMsg)
            End If
            oUserObjectMD = Nothing
            GC.Collect()

  • Can not create or modify objects via GUI

    I have installed Oracle SQL Developer version 1.5.1. The option to create/modify tables via the GUI is not available when i right click i get the options to explore directory, notepad, refresh, apply filter, clear filter (grayed), capture table (grayed), capture into existing model (grayed), quick migrate (grayed) and help i have looked aroung the entire workbench and have not found the option to create/modify tables with advanced options via teh GUI. i can create and modify tables if i type in sql commands but do not have the GUI. Is that a separeate adapter you have to install.
    Thanks
    NGM

    Hi NGM
    Could that be related to the user privileges? Please control with another account that can make create/alter table ?
    What are the privileges of your user?
    It works fine for me on the release : Oracle IDE 1.5.1.54.40.
    Try to Check for Updates in the help menu.

  • Managing iViews and other PCD Objects

    Hi,
    I have visited some help on Managing iViews and other PCD Objects at
    http://help.sap.com/saphelp_nw04/helpdata/en/fd/ea5c42da4de92ce10000000a1550b0/frameset.htm
    But I want to know when are these things actually put to use. For example, I would simply create an iview and add it to a page. Can you give me a real scenario where this is required. Especially if any of you have used this on your projects.
    How do I start if I wish to pick up this feature? Any blogs on good exapmles which I can use deploy and learn?
    Thanks!!

    HI,
    Refer these links
    <a href="https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/3367e690-0201-0010-d285-c69bd884c9f3">PCD</a>
    <a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4192">weblog</a>
    <a href="https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/4109">weblog1</a>
    ====================================
    I just tried out some of the API's, i hae not encountered any business scenario's concerning these API's.

Maybe you are looking for

  • Monitor Died need connector

    Hi, I have a iMac pedestal version which has worked great for years, however the screen just died. I thought about connecting the computer up to another monitor or TV so wanted a connector. I bought a mini-DVI to VGA connector but it's the wrong part

  • Foreign Exchange loss is not getting correct amount

    Hi Guru's I have maintained loss (x) and gain (Y) accounts in OB09 for the GL account (Z). There is two open items for the GL account (Z), in that one is debit open item and another one is credit open item. The difference is 500 TRY and 0 USD. I just

  • Select Sorting in prompt level

    I have below requirement from user. Prompts:     Loan Id           Loan Type           Sort by Account Number/Sale Type Basically when user run the report, it should prompt below three fields. Loan Id Loan Type Sort order with a drop down list which

  • Wild  search

    hi, i have a report which has an output of cost center, profit center,planed value, actual value the input is cost center/profit center and if i do a wild card search in input screen how will i get the desired results lets say i search in for "abc" i

  • Microsoft Works (2004) not working on Lion

    I have an old (2004) version of Microsoft Works and it does not want to run on Lion. I'm a teacher and dont have the money to buy a new version. What are my options? Should I just get rid of Lion?