Need help in writing a small java code

Hi,
I have a small requirement where I need write a small java code. I am thinking of using array. Please suggest if you know the solution:
1. Need to compare user logon id is preset in the lookup table or not.
2. If user id present in the lookup then send type "A" mail
3. If user id in not present in the lookup then send type "B" email.
Please suggest.
Thanks,
Kalpana.

use this code . you have to pass userlogin and lookup name
Public String GetEmail(String UserLogin,String lookupcode)
String email;
try{
tcLookupOperationIntf lookupIntf = Platform.getService(tcLookupOperationIntf.class);
HashMap<String, String> lookupValues = getLookupHashMap(lookupIntf, lookupCode);
String found = lookupValues.get(UserLogin);
if (found!=null) email= "EMAIL A";
else
email= "EMAIL B";
}catch(Exception e){}
return email;
private HashMap<String, String> getLookupHashMap(tcLookupOperationsIntf lookupOperationsIntf, String lookupCode)throws tcAPIException,tcInvalidLookupException,tcColumnNotFoundException {
HashMap<String, String> lookupMap = new HashMap<String, String>();
          tcResultSet resultLookupHashMap = lookupOperationsIntf
                    .getLookupValues(lookupCode);
          int countResultLookupHashMap = resultLookupHashMap.getRowCount();
if (countResultLookupHashMap > 0) {
               for (int i = 0; i < countResultLookupHashMap; i++) {
                    resultLookupHashMap.goToRow(i);
                    lookupMap.put(resultLookupHashMap..getStringValue("Lookup Definition.Lookup Code Information.Code Key"),
resultLookupHashMap.getStringValue("Lookup Definition.Lookup Code Information.Decode"));
return lookupMap;
}

Similar Messages

  • Need help in writing data from JSP to excel

    Hi ,
    I need help in writing the data from JSP to excel.I somehow able to retrieve the data into excel but unable to get the required format.
    For eg: The amount should be displayed in 0.00 format .when i am exporting it to excel it is displaying as 0 :( .
    I am using the following code in JSP.
    "out.print(amt + '\t');"
    Would like to know if there is any otherway where in i can get my requirement.
    Thanks
    Tom

    Hi,
    Try using format part of the JSTL tag libs.
    Syntax :
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
    <fmt:formatNumber value="40" pattern="$#,##0.00"/>
    I need help in writing the data from JSP to excel.I
    somehow able to retrieve the data into excelHow do u convert the jsp to excel?
    One way to convert the jsp page to excel, is to render it as an excel appl instead of html. Set the content type of the response to application/ms-excel.
    response.setContentType("application/ms-excel")Hope this Helps....

  • Need help for writing extract program

    hi
    i need help for writing extract program to retriew data from legacy system.
    i already developed bdc programs for me31k and me21.
    my requirement is to write extract program s for those t.codes.
    to retriew data from legacy system and stored in flat file.

    i need help with a java program. it is a program that allows the user to enter a student's GPA, number of extracurricular activities, and number of service activities. The user can not enter a gpa above 4.0 or below 0. The user can not enter a negative number for the number of both activities. If the student meets the following criteria: 1) GPA of 3.8 or above and at least one extracurricular activity and one service activity, 2) GPA below 3.8 but at least 3.4 and a total of at least three extracurricular and service activities, 3) GPA below 3.4 but at least 3.0 and at least two extracurricular activities and three service activities, the message "Scholarship candidate" should display. If the student does not meet the criteria above, then the message"not a candidate" should display. Can you help me, please?
    You haven't posted ANY 'java program' for us to help with.
    The forum is NOT a coding service. It is to help you with YOUR code.
    Post the code you have written and SHOW us (don't just tell us) how you compile it and execute it and the results you get. Then we can help you with any problems you are are having.
    If you need help understanding just what the program should be doing you need to ask your instructor to clarify the assignment.

  • Hi I need this asap... "Java code to generate XML File from XML Schema"

    Hi all....
    I need this asap... "Java code to generate XML File from XML Schema i.e XML Schema Definition, XSD file".
    Thankz in advance...
    PS: I already posted in the afternoon... this is the second posting.

    take look at :
    http://sourceforge.net/projects/jaxme/
    this might help...

  • Need to track windows processes through java code.

    Need to track windows processes through java code.
    Eg: I want to find out whether an exe file (wrun.exe) is running or stopped.
    Can I do it through java. If so can any one please tell me how to do it. That will be a great help.
    Thanks,
    Ramesh

    There are 2 options for things like this:
    1) Use Runtime.exec() to execute some command or application and parse the input from it.
    2) Write some native code and use JNI to call it.

  • NEED HELP TO SET UP SMALL NETWORK - WIRELESS SIGNAL FROM NOVATEL U760 USB

    Hello -
    I need help setting up a small network in my new home in Florida, which has no wired broadband capability - not cable, not dsl. My options are satellite (which I'd like to avoid) or wireless broadband via Millenicom (or now Virgin Mobile) using their Novatel U760 USB stick.
    Here are the network components - someone please tell me how to set this up:
    PC #1 (has wireless card, but I've connected it by ethernet to the router)
    PC #2 (no wireless card; connected via ethernet to router)
    MACBOOK, 1 1/2 years old (2.1 GHz Intel Core 2 Duo, 4 gigs RAM), running OS 10.58, connected wirelessly to router.
    AIRPORT EXTREME BASE STATION, Model A1143.
    I'm not thrilled about using a wireless 3G signal as my primary one, (sprint network, claims 600 - 1400 kbps speed), but it costs 1/2 to 1/3 of what a slightly faster satellite signal would.
    I have not ordered this service yet. Before I do, I'd like a clear understanding that I can, in fact, set up my simple network, which I'd probably do the same as it's now configured with cable broadband - both PC's plug via
    ethernet into the Airport Extreme router, the MacBook connects wirelessly - AND,
    my question is this:
    Can I plug the wireless card - a Novatel U760 USB-stick device - straight into that USB slot in the Airport Extreme base station and will it automatically recognize that device?
    Or, do I have to plug it into the MacBook and somehow share that wireless signal between the 2 PC's (only 1 of which has a wireless card, so I'd have to get a card for PC #2)?
    And help anyone can provide will be much appreciated!
    Thanks,
    Em

    from the Airport FAQ #14:
    "Question: Can I connect my Soundsticks or other USB speakers to AirPort Express?
    Answer: No. The USB port is for connecting a printer, not for other devices."
    Im assuming other devices include USB modems.
    So, I would say your cheaper route would be to get a second wireless card and just share your internet connection from one of your PC.

  • Need Help in writing a UDF

    Hi,
    Please help in writing a UDF for these fields in mapping, which I need for the object Iu2019m doing currently.
    The fields are like this:
    1)         batch_no = "TRUNC((GetMaxObjid('x_txn_sap_parts')-POWER(2,28))/5000)+1",
    2)         lot_id = "TRUNC((GetMaxObjid('x_txn_sap_parts')-POWER(2,28))/500)+1",
    3)        How to use JDBC connection factory class in the UDF.
    Some logic I can provide which I know i.e. Power (2, 28) means 2 to the power of 28 (2 multiplied 28 times), Trunc means truncate, X_TXN_SAP_Parts is a database table.The Target fields are Batch_no, lot_id & Objid.Actually, objid is mapped initially to a source field i.e. Object ID and in this function it is only being used for the calculation of the batch_no.
    Thanks in Advance,
    Sreedhar.

    Hi,
    Following with my query I've tried to use this code but still I'm unable to execute the mapping.
    import java.util.*;
    import com.sap.aii.mapping.lookup.*;
    import com.sap.aii.mapping.lookup.*;
    DataBaseAccessor accessor = null;
    DataBaseResult JDBCOutPayload = null;
    String BusinessSystem="clarify_dev_bizsys";
    //give your business system having channel name
    String CommunicationChannel="JDBC_TO_CDEV";
    //give your channel name
    String InputPayload= " select X_TXN_PRE_SITE_XFACE.nextval from dual;";
    //give your sql query
    try {
    Channel channel =
    LookupService.getChannel(BusinessSystem,CommunicationChannel);
    accessor = LookupService.getDataBaseAccessor(channel);     
    DataBaseResult resultSet = accessor.execute(InputPayload);
         for(Iterator rows = resultSet.getRows();rows.hasNext();){  
         Map rowMap = (Map)rows.next();
         Object cValue = rowMap.get("batchno");
    //field name of field required , as in database
          catch (Exception e) {}
          finally {
                  if (accessor != null)
                  accessor.close();
           result.addValue((String)cValue);
    --> I don't know what are the parameters to be used and how to be used in the UDF because this is the first time I'm writing a UDF.
    --> The problem in using this query is that both OBJID & BatchNo. are on the target side and the value for the OBJID is retrieved by a SELECT query from the database.
    Kindly help me how to resolve this query of mine.
    Thanks in Advance.
    Sreedhar.

  • Need Help on writing Update Routines

    Hi BW Experts,
    I have a requirement to display data from Header and item datasource.From item datasource, i need to pull only 0MATERIAL.The Common fields for this datasource is service order number. I just want to pull 0MATERIAL from item datasource.So i am planning to write a routine to lookup the data from item datasource. But i have a small query on writing the Code.
    Suppose if i write the code in Update Rules for header datsource and pulling the data for (LOOKUP of 0MATERIAL) 0material from Item datasource.Seems for One Service Order there are 5 to 6 materials. While writing the routine, how can i pull 5 materials to header datasource.
    In Update rules, we are moving to RESULT. How can i pull 5 materials.
    Can u pls help on this with the sample Code.
    Thanks
    Jelina

    Hi
    Re: Flat file extraction
    Re: how to look up master data in update rule
    Hope it helps

  • Need help in writing the script in windows to read the file at runtime

    Hi All,
    I need a help with a Script. I need to read a filename from a directorty based on a specific format. I will be looking for the file in a directory that will have a file added to it each month. The script will need to go out to that directory determine the current month and Year and then grab that file based on the MONTHYEAR contained itn the file name and
    in the same script pass the filename to SQL Loader.
    The filename will consist of three parts VARIABLECONSTANTDATE.ext (example: FUELFILE11262007.txt: FUEL is a VARIABLE, FILE is constant, 11 two digit month, 26 two digit day,2007 four digit year.)
    I am stuck as how to how to read that into a string, find the file name and then pass that to sql loader.
    Any help much appreciated..
    Looking forward for your response.

    Use of External Tables will ease your problem...
    Here's what you can do:
    1. Create External tables (fuelfile.asc)
    2. Use Java code to read all filenames in a particular directory and store them in table
    3. Use PL/SQL block to loop through each filename in the table and write the file to the file of external table (fuelfile.asc)
    3.1 Transfer data from External table to main table
    Aalap Sharma :)

  • Groups of small java codes

    Can any one help me where i will get very small java examples or codes to understand basic java api. Thank you very much for you help.

    http://javaboutique.internet.com/
    when i first started i found this site a immense help
    since i am one of those people who learn by doing
    not by falling asleep reading big articles and long winded books.
    thier is tutorials and stuff all over this site with small tutorials.
    best of all tons of programs and code for it that you can copy and paste or download in a zip file

  • Can anybody help on sending mail through Java Code

    I am trying to send the mail using the java code and I am unable to do it. My code is
    import java.io.*;
    import java.net.*;
    import java.util.*;
    import java.text.*;
    public class EmailExample {
    public static void main(String[] args)
    Socket smtpSocket;
    DataOutputStream os;
    BufferedReader is;
    Date dDate = new Date();
    DateFormat dFormat = DateFormat.getDateInstance(DateFormat.FULL,Locale.US);
    try
    smtpSocket = new Socket("www.gmail.com",80);
    os = new DataOutputStream(smtpSocket.getOutputStream());
    is = new BufferedReader(new InputStreamReader(smtpSocket.getInputStream()));
    System.out.println("Hi How is this?");
    os.writeBytes("HELLO\r\n");
    // You will add the email address that the server
    // you are using know you as.
    os.writeBytes("MAIL From: <[email protected]>\r\n");
    // Who the email is going to.
    os.writeBytes("RCPT To: <[email protected]>\r\n");
    //IF you want to send a CC then you will have to add this
    //os.writeBytes("RCPT Cc: <[email protected]>\r\n");
    // Now we are ready to add the message and the
    // header of the email to be sent out.
    os.writeBytes("DATA\r\n");
    os.writeBytes("X-Mailer: Via Java\r\n");
    os.writeBytes("DATE: " + dFormat.format(dDate) + "\r\n");
    System.out.println("DATE: " + dFormat.format(dDate) + "\r\n");
    os.writeBytes("From: Me <[email protected]>\r\n");
    os.writeBytes("To: YOU <[email protected]>\r\n");
    //Again if you want to send a CC then add this.
    //os.writeBytes("Cc: CCDUDE <[email protected]>\r\n");
    //Here you can now add a BCC to the message as well
    //os.writeBytes("RCPT Bcc: BCCDude<[email protected]>\r\n");
    String sMessage = "Your subjectline here";
    os.writeBytes("Subject: Your subjectline here\r\n");
    os.writeBytes(sMessage + "\r\n");
    os.writeBytes("\r\n.\r\n");
    os.writeBytes("QUIT\r\n");
    // Now send the email off and check the server reply.
    // Was an OK is reached you are complete.
    String responseline;
    while((responseline = is.readLine())!=null)
    {   System.out.println(responseline);
    if(responseline.indexOf("Ok") != -1)
    break;
    } catch (IOException e) {
    e.printStackTrace();
    It is compiling and runnung properly. Please Help me on this.
    Thanks.
    Satya.

    You're mishandling the responses. You terminate if you don't get an "Ok" string, but that's not how success is defined - you should get a 200 code back, typically with an "OK" (not caps) message.
    It doesn't help that you're ignoring all of the server output after each command, so you never find out if anything goes wrong.
    You're also reinventing a wheel. The JavaMail API exists for this: http://java.sun.com/products/javamail/

  • Need help with writing a query with dynamic FROM clause

    Hi Folks,
    I need help with an query that should generate the "FROM" clause dynamically.
    My main query is as follows
    select DT_SKEY, count(*)
    from *???*
    where DT_SKEY between 20110601 and 20110719
    group by DT_SKEY
    having count(*) = 0
    order by 1; The "from" clause of the above query should be generated as below
    select 'Schema_Name'||'.'||TABLE_NAME
    from dba_tables
    where OWNER = 'Schema_Name'Simply sticking the later query in the first query does not work.
    Any pointers will be appreciated.
    Thanks
    rogers42

    Hi,
    rogers42 wrote:
    Hi Folks,
    I need help with an query that should generate the "FROM" clause dynamically.
    My main query is as follows
    select DT_SKEY, count(*)
    from *???*
    where DT_SKEY between 20110601 and 20110719
    group by DT_SKEY
    having count(*) = 0
    order by 1; The "from" clause of the above query should be generated as below
    select 'Schema_Name'||'.'||TABLE_NAME
    from dba_tables
    where OWNER = 'Schema_Name'
    Remember that anything inside quotes is case-sensitive. Is the owner really "Schema_Name" with a capital S and a capital N, and 8 lower-case letters?
    Simply sticking the later query in the first query does not work.Right; the table name must be given when you compile the query. It's not an expression that you can generate in the query itself.
    Any pointers will be appreciated.In SQL*Plus, you can do something like the query bleow.
    Say you want to count the rows in scott.emp, but you're not certain that the name is emp; it could be emp_2011 or emp_august, or anything else that starts with e. (And the name could change every day, so you can't just look it up now and hard-code it in a query that you want to run in the future.)
    Typically, how dynamic SQL works is that some code (such as a preliminary query) gets some of the information you need to write the query first, and you use that information in a SQL statement that is compiled and run after that. For example:
    -- Preliminary Query:
    COLUMN     my_table_name_col     NEW_VALUE my_table_name
    SELECT     table_name     AS my_table_name_col
    FROM     all_tables
    WHERE     owner          = 'SCOTT'
    AND     table_name     LIKE 'E%';
    -- Main Query:
    SELECT     COUNT (*)     AS cnt
    FROM     scott.&my_table_name
    ;This assumes that the preliminary query will find exactly one row; that is, it assumes that SCOTT has exactly one table whose name starts with E. Could you have 0 tables in the schema, or more than 1? If so, what results would you want? Give a concrete example, preferably suing commonly available tables (like those in the SCOTT schema) so that the poepl who want to help you can re-create the problem and test their ideas.
    Edited by: Frank Kulash on Aug 11, 2011 2:30 PM

  • Need helping in writing query for finding percentage of duration

    Can any one please help in writing query for this.
    The table is like this :-
    ID     Region     Month     Duration
    I1 R1     Jan     80
    I2     R2     Jan     70
    I3     R1     Jan     70
    I4     R3     Jan     40
    I5     R1     Feb     80
    I6     R2     Feb     30
    I7     R3     Mar     100
    I want to write a query to find
    % of duration for each and every region against each and every month.
    Please help in solving this query. I am in urgent need of this.
    Thanks in advance.

    I also have to do in MS Access 2003You also have to ask into an other forum since here it's an Oracle forum, to try to find Oracle solution.
    Nicolas.

  • I need help for printing service in Java

    Hello :
    I need to print some file from java program .
    I did every thing , but when i run the program : it didn't return any printer as print service from the system, although I install 2 printers in my system.
    by the way : i use Windows XP

    I was in a rush this morning and forgot my crystal ball. Please post your code and remember to use the code tags.

  • Need help in writing coding in HTML?

    HI All
    I have requirement like this.
    1st RFC i pass Plant and i will get trasportation point.
    in display template i need to display trasportation point in dropdown box and user will select the trasportation point and iam passing this trasportation  to aother RFC and gettting shipment cost.
    i need help in how to write coding in .IRPT
    i created the transactions for both the RFC and its working fine.First RFC iam getting trasportaion point ...i created Xecute query.
    I need how to display !st one in dropdown box and pass that data into 2nd RFC.
    Regards,
    Phani

    Phani,
    You have to use the iBrowser displaytemplate.
    Map the transportion point Xacute qquery in iBrowser displaytemplate.
    In code use : 
    document.APP1.getBrowserObject().getSelectedItem();
    Store the value of above code in a variable.
    And pass this variable in other appalet which displays the R/3 details as below:
    document.APP2.getQueryObject().setParam(1,var);
    document.APP2.refresh();
    -Suresh

Maybe you are looking for

  • Error when attaching workflows to Sharepoint 2010 lists

    Hi, I am getting an error when trying to attach an approval workflow to any SharePoint 2010 list on my development server. From the below error in the log I remember that I got this same error in Sharepoint 2007 MOSS. It occurs because I have undersc

  • BT COMPLAINT HELP Re: Lack of Customer Service/ In...

    Hi all, I havent posted for a while as ive been ill, but am hoping someone may be able to help... I had been a customer of BT for around 3 years (All 3 services Broadband-Option 1, Vision Unlimited TV package, Free eve & weekend calls/line rental). U

  • How to Silence ICS Built-In Screen Capture?

    I just learned from reading in a forum that ICS on the Bionic comes with the ability to screen capture, which is very useful for backing up my home screens in case of a FDR.  To do this, press Volume Down and Power button at the same time and hold mo

  • I lost my bookmarks when I re-installed Firefox - how do I get them back?

    For a couple of month ago Firefox did'nt work at all - so I re-installed it and then I lost all my previous bookmarks. I miss them and I don't know how to get them back.

  • ITunes Connect : "There was a problem processing your upload"

    Hello. Anyone got this message while uploading your application? I got that once and then I tried right away to upload my app, and it succeeded. My upload was only about 8-9MB. Anyone else experienced this or your app uploaded just fine the first tim