Reg: properties files in webdynpro

Hi All,
        I want to develeopment webdynPro project,in which need to get environment dependent parameteres depending on Environments..as i do in java, i want to create .properties file with the WebdynPro project.
i am unable to create  the file..Please help me out to develope a Projects independent of Environment....
Thanks
Nagaraju

Hi,
Where can i get the configuration api. Can u please provide where can i get it.
       IWDDeployableObject deployableObject = wdComponentAPI.getDeployableObjectPart().getDeployableObject();
       String configName = "test"; //This should match with the name specified in the src->configuration->test.properties
       WDConfiguration.getConfigurationByName(deployableObject, configName)
       //For 7.1 instead of the above code use
       IWDWebModule webModule = wdComponentAPI.getDeployableObjectPart().getWebModule();
       WDConfiguration.getConfigurationByName(webModule, configName);
Regards
Ayyapparaj

Similar Messages

  • How to use .properties files in Webdynpro Java code?

    Hi all,
      I want to use a logon.properties file when I initial a JCO connection pool in my webdynpro DC (JCO.addClientPool()),but  I found when I deployed this DC to the server, it always giv e me an FileNotFoundException. So I donot know how to deploy a .properties file to the server and how to access this file in my Java code?
    Thans and Best regards
    Deyang

    Hi,
    1) put .properties file to your packege under src\packages folder (src\packages\com\sdn\properties\jco.properties)
    2) load property:
         final InputStream is = getClass().getClassLoader().getResourceAsStream("com/sdn/properties/jco.properties");
         final Properties properties = new Properties();
         try
              properties.load(is);
         catch(Exception e)
              wdComponentAPI.getMessageManager().reportException(new WDNonFatalException(e), false);
    Regatds Maxim R.

  • Need to Put Some data in Properties File and Access it

    HI Friends,
    I want to store the data (servername,User id ) in Archana.properties file from WebDYnpro Application
    Pls let e know where to place the properties file and also let me know how to access the properties file from WD application and Modify it.
    I have tried placing in: src/mimes, Configuration etc...but i am unale to access it.
    Also If i access the properties file and update it, do i again need to deploy the WD application.
    Kindly let me know if there are any better methods to store key value pairs from the application.
    Regards,
    Archana

    HI,
    The better approch will be to store the .properties file into a known folder manually created in the server  where the Application is deployed?
    That means where?
    Itried placing my .prpoerties file at several places in my Project(Not server)- Mimes, Configuration, Packages.
    I tried the same kind of  code u specifed.
    But the file.exists returns false, though there is a file in the location.
    When i am trying with javaproject, it works but in webdynpro project, its says file not found
    Below is the code:
    package com.sap.demo.casestudy.wd;
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.InputStreamReader;
    import java.util.Properties;
    public class ReadWriteArc {
    @param args
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              WriteProperty("Key3", "Value3");
              String value=ReaddProperty("key2");
         public static void WriteProperty(String key,String value) {
              try {
                        Properties pro = new Properties();
                        File f = new File("C:/Users/i067753/workspace/720/workspaceSetUp.jdi/LocalDevelopment/DCs/demo.sap.com/casestudy/_comp/src/configuration/Archana.Properties");
                        //File f = new File("C:/Users/i067753/workspace/720/workspaceSetUp.jdi/LocalDevelopment/DCs/demo.sap.com/casestudy/_comp/src/mimes/Components/com.sap.demo.casestudy.wd.comp.webdynproappln.WebDynproAppln/Archana.Properties");
                        //File f = new File("C:/Users/i067753/workspace/720/workspaceSetUp.jdi/LocalDevelopment/DCs/demo.sap.com/casestudy/_comp/src/packages/com/sap/demo/casestudy/wd/Archana.Properties");
                        if (!f.exists()) {
                             System.out.println("File not found!");
                        } else {
                             FileInputStream in = new FileInputStream(f);
                             pro.load(in);
                             pro.setProperty(key, value);
                             pro.store(new FileOutputStream("Properties"), null);
                             System.out.println("Operation completly successfuly!");
               catch (IOException e) {
                   System.out.println(e.getMessage());
         public static String ReaddProperty(String key) {
              try {
                   String valuemessage=null;
                        Properties pro = new Properties();
                        File f = new File("C:/Users/i067753/workspace/720/workspaceSetUp.jdi/LocalDevelopment/DCs/demo.sap.com/casestudy/_comp/src/configuration/Archana.Properties");
                        //File f = new File("C:/Users/i067753/workspace/720/workspaceSetUp.jdi/LocalDevelopment/DCs/demo.sap.com/casestudy/_comp/src/mimes/Components/com.sap.demo.casestudy.wd.comp.webdynproappln.WebDynproAppln/Archana.Properties");
                        //File f = new File("C:/Users/i067753/workspace/720/workspaceSetUp.jdi/LocalDevelopment/DCs/demo.sap.com/casestudy/_comp/src/packages/com/sap/demo/casestudy/wd/Archana.Properties");
                        if (!f.exists()) {
                             System.out.println("File not found!");
                        } else {
                             FileInputStream in = new FileInputStream(f);
                             pro.load(in);
                              valuemessage = pro.getProperty(key);
                             System.out.println("Read completly successfuly! and the value is "+valuemessage);
                        return valuemessage;
               catch (IOException e) {
                   System.out.println(e.getMessage());
               return null;
    And from WD Application i called the class as:
    ReadWriteArc.WriteProperty(engname, reserveEngine1);
    Pls suggest if am making any mistake here
    U say Server, how can i do that?
    Regards,
    Archana:)

  • How to add the property file..ie(default.properties) to a webdynpro project

    Hi All,
    How to add the property file..ie(default.properties) to a webdynpro project.
    I urgently require the solution. Kindly get it for me.
    Regards
    DK

    Hi DK,
    this is described in the second Web Dynpro Java Tutorial
    <a href="https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/b1a3e990-0201-0010-aeb2-a2ef5bc3da8e">creating an Extended Web Dynpro Application</a>
    Regards, Bertram

  • To Read the contents of the properties file which is located in webserver

    Hi,
    I have one requirement where I have to read the contents of a property file which is located in some path in server. Say for example, when you click on link abcd then contents of abcd.properties file should be displayed in one text view in webdynpro . I am trying to implement this in webdynpro for java. The main thing is like I am not able to retrieve the server path of the file and hence not getting the file contents. I tried using methods like  getApplicationPath() or getRealPath() but its not working. So can you guys please help me on to how to read the server file contents.
    Thanks and regards,
    Sai

    Hi Romano,
    Thanks a lot for your reply. However, I forgot to mention one thing in my question. Its like the path will be different everytime. Say, we have systems like development, acceptance, production. So when the user clicks on the link abcd, it should take the path of development system and similarly when the user clicks on the link in acceptance or production, the path will be different. say for example, in development the path will be
    usr/cluster/dev/abcd.properties but it acceptance it will be usr/cluster/acc/abcd.properties. So just want to know whether this will work? Anyway, I will give this a try.
    Thanks once again,
    Sai

  • Inserting data into a file in Webdynpro java

    hi,
    My requirement is, i am using html code in my webdynpro application. i want to send the html code to a file(.txt file) .can any body help me how to send the data to file in webdynpro java.
    thans,
    kishore

    Hi,
    For export file in format XML, TXT, ...
    continue steps
    1) create node with name  FileResource and type binary
    2) create view and add control filedownload and properties control set data binding node FileResource
    3) create following code
      //@@begin javadoc:wdDoInit()
        /** Hook method called to initialize controller. */
      //@@end
      public void wdDoInit()
        //@@begin wdDoInit()
            IWDAttributeInfo attInfo = wdContext.getNodeInfo().getAttribute(IPrivateExportListView.IContextElement.FILE_RESOURCE);
            IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) attInfo.getModifiableSimpleType();  
            binaryType.setFileName(ExportListView.FILE_NAME);
            binaryType.setMimeType(WDWebResourceType.TXT);
            try {
                String resourcePath = WDURLGenerator.getResourcePath(wdComponentAPI.getDeployableObjectPart(), ExportListView.FILE_NAME);
                wdContext.currentContextElement().setFileResource(this.getByteArrayFromResourcePath(resourcePath));
            } catch (WDAliasResolvingException e) {
                wdComponentAPI.getMessageManager().reportException(e.getLocalizedMessage(), true);
            } catch (Exception e) {
                throw new WDRuntimeException(e);
        //@@end
    and add following code
      //@@begin others
        private byte[] getByteArrayFromResourcePath(String resourcePath) throws FileNotFoundException, IOException {
            FileInputStream in = new FileInputStream(new File(resourcePath));
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            int length;
            String Prueba = "hola esto es una prueba" + new Date().getSeconds();
            //byte[] part = new byte[10 * 1024];
            byte[] part = Prueba.getBytes();
            while ((length = in.read(part)) != -1) {
                out.write(part, 0, length);
            out.write(Prueba.getBytes());
            in.close();
            return out.toByteArray();
        // store image file name in constant FILE_NAME
        private static final String FILE_NAME = "doc.txt";
      //@@end
    4)Create file ext(txt,xml,...) in following dir of the project
    ...\_comp\src\mimes\Components\com.prueba.ReporteComp
    regards from colombia-medellín

  • Using .properties file in web dynpro

    Hi,
    I am having a requirement. I have to create a .properties file and I have to use it in my web dynpro application. How can I do that? Any help...
    Thanks & Regards,
    Raj

    Hi,
    Go to the navigator view...select src\Components\<ComponentName> and create create a .properties file.
    You can read the  configuration file in your webdynpro app as follows
    IWDConfiguration configuration =
          WDConfiguration.getConfigurationByName(
            wdComponentAPI.getDeployableObjectPart(),
            "<<>>");
    http://help.sap.com/saphelp_nw04/helpdata/en/b8/aa343e32ff1033e10000000a114084/frameset.htm
    Regards, Anilkumar
    Message was edited by:
            Anilkumar Vippagunta

  • How to read the properties file available in Server File structure in webdy

    hi all,
    I have developed one webdynpro application. In this application i need to access mdm server to continue. For getting the connection i need to pass the IP addresses.
    Can i have code  how to read the properties file which is residing in the server file. with out included along with the application. keeping some where in the file structure in the server. I want to read that properties file by  maintain the iP addresses and users in  properties file based on the key i want to read like below.
    servername="abcServer"
    username="john"
    password="test123"
    Please send me the code how to read this properties file from the file structure and how to read this values by key  in webdynpro application
    Regards
    Vijay

    Hi Vijay,
    You can try this piece of code too:
    Properties props = new Properties();
    //try retrieve data from file
    //catch exception in case properties file does not exist
    try {
             props.load(new FileInputStream("c:\property\Test.properties")); //File location
             String serverName = props.getProperty("servername"); //Similarly, you can access the other properties
             if(serverName==null)
               //....do appropriate handling
         }     catch(IOException e)
                   e.printStackTrace();
    Regards,
    Alka.

  • Can't locate .properties file on Visual Admin

    Hello,
    I have created an RID.properties file inside a DynPro application under src/packages/... and I am able to load it and get it's attributes from the DynPro code.
    So far so good...
    As far as I know this properties file can be viewd and modifed on the Visual Admin under:
    Configuration Adapter -> webdynpro...
    I've browsed all the folders at this location and couldn't locate my .properties file. So where is it...?
    Roy

    i think you only want to access and maintain the properties on server side...
    ok, check out
    http://help.sap.com/saphelp_nw04/helpdata/en/b8/aa343e32ff1033e10000000a114084/content.htm
    for an example how to access the properties from your wdp app.
    i suggest loading all props into a specific context node and corresponding attributes. perhaps there are better ways.
    Now sth. uncomfortable:
    Be careful when you redeploy your app. All properties are overwritten with the ones you defined locally.
    you also cant delete the config on local side, it would be deleted on server, too. (at least i think so)

  • Tool for generating properties files

    Hello Experties,
    I am wondering is there a tool or program for SAP to get SAP fields screen names from SAP backend for diffrent languages and generat the properties files?
    for java uwl or webdynpro they are all the same properties file.
    thanks

    WebDynpro i18n is done by .xlf files. Its an standard (http://en.wikipedia.org/wiki/Xliff) and there are some OSS editors available, just google xlf editor.Or check this one: http://okapi.opentag.com/applications.html#rainbow
    The Idea is, that you give your xlf files to the translator and safe the results with a suffix representing the language (_de.xlf for german).
    Hope this helps.

  • How to call the methods of JAR file into webDynpro Environment

    Hi All ,
             I have a requirement to call the methods of a JAR file into
             WebDynpro Environment. can anybody suggest me How this can be achieved. I Have a JAR file named FastTrack.API
    which contains few methods and i want these methods to be accessable into WebDynpro as other methods.
    Plz Somebody help me to sort this out.
    Regards,
    Deepak.

    Deepak,
    Please follow these 2 steps:
    1. Add jar into webdynpro project
            Right Click on ur project -> Select properties -> Java Buil path -> Choose Libraries Tab -> Add External Jars -> add the file from ur computer
    2. Use the jar
          write the import statement in your webdynpro code to utilize the properties of added jar.
    Thanks & Regards,
    Ram

  • Changing properties file value without redploying code

    Hi,
    If I use properties file colors.properties in my web dynpro application for storing key-value pairs as
    color1=RED
    color2=BLUE
    color3=GREEN
    is it possible to change colors.properties  in future to show new colors
    color1=ORANGE
    color2=YELLOW
    color3=PURPLE
    without redeploying code ? through Visual Admin / Config tool  ?
    If not, what is the other way to avoid hard coded values in Web Dynpro Java ?
    Thanks !!

    Hi,
    Its can be achieved using the WDConfiguration API of Java Webdynpro.
    The details are given in the blog below;
    /people/daniel.wirbser/blog/2005/09/28/properties-files-in-web-dynpro-applications-how-to-use-the-wdconfiguration-api
    Also for changing this properties all we need to do is from Visual Administrator/Config tool(changing from config tool will need a re-start)
    Proceed as follows to start the Visual Administrator:
           1.      Start the Visual Administrator by double-clicking on file go.bat in the file directory C:\usr\sap\<System ID>\<System Number>\j2ee\admin, in which the J2EE Engine is installed. For example, the background file can be stored in directory C:\usr\sap\J2E\JC00\j2ee\admin.
    You can find a description of the Visual Administrator in the SAP Library under SAP NetWeaver u00AE Application Platform (SAP Web Application Server) u00AE J2EE Technology in the SAPWeb Application Server u00AE Administration Guide u00AE Server Administration u00AE SAP J2EE Engine Administration Tools u00AE Visual Administrator.
           2.      Navigate to directory Server 0/Services/ Configuration Adapter / webdynpro/ <sap.com/Your namespace>/ <Your Web dynpro application>
           3.      Select the property file
           4.      The Visual Administrator opens so that you can edit the values. You can change or redefine the parameters and check the option "Use Custom " to take the new value.
    Thats all.
    One more URL is
    http://help.sap.com/saphelp_nw04/helpdata/en/09/a4d6a674bc1d4a9e74abf81bed3ef6/frameset.htm
    Regards
    Priya

  • Exchange profile error: dbconnect.prop: failed to load properties file .\dbconnect.properties

    All,
    We are using PO 7.4 with SP5, and we have an issue while accessing URL Exchange profile page (http://<host:port>/webdynpro/dispatcher/sap.com/com.sap.xi.exprofui/XIProfileApp) it throw's the below error.
    dbconnect.prop: failed to load properties file .\dbconnect.properties
    dbconnect.prop: failed to load properties file
    Did some one seen this before and have resolved ? Any help is highly appreciated.
    Thank you, Pranay

    Though below note is not applicable to you, i would suggest you to check if the destination is created by the configuration wizard? If not you can create one and see if it helps.
    Create Java RFC destination XI_EXCHANGE_PROFILE manually: Navigate to http://[host]:[port]/nwa --> Configuration --> Infrastructure --> Destinations. Create the RFC Destination with PILDUSER as logon user.
    1525193 - PI CTC: Exchange Profile Access after (EhP) Upgrade

  • Properties file generated by netweaver

    Hallo,
    Can I use the properties files generated by netweaver using I18N tools (wdcontroller.xlf ==> I18N tools ==> create properties files ) for a general use instead of an external manually generated properties file ?
    Thanks,
    regards,
    Andrea

    I think you are talking about the internastionaization concept in the webdynpro application, actually the propetieas file will create automatically whne u save your XLF with the changing of the text. but you can create it your self in which way ur telling is correct.
    may be it will helpful for you,
    Chees,
    Apparao

  • Passing properties file to portal

    Hi experts,
    I have one application which was built on PDK. I have one properties file which holds connection information of backend. now how can i pass these properties file to portal. In webdynpro java, we can achieve this using application parameters. but in PDK which procedure we have to follow?
    one more question is, For PDK applications creating the system object is mandatory or optional?. if mandatory how can we do that one for PDK application?
    Regards
    maha

    Hi,
    If it is a AbstractPortalComponent, DynPage or JSPDynPage you can put the information in the portalapp.xml file of the project into the component profile-section for example:
        <component-profile>
            <property name="z.system" value="R3_SYSTEM"/>
            <property name="z.debugMode" value="false"/>
        </component-profile>
    See [http://help.sap.com/saphelp_nw70/helpdata/en/c9/c8af42a6f6cb6ae10000000a155106/frameset.htm|http://help.sap.com/saphelp_nw70/helpdata/en/c9/c8af42a6f6cb6ae10000000a155106/frameset.htm] for more info about portalapp.xml.
    Then in code you access the values:
    String system = request.getComponentContext().getProfile().getProperty("z.system");
    The properties are visible in iview properties in Content Administration -> PortalContent -> [iview properties] - here you can change them.
    Hope that helps,
    Romano

Maybe you are looking for

  • I can't find my photos. They are not in my Iphoto, what do I do? where do I find them?!

    I tried to save a picture that a friend sent to me from her blackberry. Now my I-photo is empty and it asks me to create a new library. I have very valuable photos in my original library with several albums; they must be somewhere. If someone could h

  • Strange album names in Library

    Hi- I was having some issues with my iPhoto Library working with iPhoto Buddy (gave up on that for now anyway) and looked at my Pictures--->iPhoto Library--->Albums and noticed 3 odd names (they show as just Documents- is that correct?): Pending Rota

  • NO MARKER UPDATE(INVENTORY)

    HI GURUS, CAN ANYBODY PLS EXPLAIN WHAT IS THE USE OF NO MARKER UPDATE IN INVENTORY MGMT.

  • H.264 Quality and Transcoding Problems After 7.1 Update

    Since 11/1, my CC manager has been telling me about updates for After Effects, Premiere, and Flash, but every time I tried to update, the update failed. (From the error message it appeared to be a corrupted download. It said to try downloading it aga

  • Please help whit this error!!!

    When I click 'Start' button to start 'Servicing all requests' of "jspExpressionEar.ear" app, got this error. wouldn't start. any idea? Message icon - Error java.lang.Exception: [DeploymentService:290049]Deploy failed for id '1,225,844,443,766′ since