Dynamic determination

here is a snippet of code used by me
public void focusLost(FocusEvent fe) {
          JTextField myjtf = (JTextField) (fe.getSource()) ;
//mmore code
This focusLost event gets called by set of 5 JTextFields which form an array. Now in the focusLost events is there a way to find out which exact array member is calling the focuslost event.
thanks

If the array is in the same scope as the focus listener, you can do:
int c = 0;
for ( ; c < textFieldArray.length; c++) {
  if (myjtf.equals(textFieldArray[c]) break;
}Then you know that textFieldArray[c] is the one that sent the event...

Similar Messages

  • Is there a way to dynamically determine the number of out parameters for a server side procedure?

    Hi,
    Below is a helper method used for calling a server-side function which loops through the inbound bindVars parameter to populate the function's IN parameters. Is there a way to dynamically determine the IN/OUT parameters based on the procedure name in the stmt parameter? No members of the CallableStatement class seemed promising, but the getParameterMetaData() method in the PreparedStatement class seemed like it could be helpful lead. However, I have not found any detailed descriptions (yet) of how to use it.
    protected Object callStoredFunction(int sqlReturnType, String stmt,
      Object[] bindVars) {
      CallableStatement st = null;
      try {
      // 1. Create a JDBC CallabledStatement 
      st = getDBTransaction().createCallableStatement(
      "begin ? := "+stmt+";end;",0);
      // 2. Register the first bind variable for the return value
      st.registerOutParameter(1, sqlReturnType);
      if (bindVars != null) {
      // 3. Loop over values for the bind variables passed in, if any
      for (int z = 0; z < bindVars.length; z++) {
      // 4. Set the value of user-supplied bind vars in the stmt
      st.setObject(z + 2, bindVars[z]);
      // 5. Set the value of user-supplied bind vars in the stmt
      st.executeUpdate();
      // 6. Return the value of the first bind variable
      return st.getObject(1);
      catch (SQLException e) {
      throw new JboException(e);
      finally {
      if (st != null) {
      try {
      // 7. Close the statement
      st.close();
      catch (SQLException e) {}
    James

    The PreparedStatement.getParameterMetaData() object is exactly what you need for this task.
    Once you have the ParameterMetaData you can ask it how many parameters are present and which mode they are. The parameters are numbered from 1 to n and you can use ParameterMetaData.getParameterMode(1); to get the mode of the 1st parameter. The modes are defined as static values in the ParameterMetaData object. Check out the doc at http://docs.oracle.com/javase/7/docs/api/java/sql/ParameterMetaData.html
    Timo

  • How to dynamically determine Receivers within BPM

    I’m trying to design a way to determine my receivers within my BPM process during runtime.   My Scenario is as follows:
    SAP IDOC
        V
      XI
                 XI uses JAVA Mapping MT1 to determine vendors and if customer receives PIDX
                             JAVA Mapping MT2 to creates the PIDX output file if required
      V
    SENDs to required Vendor (PIDX if required otherwise email)
    My problem is how to dynamically determine the appropriate receiving vendor for my PIDX.
    I can not use the condition editor on the standard Receiver Determination because the output message (PIDX) doesn't have specific enough information to determine the vendor.
    Other than the customer number there are no other values and we don't want to use customer number because each vendor can have multiple customer numbers (hundreds).
    I've tried various attempts but none seem to work.  This could also be because I have limited knowledge of BPMs and this is my first complex development.  Below are the different attempts I've made at dynamically determining the receiver.  Any input would be appreciated.
    Receiver Scenario 1 
      I developed an interface mapping with MT1 as input and the SAP Receiver Determination as output.  The problem is for me to use this, the interface mapping had to reference the PIDX output (MT2 instead of MT1) which has no data that I can use to determine the receiver.
    Receiver Scenario 2
    I added a receiver step right before my send step and used the receiver list.  This appears to send the PIDX to everyone in the list and there is no way to evaluate or eliminate a name from the list. 
    Receiver Scenario 3
    I created a context object in the Integration Builder and assigned it to a field in MT1.  I then added a switch step with a branch for each vendor.  Within each specific branch there is a Send step that has the context object name I created in the "Send Context" field.  However, on the configuration side I’m unable to access the context object which I created on the design side.  Whenever I open the condition editor and select the radiobutton for "Context Object" the list  does not include the context object I created in the Integration Builder.

    Hi,
    Try using the enhaced receiver determination concept.
    Maybe based on certain field values you can write a UDF which calculates the receiver.
    Try this Blog out
    Link : [
    http://help.sap.com/saphelp_nw70/helpdata/en/43/a5f2066340332de10000000a11466f/frameset.htm]
    Regards,
    Abhishek
    Award if helpful.

  • Dynamic determination of IDOC

    Hi,
    I have a scenario wherein based on a particular KeyField, I need to dynamically determine the IDOC.  I haven't used BPM before and I don't know whether this scenario is feasible using BPM.
    My approach is creating a data type for the source which will have common fields of both the IDOCs.  This data type will hold the data sent by the sender system.  Thereafter, I would create 2 message interfaces for each IDOC.  Subsequent Message Mapping and Interface Mapping will also be done.  In BPM based on the KeyField, I will determine the Message Interface dynamically and post it to the target system.
    Kindly advice whether the above approach is right.  Is this scenario possible without using BPM.  If so, kindly suggest how to proceed.
    Thanks in advance.
    Bala

    Hi Kumar,
    Is there any possibilites of coming both the idoc data ? If so, you can do as following.
    As you are going to execute 1:N mapping, it is required to have BPM here. (and one more reason is Idoc adapter is not a part of J2EE engine.)
    <i>Is this scenario possible without using BPM</i>
    >>>If it is not of above case, then you can make use of conditional Interface determination , you can try without BPM
    Hope this helps,
    Regards,
    Moorthy

  • Dynamic Determination of Logical System- Transaction Launcher

    Hi Friends,
    Need your suggestions and inputs on how to dynamically determine the logical system for the transaction launcher.
    Our system landscape is like this.
    We have one CRM connected to mulitple back end ECC Boxes. Currently, we have created separate TL's fo VA01 ( One each for each back end application ) and provided the same in logical link and controlled the same via business role.
    For eg: BROLE1 - LLINK1  having (TL VA01) pointing to ECC System1
    BROLE2 - LLINK2  having (TL VA01) pointing to ECC System2
    BROLE3 - LLINK3  having (TL VA01) pointing to ECC System3
    The above procedure is working fine. But what we are trying to do is, when the end user clicks on the TL link in WEB UI, Based on the assigned business role, it should dynamically determine the back end system and open the VA01 Screen in that system.
    I have activated indicator multiple systems in the customizing of mapped logical systems.
    In debugging mode, i have tried changing the LOGSYS value @ run time in the handler class.
    Any pointers on this would be of great help.
    Thanks,
    Madhu

    Hi,
    Try this..
    To maintain RFC destination in each business role, there is one functional profile  "ERP_SALES_ORDER" where in you can maintain respective rfc destination.
    Create z-functional profile's for "ERP_SALES_ORDER" and maintain corresponding rfc destination, later assign these erp sales order function profiles in respective business roles trxn (CRMC_UI_PROFILE).
    you can use the below statement to fetch rfc destination whcih assigned to business role via functional profile.
      If gv_rfc is INITIAL.
        gv_rfc = CL_CRM_IC_ERP_SERVICE=>GS_ERPPROF-RFCDEST.
      ENDIF.
    Hope this helps.
    Cheers,
    Sumit Mittal

  • Dynamically determine location for a file relatively to current CLASSPATH

    Hi All,
    I am quite new to Java and I have a problem.
    I am trying to write a program that can dynamically determine the location of a file (the class that handles this will only have the relative path/file name).
    Eg.
    File f = new File(config/MyMainCfg.file);
    The class will then need to be "smart" enough to locate the file "config/MyMainCfg.file" in relative to the current CLASSPATH.
    Hence, if the current CLASSPATH is /usr/local/myclasspath, then the file should be able to be located at "/usr/local/myclasspath/config/MyMainCfg.file".
    My main question is:
    (1) If the CLASSPATH contains multiple values (i.e. CLASSPATH=path_1:path_2:path_3), how do I correctly determine the current CLASSPATH that the currently executing program is using?

    I have a method that does something like that. A few lines of it below:
       // Get location class loaded from
       public final static String getHomeLoc(Object obj, String className) {
            URL ourLoc = obj.getClass().getResource(className);
           ... code gets ourLoc.toString()  and parses it.
    // Called by:
         String loc = getHomeLoc(this, "MyClassname.class");

  • XI - Dynamically Determine System Details in User Functions

    Hello.
    Does anybody know how to dynamically determine the logon information for the statement JCO.Client mConnection = JCO.createClient() from a user defined function in XI? 
    Within a mapping I have written a user defined function to call a function module on ECC but as the system details are 'hard-coded' the incorrect system is called once the interface is promoted from the DEV system. I am not able to modify the user function code for each system as we transport the interfaces between systems which are locked and as such code the builder objects cannot be modified .  I desperately need a method of determining which logon details should be used and I would prefer the solution to be within the user defined function.
    User defined function code:
    JCO.Repository mRepository;
    // Change the logon information to your own system/user
        JCO.Client mConnection = JCO.createClient(
                "300",         // SAP client   
                "pi_jco_rfc",        // userid
                "ecd4adrt",       // password
                "EN",          // language
                "adrp560dev1",        // host name
                "10" );        // system number                     
    // connect to SAP
    mConnection.connect();
    // create repository
    mRepository = new JCO.Repository( "SAPLookup", mConnection );
    // Create function
    JCO.Function function = null;
    IFunctionTemplate ft = mRepository.getFunctionTemplate("ZPI_DETERMINE_STORE_FROM_SITE");
    function = ft.getFunction();
    // Obtain parameter list for function
    JCO.ParameterList input = function.getImportParameterList();
    // Pass function parameters
    input.setValue( site[0] , "IM_WERKS" );
    mConnection.execute( function );
    String ret = function.getExportParameterList().getString( "EX_VLFKZ" );      
    mConnection.disconnect();
    result.addValue(ret);
    Any ideas gratefully accepted.

    Darren,
    Why are you using JCOs directly? It is not advisable to do so. You can/have to use the RFC Lookup API to achieve this.
    Have a look at Michal's article about this.
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a03e7b02-eea4-2910-089f-8214c6d1b439
    Regards,
    Jai Shankar

  • Dynamically determining the port number of a deployed application

              Hi
              How do I dynamically determine the port number of a deployed web application ?
              I know HttpRequest.RequestURL() returns us the entire URL but I wanted to just
              know the port number .
              Is there any API do that ??
              Thanks
              Kar
              

    kar piyush wrote:
              > Hi
              >
              > How do I dynamically determine the port number of a deployed web application ?
              > I know HttpRequest.RequestURL() returns us the entire URL but I wanted to just
              > know the port number .
              >
              > Is there any API do that ??
              >
              kar,
              Here's what I do under WL 7 SP2:
              import javax.management.AttributeNotFoundException;
              import javax.management.DynamicMBean;
              import javax.management.MBeanException;
              import javax.management.ReflectionException;
              import javax.naming.Context;
              import javax.naming.NamingException;
              import weblogic.jndi.Environment;
              import weblogic.management.MBeanHome;
              String domainName,
              serverName,
              serverPort,
              serverUrl;
              // Getting the initial context
              Environment env = new Environment();
              try
              Context ctx = env.getInitialContext();
              if (ctx == null)
              // unable to retrieve a JNDI context
              return;
              // Retrieving the server-specific MBeanHome interface
              MBeanHome home =
              (MBeanHome) ctx.lookup(MBeanHome.LOCAL_JNDI_NAME);
              if (home == null)
              // unable to retrieve the local server MBean
              return;
              // Get the domain & server name
              domainName = home.getDomainName();
              serverName = home.getMBeanServer().getServerName();
              // The server port and address are a little trickier to extract...
              Object mbeanArray[] =
              home.getMBeansByType("ServerConfig").toArray();
              DynamicMBean mbean = (DynamicMBean) mbeanArray[0];
              try
              serverPort =
              Integer.parseInt(
              mbean.getAttribute("ListenPort").toString());
              serverUrl =
              mbean.getAttribute("ListenAddress").toString();
              catch (AttributeNotFoundException thrown)
              // caught a AttributeNotFoundException
              catch (MBeanException thrown)
              // caught a MBeanException
              catch (NullPointerException thrown)
              // caught a NullPointerException
              catch (ReflectionException thrown)
              // caught a ReflectionException
              catch (NamingException thrown)
              log.debug("caught a NamingException", thrown);
              

  • Dynamically determining the number of cols in Select stmt

    Hi,
    I was wondering if it is possible to dynamically determine the number of cols in Select stmt.
    For example:
    If it had:
    Select empno, lname from emp where empno = 32
    then I'd like it to return 2.
    Thanks in advance.
    Sincerely,
    Nikhil Kulkarni

    Hi,
    I was wondering if it is possible to dynamically determine the number of cols in Select stmt.
    For example:
    If it had:
    Select empno, lname from emp where empno = 32
    then I'd like it to return 2.
    Thanks in advance.
    Sincerely,
    Nikhil Kulkarni

  • Dynamic determination of VALUES of an Attribute in a Mail-form

    Hi All,
    We have created a Mail Form with ceratin attributes. We have assigned a target group to a campaign.
    now, the requirement is to determine the VALUES of the attributes dynamically for the BPs in the target groups.
    please help me what should be done to meet this rquirement.

    Hi there,
    I believe the following link demostrates the whole process including your requirements:
    [http://wiki.sdn.sap.com/wiki/display/CRM/NavigationtotheCRMUIComponentfromMailFormorSmartFormsHyperLink|http://wiki.sdn.sap.com/wiki/display/CRM/NavigationtotheCRMUIComponentfromMailFormorSmartFormsHyperLink]
    Please reply if this helps.
    Regards,
    Vinamra.

  • Dynamically Determine the color of graphic

    Hi Experts,
    Can u plz explain the code how to determine the color of the graphic dynamically.I want black and white graphic on first page and color one on the next page and this must continue
    till the last page.....

    upload two graphics to sap.
    one is black and white and other is color.
    declare a variable for count type i in global declaration.
    before graphic declaration just
    declare program lines i.e. move sfsy-page to count.
    count the no of pages using sfsy-page.
    insert 2 graphic
    make 2 graphic as conditional.
    i.e. in the condition tab of graphic1 -
    > count = 1.
    then the black and white image will print.
    for the graphic 2 declare ---> count > 1 .
    then the color image will print.
    or u can directly maintain condition for both graphics.
    in the condition tab sfsy-page = 1. block and while
    for second image sfsy-page > 1. color image
    it will work .
    with Regards,
    Kiran.G

  • Dynamic determination of currency translation type

    Dear all,
    we have a requirement for some reports in Business Warehouse (NetWeaver 7.3) regarding the currency conversion type. In the Report a rolling forecast (always starting with the actual period) with one key figure (e.g. Price) shall be analyzed. The issue is the following: The actual period should use Translation Type A, the following periods, till end of Fiscal Year, Translation Type B and the rest Translation type C.
    Example Structure:
      Drilldown to Period
      03.2014 (actual Month)
      06.2014
      12.2014
    01.2015 
      05.2015
      Key Figure
      Price
      Price
      Price
      Price
      Price
      Price
      Price
      Translation Type
      TT-A
      TT-B
      TT-B
      TT-C
      TT-C
    Now, is it possible somehow to determine in one key figure the Translation type dynamicaly using the Option "Ex. rate type from variable" in the rscur Transaction.
    Our main issue here would be the connection between the time reference and the Translation type.
    Thank you in advance for your help!

    Hi,
    thank you for your fast answer. We use different Translation types for actual data, forecast and plan data. (MBW, FBW and PBW).
    Therefore in our example, MBW will be used for all actual Prices, FBW for all forecast-prices and PBW for all plan-Prices.
    Forecast-Prices are valid for the actual Fiscal Year (but future periods), Plan Prices are valid for all future Fiscal Years.
    E.g.:
    Actual Period is 06.2014: MBW
    From Period 07.2014 to 12.2014: FBW
    From Period 01.2015: PBW.
    Now we need a report with a rolling forecast from actual period to actual period + 17.
    The report should look exemplary for this month as following:
    Key Figure
    Price (06.2014)
    Price (07.2014)
    Price (12.2014)
    Price (01.2015)
    Price (02.2015)
    Used
      translation type
    MBW
    FBW
    FBW
    PBW
    PBW
    Material 1
    value
    value
    value
    value
    value
    value
    Material 2
    value
    value
    value
    value
    value
    value
    The issue we have would be, that due to the dynamic structure of a rolling forecast, a fixed key figure structure (one Price key figure for each period) with directly assigned translation variables is impossible.
    I hope that this example is clearer. If you have of course any additional questions, please dont hesitate to ask.

  • Java - dynamically determining endpoint

    I have, until now, hard coded the endpoint for my integration. A customer is having issues logging in through the API. I assume the issue is with this hardcoded endpoint as the url they have sent me for login to OCRMOD is different to the url that I use to login in to my developer account.
    I assume just as interactive users have different endpoints so do API users.
    My question is how do i programmatically determine the correct endpoint for a user?
    Thanks
    Andy

    Alex,
    Thanks for all your input and time.
    I think I am beginning to understand the way CRMOD is organised now. Basically there is no ONE instance, it is a collection of instances/pods/servers and which instance an individual uses is not simply a dynamic loadbalancing issue, but a fixed endpoint for that user/organisation.
    This gives us a problem in what we are trying to achieve - an integration with our application - because we would require users to also be aware of this fact i.e. what is the unique url that you use to login to CRMOD. This is messy but it appears that there is no way around the fundamental hosting architecture of CRMOD. We will probably store the url against an organisation and use this for login.
    Thanks again
    Andy

  • Dynamically Determine the level of approval in OIM

    Hi All,
    I have a requirement in which the level of approval has to be determined dynamically based on the requested resource. We have two levels of approval (first& second) and my customer wants second level approval only for certain resources and these details defined in a csv file. e.g., (resource1,first_app,second_app). So if the file contains second level approver data then 2nd level is required otherwise not required. Also the second level approval task should be intiated after the first level approver approves the request.
    e.g., When the user request for a resource , the request should go to first level approvar. Once the first level approver approves the request it should validate whether second level approval is requred or not for the requested resource. If required then second level otherwise it should provision the resource to the user. Is it possibe to do that in OIM?
    I have created 3 task , First one is for first level approval (unconditonal) . Second task is for second level approval (conditonal) and I have created another task (conditional)is just to validate whether second level approval is requred or not. With this task have attached an adapter and passing the requested resource as an argmuent from the object data , this adapter invokes a java and will return TRUE if second level required or FALSE if not required.
    FIRST LEVEL -- Response Tab - For Approve -- Task to Generate -- I have mpped IS SEOND LEVEL task.
    IS SECOND LEVEL -- Response Tab -- For TRUE - Task to Generate -- I have mapped SECOND LEVEL task (Status C).
    IS SECOND LEVEL -- Response Tab -- For FALSE - Task to Generate -- nothing (Status R).
    if IS SECOND LEVEL returns FALSE the approval ends with Rejected status. If IS SECOND LEVEL returns TRUE it immediately execute the provisioning process and then assigns the request to SECOND LEVEL approver. Am I missing anything?
    Can you suggest me how to process with this?
    Thanks in advance,
    INIYA

    Hey the only basic problem I can see with that is already written over there.
    IS SECOND LEVEL -- Response Tab -- For FALSE - Task to Generate -- nothing (Status R).
    So you have defined that with 'FALSE' response status you are rejecting your task, and if you are rejecting your task then your approval is finished. What you need to modify over here is just change the Status to 'C' which will let your workflow know that now there is no second level required and the approval stands completed.
    I think you will not be able to change the response to 'C' for this because you have already used this 'Task Response' for some tasks. What you can do for this is -
    1) Eitgher go and update the database for this mapping.
    2) Send some other response from the file in place of FALSE. eg Send NO and then mark it as completed- 'C'
    You should be done.
    Thanks
    Sunny

  • Dynamic Determination of Target Messge Type (IDoc)

    Hello,
    we have a IDoc - HTTP scenario. A SYSTAT01 IDoc should be sent back to the sender system setting the status depending on the http response.
    The basic scenario works fine, however depending on the value of one field there should be either a STATUS or ZSTATUS message type be sent back. Both are based on the SYSTAT01 IDoc structure and there absolutely no difference in the mapping logic. The two differet message types are used to handle inbound processing in SAP differently.
    Question now is, whether I can set the output message type dynamically in ONE message mapping. I tried to set the field MESTYP in the control header, but this does not work, as the MESTYP obviously is always set according to the imported type.
    Of course it would work using two different mappings, but I would rather handle ii

    Hi,
    you cannot change message type in the mapping
    but you can have two target messages in one mapping and fill only one of them
    Regards,
    Michal Krawczyk

  • Dynamic determination of schema document

    Hi:
    I attempting to parse an XML file using the SAX parser with SCHEMA_VALIDATION set. I found that I have to explicitly pass the location and name of the *.xsd file and generate a XMLSchema object using XSDBuilder. Is there anyway that I can dynamically build the XMLSchema object witout having to explicitly pass the *.xsd file? In other words, is there a way that the XML document can tell me what *,xsd file to parse against?

    You can use xsi:schemaLocation attribute in the instance to indicate the schema. See the sample code.

Maybe you are looking for