Preferences API: How to implement Preferences modifications methods?

I want to implement methods in Preferences API like putSpi, removeSpi and flushSpi. Backend where all preferences exists is LDAP and XML. At present I have only prefs accessing methods. Please provide me some guidance in this regards.
Regards,
Varun

found it out myself:
private Preferences prefs = Preferences.userRoot().node(MyClass.class.getName());

Similar Messages

  • How to implement classes and methods in badi's ?

    how to implement classes and methods in badi's? and where i have to write the code based on the requirement?can anyone explain me briefly?

    Hi
    Every BADI by default Implements an INTERFACE which already contains some methods with parameters.
    So you have to find the relavenet method based on the related paramters (by checking the fields in that paramters) you have to double click on the method and to write the code.
    see the doc
    DEFINING THE BADI
    1) execute Tcode SE18.
    2) Specify a definition Name : ZBADI_SPFLI
    3) Press create
    4) Choose the attribute tab. Specify short desc for badi.. and specify the type :
    multiple use.
    5) Choose the interface tab
    6) Specify interface name: ZIF_EX_BADI_SPFLI and save.
    7) Dbl clk on interface name to start class builder . specify a method name (name,
    level, desc).
    Method level desc
    Linese;ection instance methos some desc
    8) place the cursor on the method name desc its parameters to define the interface.
    Parameter type refe field desc
    I_carrid import spfli-carrid some
    I_connid import spefi-connid some
    9) save , check and activate…adapter class proposed by system is
    ZCL_IM_IM_LINESEL is genereated.
    IMPLEMENTATION OF BADI DEFINITION
    1) EXECUTE tcode se18.choose menuitem create from the implementation menubar.
    2) Specify aname for implementation ZIM_LINESEL
    3) Specify short desc.
    4) Choose interface tab. System proposes a name fo the implementation class.
    ZCL_IM_IMLINESEL which is already generarted.
    5) Specify short desc for method
    6) Dbl clk on method to insert code..(check the code in “AAA”).
    7) Save , check and activate the code.
    Some useful URL
    http://www.esnips.com/doc/e06e4171-29df-462f-b857-54fac19a9d8e/ppt-on-badis.ppt
    http://www.esnips.com/doc/10016c34-55a7-4b13-8f5f-bf720422d265/BADIs.pdf
    http://www.esnips.com/doc/43a58f51-5d92-4213-913a-de05e9faac0d/Business-Addin.doc
    http://www.esnips.com/doc/1e10392e-64d8-4181-b2a5-5f04d8f87839/badi.doc
    www.sapgenie.com/publications/saptips/022006%20-%20Zaidi%20BADI.pdf
    http://www.sapdevelopment.co.uk/enhance/enhance_badi.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/04/f3683c05ea4464e10000000a114084/content.htm
    http://help.sap.com/saphelp_nw04/helpdata/en/e6/d54d3c596f0b26e10000000a11402f/content.htm
    http://help.sap.com/saphelp_nw2004s/helpdata/en/c2/eab541c5b63031e10000000a155106/frameset.htm
    Now write a sample program to use this badi method..
    Look for “BBB” sample program.
    “AAA”
    data : wa_flights type sflight,
    it_flights type table of sflight.
    format color col_heading.
    write:/ 'Flight info of:', i_carrid, i_connid.
    format color col_normal.
    select * from sflight
    into corresponding fields of table it_flights
    where carrid = i_carrid
    and connid = i_connid.
    loop at it_flights into wa_flights.
    write:/ wa_flights-fldate,
    wa_flights-planetype,
    wa_flights-price currency wa_flights-currency,
    wa_flights-seatsmax,
    wa_flights-seatsocc.
    endloop.
    “BBB”
    *& Report ZBADI_TEST *
    REPORT ZBADI_TEST .
    tables: spfli.
    data: wa_spfli type spfli,
    it_spfli type table of spfli with key carrid connid.
    *Initialise the object of the interface.
    data: exit_ref type ref to ZCL_IM_IM_LINESEL,
    exit_ref1 type ref to ZIF_EX_BADISPFLI1.
    selection-screen begin of block b1.
    select-options: s_carr for spfli-carrid.
    selection-screen end of block b1.
    start-of-selection.
    select * from spfli into corresponding fields of table it_spfli
    where carrid in s_carr.
    end-of-selection.
    loop at it_spfli into wa_spfli.
    write:/ wa_spfli-carrid,
    wa_spfli-connid,
    wa_spfli-cityfrom,
    wa_spfli-deptime,
    wa_spfli-arrtime.
    hide: wa_spfli-carrid, wa_spfli-connid.
    endloop.
    at line-selection.
    check not wa_spfli-carrid is initial.
    create object exit_ref.
    exit_ref1 = exit_ref.
    call method exit_ref1->lineselection
    EXPORTING
    i_carrid = wa_spfli-carrid
    i_connid = wa_spfli-connid.
    clear wa_spfli.
    Reward points for useful Answers
    Regards
    Anji
    Message was edited by:
            Anji Reddy Vangala

  • Java Preferences api jndi / jdbc implementations?

    We have a requirement to save users gui layout preferences (swing client) in a central location (through a j2ee ejb container). the users should be allowed to log into any company workstation, and have the gui client come up with the users preferences restored.
    does anyone know of commercial or open source implementations of the java preferences api that might accomplish this? (hoping not to re-invent...)
    Thanks
    Joe e.

    I am sure this is not a difficult thing to implement, you might actually spend more time looking for open source implementations rather than do it on your own. I am sure you want to save things like window/frame positions, size, colours, look and feel etc. You can simply save this information in a property file/object. Just any idea...

  • How to implement setLineWrap equivalent method in a JTextPane

    I using a JTextPane in a chat Window, but if in this are writing a very large line this don't break lines as in the case of the setLineWrap(true) method for a JTextArea.
    How to implement break lines in a JTextPane equivalent to the setLineWrap(true) method for a JTextArea?

    ???import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    public class Test3 extends JFrame {
      public Test3() {
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        Container content = getContentPane();
        JTextPane jtp = new JTextPane();
        StringBuffer sb = new StringBuffer();
        for (int i=0; i<100; i++) sb.append("this is some text.  ");
        jtp.setText(sb.toString());
        content.add(new JScrollPane(jtp), BorderLayout.CENTER);
        setSize(400, 400);
        setVisible(true);
      public static void main(String[] args) { new Test3(); }
    }

  • How to Implement Dynamic Modification Rule for Material & multiple vendor Combination

    Hi Team,
         In dynamic modification rule for Material &  vendor combination, i have maintained material & vendor in Inspection plan at Material Assignments
    1.If i purchase same material from different vendors then how to implement ?

    Hi Balaji,
    I am not sure if i have followed your requirement.
    What do you want to do with Vendor Z? Do you want to inspect each lot from Z?
    If yes:
    Then Create 2 Inspection plans with same Operations and Same MICs, In Material Assignment, mention Vendor as Z so that 1st inspection plan will only be for Vendor Z. Do not enter DMR in Header.
    In 2nd inspection plan Enter DMR and do not mention any vendor so this plan will be applicable for all vendors except Z.
    If No:
    Then create Qm info record for vendor Z with "No inspection" set in QI06.
    Amol.

  • Preferences API: how to use different prefs in same package?

    I have some JFrames representing different modules (applications) in the same package (a.b.c.gui.*).
    Each frame stores preferences entries "x", "y", "width", "height" for their frame bounds. of course, this does not work as these values are all stored in the same preferences package node. is there another way to still have these classes in the same package and store each class'es "x", etc. as separate preferences entries?

    found it out myself:
    private Preferences prefs = Preferences.userRoot().node(MyClass.class.getName());

  • How to implement other payment methods like PayPal in CRM 7.0

    Hi,
    I am looking for more payment methods than the (obviously) three available in CRM 7.0.
    Is there a way to implement payment methads like:
    PayPal, Mobile Payment, immediate transfer, debit entry, defferd payment etc.?
    Thanks for helping me out.
    Lars
    Edited by: Lars Fischer von Mollard on Aug 4, 2010 1:51 PM

    hi Lars
    I could be of help, as I am product manager with PayPal and we have API based products that can integrated very easily with SAP's infrastructure.
    Here is a simple demo that we did at a conference by working with SAP - PayPal/SAP demo on stage here:  http://www.youtube.com/watch?v=a80PvDvazkY
    We have FIXED FEES processing that I am product managing, and am happy to discuss it further
    regards
    Srinivas Vadhri

  • How to implement code to method in SPROXY

    HI
    Version is ERP 6.0 EHP4... I have generated an webservice proxy class using Transaction SPROXY.
    Now i want to implement some business logic in one of the methods of the class. But i get the message:
    "You cannot edit proxy objects"
    How do i add my code then?
    Regards
    Jakob

    Hi Jakob,
    Thanks for the very detailed info, this is why imperative that as much detail as possible is provided in posts. That will result in much more definitive suggestions from forum users.
    You still haven't mentioned whether you've generated a consumer/client or provider service.
    If it's a consumer/client service, then you won't be able to edit it. You will need to call the method of this proxy (as defined in PI)from a custom program, see guide:
    [http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/c00ca32e-f991-2b10-f5be-97114bd2b08f?quicklink=index&overridelayout=true]
    See the section, Abap Program to Test The Consumer Proxy specifically.
    If it's a provider proxy, then the answer would change, hence I thought it could be authorization/s related.
    Regards, Trevor

  • How to implement a findbyid method in my aplicationmodule?

    i have a VO named favoriteVo base on a EO favoriteEO.the key attribute is favid.
    how can i get a row by id in a effecint way?
    because i hava a list which include all the row's id i want to search,if there is a method can find those row by this lis,it will be better
    Edited by: Danny Zhou on 2009-12-11 上午2:06

    Check out chapter '6.4.1.1 The Role of the Key Object in a View Row or Entity Row' in the Developer's Guide. FindByKey() is the method of choice.
    Timo

  • How to implement server side methods in client side player from main.asc?

    Hi,
    I am developing video player using RTMP NetConnection and NetStream object but it is giving me below Error. Can you please tell me how can I handle this. I have main.asc file form FMS server side but I don't know how to use it. 
    Async Error found = <br>Error #2095: flash.net.NetConnection was unable to invoke callback setUserID.
    Async Error found = <br>Error #2095: flash.net.NetConnection was unable to invoke callback syncChat.
    Async Error found = <br>Error #2095: flash.net.NetConnection was unable to invoke callback playingNotComplete.
    Async Error found = <br>Error #2095: flash.net.NetConnection was unable to invoke callback nowPlaying.
    Can anyone please help me ot solve this issue?
    Best regards,
    Sunil kumar

    javascript are run on the client side.. but i think what you actually mean is getting some validation to your database without submitting the form?. yes it doesn't consumes time and memory of server.. why not use ajax so you can only submit a little request.. rather than submitting the whole page..

  • How to implement createInstanceFromResultSet

    Hi All,
    I need some example to implement createInstanceFromResultSet
    my requirement is to Pull a another column in query reult from another table linked using xref.
    currently its doing using POST-QUERY of forms 6i.
    I tried created a VO based on two EO or SQL - Query but but are taking long time as sql query itself take a long time to show result.
    POST-Query
    select video_seller_id into temp_video from cm_sub_seller_xref where subscriber_id = :cm_subscribers.subscriber_id and video_seller_id is not null;
    if temp_video is not null then
    select ext_sys_seller_reference, name into :cm_subscribers.video_seller, :cm_subscribers.video_seller_description from cm_sellers where seller_id = temp_video;
    VO Query that takes time
    select cm_sub_seller_xref.VIDEO_SELLER_ID, cm_sellers.EXT_SYS_SELLER_REFERENCE, cm_sellers.NAME,cm_subscribers.subscriber_id
    from cm_subscribers INNER JOIN cm_sub_seller_xref on cm_sub_seller_xref.SUBSCRIBER_ID=cm_subscribers.SUBSCRIBER_ID
    INNER JOIN cm_sellers on cm_sellers.SELLER_ID= cm_sub_seller_xref.VIDEO_SELLER_ID
    and rownum<100
    Now looking to implement same using createInstanceFromResultSet

    we use Forms Developer in Post-Query:
    select dept.dept_name
    into :EMP.nb_dept_name
    from department dept
    where dept.dept_id = :EMP.dept_id;
    so, How to implement ADF createInstanceFromResultSet method?

  • Preferences API Faulty Implementation

    Hello.
    I am tyring to use te Preferences API. I feel the implementation is faulty. See if you agree:
    In order to use the API, you must invoke one of xxNodeForPackage(Class) or xxRoot(). All 4 of these methods throw SecurityException. How can you make a fallback mechanism?
    Basically this problem is that when you go to get the Preferences, if it's not there you end up with nothing but a null reference -- you can't force-feed an instance with some file you might have containing defaults. You can't come up with even a noop implementation in reality.
    So what are you supposed to do -- go around checking if (myPrefs != null) through all your code?! This is my dilemma.

    I'm glad someone found this post!
    The problem is in the SecurityException. An example looks like this:
    To create the preferences object, we go looking on disk. We use:
    Preferences.userNodeForPackage(Class)or systemNode.. or ..Root. Now: we must catch the SecurityException. So our code will go something like this:
    Preferences userPref = null;
    try {
        userPref = Preferences.userNodeForPackage(getClass());
    catch (SecurityException e) {
         * userPref stays null.
         * And: we have no way to provide a default object or to
         * "force-feed" default values into one somehow.
    }Here you see, in the case where that exception is thrown, we can't create any kind of Preferences object that we could use to just return default values (or some similar fallback technique). -- In all future attempts to get preference data from that node, we would have to check if we actually did get the object. (That's what I said about checking for null.) So, every time we want a pref we would have to test something like this:
    boolean theRealDefault = false;
    if (userPref != null) {
        setState(userPref.getBoolean("state", theRealDefault);
    else {
        setState(theRealDefault);
    }Which is just silly -- but I can't see the way around it!
    Maybe I'm missing something?
    Thanks for the help!
    - Steev.

  • Disabling backing store on Preferences API

    I'm working with a third-party API that makes heavy use of the Java Preferences API.
    However for the application I'm building persistent storage of preferences makes no sense. Therefore I want to disable the backing store so that my "preferences" becomes something that lives in memory only. I also want to avoid the hassle that might come from not having write permission to the backing store.
    I can find lots of examples on the Internet for disabling the Preferences API all-together. This is done by creating a new PrefencesFactory that does absolutely nothing and using this factory instead of the default.
    (all references on the Internet seem to ultimately come from this article: http://www.allaboutbalance.com/disableprefs/)
    I'm not sure what is in that article is what I want. I do not want to disable the Preferences API all-together, I only want to disable the backing store. I'm uncertain if that is what I get from the above mentioned DisabledPreferences implementation.
    Any ideas of how I can disable the backing store ?
    Thanks.

    Thanks, Kaj.
    My question was not entirely clear. As I understand Sun's Preferences API in its standard form it holds the data both in memory (cache) and in the persistent backing store. Therefore I'm not sure it is even required to build a backing store that holds data in memory, i.e. I can use DisabledPreferences in its unmodified form.
    If I'm lucky then all the "get" methods do not in fact go to the backing store to get the value but instead answer with a value from cache. I would expect the backing store to be asked only if the question cannot be answered from cache. If true I will not have to implement my own memory-based backing store.
    But why do I waste your time with this when a simple test will quickly reveal what is going on. :-)
    Stay tuned.
    Thanks.

  • How to store preferences in file system on Windows?

    I have 2 questions related to preferences using.
    1. How to store preferences in file system (not in registry) on Windows? I see file system implementation of Preferences (java.util.prefs.FileSystemPreferences). But this implementation is linux-specific (use native methods). Does universal implementation exist?
    2. How to store custom files in preferences? I need to store some user-specific files (XML files, for example) somewhere. These files are naturally user preferences. So my idea is to store it using Preferences. But it seems like there is no such posibility in standard preferences. I believe many peoples have the same problem. Does anyone have solution?
    Please help me!
    Thank you in advance.

    Preferences is supposed to keep all this data
    handling away from you, so you shouldn't bother. If
    you'd like to write a file, just write a file. You
    could create a "Settings" object and serialize it.I understand your reasonings. But unfortunately I have requirements to use file system preferences both on Linux and Windows. My bosses think there are many problems because of registry. Don't ask what problems, they didn't say. I cannot change their requirements. I must to implement it.
    Maybe somebody already solved this proplem. I will very grateful for help.
    Once again: simply write and read a custom file. Why
    do you use Preferences at all costs when they don't
    do what you want to?I have requirements to implement saving of files in the same manner as saving of preferences. It may be different code from Preferences. But it will be the best to have the same code if it possible.
    Any way I believe the need to save user-specific files as preferences is quite widespread.

  • Using the Preferences API

    I've never used this API before, so excuse my ignorance. I have a web application that I have been using a properties file to store base app info, such as the backend database, the url for the ldap, etc. This has been working fine, but after reading about the Preferences API, I thought that this might be the better place to store this info. However, I'm having permission problems that I haven't been able to figure out.
    I've got a development copy of everything on a single computer (using Windows XP), Sun One App Server, and Oracle.
    I created a small test class to see if I could load preferences from an xml file. Here's the class
    package portal.common;
    import java.util.*;
    import java.util.prefs.*;
    import java.io.*;
    import java.lang.*;
    public class PortalPreferences{
         Preferences sysPreferencesRoot;
         public void prefs() throws SecurityException{
    sysPreferencesRoot = Preferences.systemRoot();
         public void uploadPrefs(String file) throws IOException, InvalidPreferencesFormatException{
         FileInputStream fis = new FileInputStream(file);
         RuntimePermission rpermiss = new RuntimePermission("preferences.*");
         Preferences.importPreferences(fis);
         public Preferences getPrefs(){
         return sysPreferencesRoot;
    I then used a jsp to instantiate the class and call the uploadPrefs method. The class instantiates without error, but when I try to load the xml file I get the following error:
    access denied (java.lang.RuntimePermission preferences)
    I've never done anything with the security manager before so I'm not sure how to get around this. I tried creating a RuntimePermission object above, but that didn't work.
    If anyone has any ideas, I'd much appreciate it.

    No, actually I've got the Sun One App server loaded on a desktop I built that I'm using as a test box - its not a server. The Sun server is running fine, as is Oracle. The only problem I'm having is figuring out how to use the Preferences API. Maybe this API isn't the right thing to be using, that's why I'm asking for advice as well as how to get around the security issue that I'm having. My goal is to have application level information that can be stored somewhere other than in a database - this is because one of the pieces of app info is the database that's being used. This app will work with any backend. Currently, this info is stored in a properties file inside the WEB-INF directory. This works fine as is. However, my issue with that is that in order to load the properties file, I've got to have a real drive path. This again isn't that much of an issue except when trying to access from a class that doesn't have the servlet context, however, I am looking for an alternative solution to the properties file. The Preferences seemed like a good solution.

Maybe you are looking for