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

Similar Messages

  • 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

  • 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

  • "Bookmarks and history system will not be functional" with corrupt files found by Avast and websites loading slow ONLY in Firefox

    Firefox is the only browser that lets me connect with my microphone. I need to use this feature for an online class. Earlier this evening, the message prompting me to allow or deny the class website permission to use the microphone stopped appearing, and without it the recording won't pick up any sound and I can't record anything.
    I tried exiting and restarting Firefox. I had some extensions in use at the time, in particular Session Manager. The allow/deny message still wouldn't appear, so I restarted my computer.
    Now when I open Firefox I see the "The bookmarks and history system will not be functional" error message. In addition, the browser loads websites extremely slowly; it takes several minutes to load each page or for me to be able to click on anything (the URL bar, the menus, etc) My other browsers (Internet Explorer and Chrome) are running normally and load websites at a normal speed. I tried downloading the latest version of Firefox but it didn't fix anything. I also tried restarting the computer again but that didn't help either.
    I ran my Avast software system check and it turned up that the following files under "C:\Users\(me)\AppData\Roaming\Mozilla\Firefox\Profiles\Irozixj7.default" are "corrupted and unreadable":
    -cookies.sqlite-shm
    -cookies.sqlite-wal
    -localstore.rdf
    -places.sqlite-shm
    There was one more problem on the scan, but it probably isn't relevant: for the file "C:\ProgramData\Microsoft\Windows Defender\Definition Updates\{9A2C6FA7-E04E-4819-B86A-8363A9D1E42A}\mpengine.dll" it says "The system cannot find the path specified." When I attempted to follow the path indicated, one of the folders (I can't remember which) said something along the lines of "You can't access this folder, do you want to permanently allow access to this folder?" I said yes and was able to access the folder.
    I have tried to add the Places Maintenance extension but the speed is too sluggish to download anything. Trying to access any of the menus results in the browser freezing for several minutes then unfreezing but with the menu still unopened. Therefore none of the solutions found here (https://support.mozilla.org/en-US/kb/fix-bookmarks-and-history-will-not-be-functional?esab=a&as=aaq) seem to work.
    My questions are as follows:
    -Is it possible to figure out what caused the problem in the first place?
    -Is there a way for me to fix it without losing my bookmarks and history?
    -How can I avoid this happening again in the future?

    First, I recommend backing up your Firefox settings in case something goes wrong. See [[Backing up your information]]. You can copy your entire Firefox profile folder somewhere outside of the Mozilla folder. To quickly access this folder:
    Help > Troubleshooting Information > "Show Folder" button
    Next, keep this folder open, exit Firefox, and try moving the "corrupted and unreadable" files to a different folder. With the exception of localstore.rdf, which stores window positions, toolbar customizations, and other nonessential data, the other files appear to be session-specific files that hopefully are not critical. If you restart Firefox, does it behave more normally?
    If not, try creating a fresh Firefox profile. It will have the Flash plugin, which is the control sites usually use to connects your camera and/or microphone, and other plugins, but otherwise will be a new setup. This article has the steps for starting up in the Profile Manager: [[Use the Profile Manager to create and remove Firefox profiles]].
    If sites work normally in the new profile, you can import your bookmarks from your old profile, as well as copying over other files that don't seem to be causing the problem. Some trial and error might be required to determine that. This article has some tips: [[Recovering important data from an old profile]].
    If the new profile is no better, you can exit Firefox and use the Profile Manager to switch back to your original profile.
    Any improvement?

  • Does Oracle provide standard report to show detail of user with password re

    Hi,
    We are currently using Oracle HRMS R12.0.6. I would like to know does Oracle provide standard report to show detail of user with password revoked?
    Appreciate advise.
    Thanks and Regards,
    Shiau Chin

    Develop a package to do it if you need the password. Create the packages . Execute the SQL to determine the password. Make sure you replace the &USER_NAME with the USER NAME at the end..
    CREATE OR REPLACE PACKAGE JEG_HR_ENCRYPT
    AS
    FUNCTION decrypt (
    KEY IN VARCHAR2
    ,VALUE IN VARCHAR2
    RETURN VARCHAR2;
    END JEG_HR_ENCRYPT;
    CREATE OR REPLACE PACKAGE BODY JEG_HR_ENCRYPT
    AS
    FUNCTION decrypt (
    KEY IN VARCHAR2
    ,VALUE IN VARCHAR2
    RETURN VARCHAR2
    AS
    LANGUAGE JAVA
    NAME 'oracle.apps.fnd.security.WebSessionManagerProc.decrypt(java.lang.String,java.lang.String) return java.lang.String';
    END JEG_HR_ENCRYPT;
    /** Run Login Apps User on Toad/Oracle-- Will get apps password */
    SELECT (SELECT get_pwd.decrypt (UPPER ((SELECT UPPER (fnd_profile.VALUE ('GUEST_USER_PWD'))
    FROM DUAL)), usertable.encrypted_foundation_password)
    FROM DUAL) AS apps_password
    FROM fnd_user usertable
    WHERE usertable.user_name LIKE UPPER ((SELECT SUBSTR (fnd_profile.VALUE ('GUEST_USER_PWD')
    ,1
    , INSTR (fnd_profile.VALUE ('GUEST_USER_PWD'), '/')
    - 1
    FROM DUAL));
    SELECT usertable.user_name,
    (SELECT jeg_hr_encrypt.decrypt
    (UPPER
    ((SELECT (SELECT jeg_hr_encrypt.decrypt
    (UPPER
    ((SELECT UPPER
    (fnd_profile.VALUE
    ('GUEST_USER_PWD'
    FROM DUAL)
    usertable.encrypted_foundation_password
    FROM DUAL) AS apps_password
    FROM fnd_user usertable
    WHERE usertable.user_name LIKE
    UPPER
    ((SELECT SUBSTR
    (fnd_profile.VALUE
    ('GUEST_USER_PWD'),
    1,
    INSTR
    (fnd_profile.VALUE
    ('GUEST_USER_PWD'),
    - 1
    FROM DUAL)
    usertable.encrypted_user_password
    FROM DUAL) AS encrypted_user_password
    FROM fnd_user usertable
    WHERE usertable.user_name LIKE UPPER ('&USER_NAME')

  • IO system status and user status

    Hi all,
    Could you please tell me where the link between IO sys and user status.
    Thank you.

    Hi
    System status and User status:
    System Status
    o        The system sets a system status informing the user that the system has executed a certain business transaction for an object.
    o        You can only influence this status by executing a business transaction that changes the system status.
    o        If you release an internal order, the system automatically sets the Released system status.
    User Status
    o        You can set a user status in addition to the existing system status.
    o        You specify the user status in a status profile, which you create for each order type in Customizing.
    o        You can specify and activate any number of user statuses.
    o        In a production order you can simultaneously
    The system status and the user status influence the business transactions in the same way.
    The status profile allows you to:
    o        Define the user status and document its functions with a corresponding long text.
    o        Assign a status number that specifies the order in which the system reaches the user statuses.
    o        Define an initial status, which is then automatically set when an object is created.
    o        Determine that a user status is automatically set when you execute a business transaction.
    o        Permit or forbid specified transactions, if a status is active.
    VVR

  • How to get system status and user status of service order

    Hi,
    I want to show user status and system status for service order in my report and i am using CRM_ORDER_READ function module to read the status, but it is returning lot of status records, could anyone please suggest how to get the system status and user status for service order.
    I did not find any clue for how to get user status, i can see the user status when i open the transaction using CRMD_ORDER.
    Regards,
    Kamesh Bathla

    Hi,
      Go to CRM_JEST table give your service order guid and get the status, pass this status into TJ02. You will get the status of your order.
    Regards
    Srinu

  • XI Integration Engine- You cannot log on to system BS_SAP_R_3 with user XIR

    I have given the correct user name and password while creating RFC destination and Port.
    And I see wrong user ID/password in ping status.
    Ping Status: You cannot log on to system BS_SAP_R_3 with user XIRWBUSER
    Last Retry Thu Jan 18 23:13:47 UTC 2007 .
    Can anybody guide me on this?
    Thanks
    Chiru

    Hi,
    I have correct user id/ password in RFC destination. I do not know why in Runtime work Bench it is showing the wrong userid/password.
    I forgot to give it at the first time and later I gave the user details.
    And in Runtime work bench this error is not going away.
    Any help on this?
    Thanks
    chiru

  • How to determine role authorization of user in MAM?

    Hi everyone,
    I'm new to SAP and SAP MI, and I am currently implementing (or "enhancing") a MAM.  I have the following question on user authorization:
    In terms of role authorizations, does anyone know how I can determine what roles an authenticated user have from SAP?  For example, if user A logs into the MI Client, and if this user accesses the MAM, is there a way for the MAM to know what kind of user roles he/she has?  Is there a SyncBo that will give me such info?  I checked the JavaDocs for the SyncBo's, but they have NO descriptions.  The closest thing that I found was in MAM090 (Interface com.sap.mbs.mam.bo.MAM090).  There are getter methods for getRoleGen(), getProfileResource(), and getPartnerRole().  Are any of these usable?
    Are there any good documents that I can look at to determine what each SyncBo's does? 
    Many thanks!
    Jeffrey

    Hi Jeffrey!
    Here are the 3 different checks you have to look at"Users & Authorizations" for setting up your MAM Users.
    (1) SAP Backend:
    (1a) The SAP MAM User who synchronizes with the Backend from the MI Client should have all necessary authorizations for Plant Maintenance Components of the SAP System that are associated with your MAM Scenarios.Pl refer to the following SAP Authorization Objects I_ALM_ME ,I_AUART,I_BEGRP,I_BETRVORG,I_CCM_ACT ,I_CCM_STRC,I_ILOA,I_INGRP,I_IWERK,I_KOSTL ,I_QMEL,I_ROUT ,I_ROUT1,I_SOGEN,I_SWERK,I_TCODE ,I_VORG_MEL,I_VORG_MP ,I_VORG_ORD,I_WPS_MEB ,I_WPS_REV in your Backend System and have it assigned to the User Profile, based on your requirement.
    (1b) Service User for setting up the MAM & MI Landscape: This user logon info has to be setup in the RFC Destination that is associated with your MAM25 SyncBOs, to logon to the Backend System and this user should have the basic authorizations required to establish the connection.
    (2) MI Middleware: The SAP MAM User who synchronizes with the Backend from the MI Client should have the following Authorization Objects assigned to his/her profile. S_ME_SYNC, S_RFC, S_TCODE.
    (3) MI Client: Refer to MI Security Guide.Pl note that the MI Client MAM User is same as the Middleware User and the Backend User.You should be taking care of this already.This is just a FYI.
    Let me know, if you are looking for any other additional info.
    Thank You
    Gisk

  • 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

  • System status and user status in Line Item Reports

    Dear PS-friends,
    I have to extend the CI CI_PROJ with some new fields. These fields should be shown in diverse Line Item Reports (CJI3 u2026).
    I know how to get these customer fields into the field catalog for the reports (maintain include table CI_RKPOS, EXIT_SAPLKAEP_001 and ViewCluster V_TKALV).
    Now our customer wishes that 2 of the new fields are: system status and user status. The status should be shown in CJI3 as a concatenated field as you see it in CJ20N.
    In CN42 there is the column system status as a standard column. But I cannot find the structure CNJ_STAT included in V_TKALV for Line Item Report Object=PD.
    Has anybody an idea how it works to show the system status and user status in Line Item Reports.
    Thanks in advance!

    Problem is solved.
    I wrote a function module using FM 'STATUS_TEXT_EDIT' and concatenated line and user_line.

  • No system available for user mapping in create new group.

    Hi Experts,
    I faced this problem when i create a new group
    "There are no systems available for user mapping for the selected principal."
    i checked that my server is running well with other groups.
    i would just like to ask what determines the "selected principal"? is it because i select the wrong roles or the roles does not need the system?
    i'm confused as some previous groups i created works well until this new group, i've tried to create a new 1 but the problem still exsist.
    Thanks.

    hi,
    Define permission to the system that you have created.
    right click on hte system that you have ccreated  - > in properties dropdown go to permissions -> search the group/ user for which you want to map this system - > and give permission as enduser.
    this will make your system accessible while user mapping.
    regards,
    Sujay

  • SAP_J2EE_ADMIN, no systems available for user mapping

    Hello,
    We are using EP 7.0 to run CRM applications (client 100).
    We are creating portal users in 001 client of CRM server.
    When I try to map users of portal to users of crm through user administration, it says that, "There are no systems available for user mapping for the selected principal".
    I discovered that this warning disappears if I give the user has SAP_J2EE_ADMIN role in 001 client. But this time the user has the content adminstrator, user administrator and system administrator tabs as well. I don't want to give administrator rights to everyone.
    What can I do?
    Any recommendations?

    I maintained the permissions like Administrator:None,  End User:X, Role Assigner:X.
    I removed the J2EE_ADMIN role from the user.
    But unfortunately the result did not change. The user can not access the CRM system.
    Here is the error:
    Portal Runtime Error
    An exception occurred while processing a request for :
    iView : pcd:portal_content/com.sap.pct/specialist/com.sap.pct.crm/com.sap.pct.crm.roles/com.sap.pct.crm.crm_user/com.sap.pct.crm.ckm.home/com.sap.pct.crm.ckm.work/com.sap.pct.crm.act.activities
    Component Name : com.sap.portal.appintegrator.sap.BSP
    Exception in SAP Application Integrator occured: Cannot retrieve system object for this alias. System Alias: 'SAP_CRM', System ID: 'pcd:portal_content/j2eeadmin/systems/com.arr.SAP_CRM'. User: 'ILKNURY', Reason: Access denied (Object(s): portal_content/j2eeadmin/systems/com.arr.SAP_CRM).
    Exception id: 04:32_24/04/07_0038_5660850
    See the details for the exception ID in the log file

  • Get detail of user

    Hi
    i want details of users login time and logout time for past 1 month
    how to get this detail
    thanks

    Dear Sulabh ,
    Every body said right thing....
    atleast your system trace should be on for that....
    but i want to know which kind of information you want...
    as you said login and logout time....
    but why......if your trace is not on then only sinle way to know about users login....day wise not time wise....
    go to ST03 and then
    expert mode then select application server and day ,week, month
    after that
    User and settelment..
    you will find the user list which user woked on that particular date...
    then.....
    also you find out which t-code he/she run....with responce time....
    Moral is that st03 for workload analysis but if trace is not on the you can ....
    get some information from here...
    Anuj
    Edited by: anuj sharma on Mar 5, 2009 7:21 AM

  • Convert system time into User local time.

    Hi,
    How to convert System time into User Local time.
    Are there any FMs available.
    Regards,
    Kiran

    hi,
    There is just one simple funda behind the Date and time logic in SAP.
    -> It is absolutely useless to store Date and time directly in DB. Why ?
    Because 00:00 a.m in London could mean 05:30 in India !! So If I (in India) store a Date 1st Feb 2008 , 10:00 a.m .. This time for a person in London could be invalid.. because he is behind your time zone..
    So the solution is to store the date/times in Timestamps format. Taking the above example.. 1st Feb 2008, 10:00 a.m (in India) will be stored as 20080201043000.
    This time if seen in German Time zone will look as : 1st Feb 2008, 05:30 a.m.
    Simple right
    -> In India we store date as DD.MM.YYYY while in other countries they store it as MM.DD.YYYY.
    The separator could be . or - or / .
    The date format is user dependent. I might prefer to store it as DD.MM.YYYY and you might want to store it as MM-DD-YYYY.
    System does not bother what your format is. It always stores in YYYYMMDD (8 Char)
    On screens if you want to display Date then it must always be shown in that users format who is seeing it. How to get this done ?
    DATA : lv_date(10) type c.
    write sy-datum into lv_date.
    So in LV_DATE variable the date will be stores in the users format.
    Simple right
    There are function modules that do the same. But normally we should avoid use of FM to make code simpler, short and easy... no complications at all ..
    You can use system variables sy-datlo (Local Date for Current User) and sy-timlo ( Local Time of Current User ).
    You can also use GET TIME statement.
    reward if useful,
    preet

Maybe you are looking for

  • How to center the data in a column?

    Hi, I want all the data in a column to be centered rather than left-justified. How can we do this in SDK? Please see the picture which explains it all. Thanks Leon Lai

  • X-Fi Xtrememusic w/ Heatsink Lower RMAA Resul

    Hi, I just purchased the X-Fi Xtrememusic and am loving the quality of the Analog out with my headphones. I'm curious though, because accorfing to this http://audio.rightmark.org/downloads/Sound%20Blaster%20X-Fi%20Testing%20Methodology%20And%20Result

  • Trying to get the 1st character from an int

    Hello all, Ill try to make this as easy to explain as possible. I want to get the 1st number of the int that the person enters so for example: 100 then i want to get 1 200 then 2 and so on... Here is the code so far. It works, but i just dont know wh

  • Reg procedures and cursors

    Hello, I am getting errors when i am trying to run the foll pl/sql pgm in oracle 10g. the question is a PL/SQL block wrapper with cursor, exception, and a function or procedure, computing the amount that the customer spent on books, and generating co

  • No release strategy tab for purchase requisition

    Hi Gurus i have a user who is complaining about the release strategy not appearing after saving the requisition, but when i try to test it from dev using his profile, it works fine. he can create the req fine on other pc's but not on his pc. i have c