Assign hexadecimal value to an Integer variable preceding with zero

hi
i need to pass an hexadecimal value, preceding with zero (0).
like 0775
the above hexadecimal value should be assigned to an integer variable. While i am trying to assign it, the output could be truncate the preceding zero value. Is it possible to do my requirement without truncating the preceding zero.?
Edited by: sasi on Jul 23, 2012 7:09 PM

I agree on that, this can not be carried out the way you explained.
Either you store the hexadecimal value as a string, and convert it before arithmetic operations:
int number = Integer.parseInt("0775", 16);
Or you store it as an integer (no leading zero) and convert it to string as you display it:
int number = 0x0775;
System.out.printf("%1$04x", number);

Similar Messages

  • Assigning a value to a substitute variable

    Hi, I would like to know if it is possible to assign a value to a substitute variable.
    This is what I'm doing:
    - Prompting user for input
    ACCEPT uom CHAR PROMPT 'Enter number of UOM system you would like: ' DEF '0'
    (displayed list of options are numbers 0-5)
    - Based on input, open corresponding file
    (start i:\utc\all\oracle\uom\uom_column_heading_&&uom..sql)
    Problem:
    - Default selection is 0, meaning use the CURRENT UOM system (a number, 1-5)
    - That being said, &&uom must be assigned a 1-5 value in order to open the file that corresponds to the CURRENT UOM system
    Let me know if any additional information is needed.
    Thanks!

    I apologize for the format. I tried to make it more legible, but was not able to. FYI: It appears to be easier to read in "Edit" view.
    Thanks, I tried the &&uom := your_function(); suggestion, but I am getting an error. It looks like the "value" of &&uom is being read in the assignment statement, not the variable name.
    I have copied the piece of the code, for your reference.
    ACCEPT uom CHAR PROMPT 'Enter number of UOM system you would like: ' DEF '0'
    DECLARE
    v_uom_sys_selection NUMBER;
    v_curr_uom_sys VARCHAR2 (50);
    v_uom_num NUMBER;
    BEGIN
    v_uom_sys_selection := to_number(&uom);
    v_curr_uom_sys := EG.GET_CURRENT_UOM();
    v_uom_num := eg.get_user_selected_uomnum(v_curr_uom_sys);
    &&uom := to_char(v_uom_num);
    dbms_output.put_line('v_uom_num = ' || v_uom_num);
    dbms_output.put_line('&&uom = ' || &&uom);
    END;
    --prompt "&&uom"
    start i:\utc\all\oracle\uom\uom_column_heading_&&uom..sql
    Below are the results I get when commenting out the &&uom := to_char(v_uom_num); line. NOTE: the "value" of &&uom = 0.
    v_uom_num = 1
    0 = 0
    If I leave that line in, I get the following error:
    PLS-00103: Encountered the symbol "0" when expecting one of the following:
    begin case declare end exit for goto if loop mod null pragma
    raise return select update while with <an identifier>
    <a double-quoted delimited-identifier> <a bind variable> <<
    close current delete fetch lock insert open rollback
    savepoint set sql execute commit forall merge pipe
    The symbol "<an identifier> was inserted before "0" to continue.
    Message was edited by:
    user449676

  • I want to assign the value of a Javascript variable to JSP Variable

    I want to assign the value of a Javascript variable to JSP Variable .. for example :
    <%
    Bla Bla Bla
    %>
    <script>
    var JavaScriptVariable="hello"
    </script>
    <%
    String JSPVariable=// The Value of JavaScriptVariable ;
    %>
    How can i do that ??
    Thanks

    >I want to assign the value of a Javascript variable to JSP Variable
    cannot be done.Friend try to understand concepts properly Javascript is always excuted by the browser @clientside where as JSPCode is executed Websever(ServletContainer) @serverside.Through you are combining JSP Code blocks(Tags,Expressions,scriptlets...) & javascript under a single page webserver can only identify what is their under JSP Code blocks.
    Hope this could be an appropriate answer for your question.
    However,you can as well submit a request by encoding your URL with request parameters and the submit to the page and then collect it using request.getParameter(name).
    But under a single context state it is not possible
    REGARDS,
    RaHuL

  • Assign a value to a global variable - form personalization

    Hi All,
    We have a requirement in which we want to display a message depending upon the out parameter of the procedure in form personalization.
    We are using 'Builtin' with the buitin type 'Execute a Procedure'.
    And the argument passed is :
    *='declare
    l_request_id Number;
    l_out_come VARCHAR2(10);
    begin
    apps.xx_sr_email_pkg1.xx_sr_email_p1
    ('''||${GLOBAL.XX_CUST_ACCOUNT_ID.VALUE}||''',
    '''||${GLOBAL.XX_INCIDENT_ID.VALUE}||''',
    '''||${GLOBAL.XX_EMAIL_TYPE.VALUE}||''',l_request_id);
    :GLOBAL.XX_REQUEST_ID := l_request_id;
    end'*
    But its not assigning the value of l_request_id to the gloabal variable XX_REQUEST_ID.
    Can you please help?
    Thanks

    I don't have a solution but a work around.
    What if you create a function that accepts the same in parameters and returns the message.
    And then you create an action of the type message and in the message you call the function such as
    = select xx_sr_email_pkg1.sr_email_f1 .... from dual
    Sandeep Gandhi

  • How to assign bean value to a local variable in JSP using struts.

    Hi everybody!
    I've a problem that puzzled me on how to assign a bean value to a local variable like String in JSP using struts.
    we can have someting like this to display the value
    <bean:write name="detailService" property="status" />or
    <bean:define id="theStatus" name="detailService" property="status"/>
         This is country: <%=theStatus%>but an error occured when I tried like this:
    String currentStatus = "<bean:define id="theStatus" name="detailService" property="status"/>";
    or
    String currentStatus = "<bean:write name="detailService" property="status" />";Is there a way to do this?.....
    Any help pretty much appreciated

    Java != JSP.
    The <bean:define> and <bean:write> tags are custom tags meant to appear in the HTML section of a JSP file, as opposed to the scriptlet section. They actually get turned into java code as part of the translation process.
    The <bean:write> tag naturally just writes out what you tell it to.
    The <bean:define> tag defines a local variable, and gives it a value.
    this should do it.
    <bean:define id="theStatus" name="detailService" property="status" type="java.lang.String"/>
    <%
      String currentStatus = theStatus;
    %>With the advent of JSTL, you shouldn't really need to use scriptlet code anymore. Personally I am for 0% scriptlet code in any jsp I write.

  • How to assign a value to the page variable to enable partial page rendering

    This is part of my code:
    <bc4j:rootAppModuleScope name="App1"
    rendered="on@ctrl:page">
    Now, I want to change the value of "on@ctrl:page" to "true" after user click a button so that part of the page will be displayed. But how do I assign the value to "on@ctrl:page". I tried to put the followings in my even handler:
    <bc4j:setPageProperty name="on" value="true">
    <bc4j:parameter name="on" />
    </bc4j:setPageProperty>
    But it doesn't work. Could someone pls tell me how I should do it.
    Thanks a lot!
    Ling

    You should do is:
    in your event handle codes,you add the list:
    public static EventResult eventname(
    BajaContext context,
    Page page,
    PageEvent event) throws Throwable
    EventResult result = new EventResult(page);
    result.setProperty("on","true");//or "false"
    return result;
    then,
    change
    rendered="on@ctrl:page" -> data:rendered="on@ctrl:eventResult"
    also ,you should see the 5th part of 'UIX Developer's Help'

  • Assign j_user value to a java variable in umLogonPage.jsp

    Hi All
    I need to do some post processing immediately after login and require the user id for the same. So how do we acess the value in the user id field and assign it to a java variable in the umLogonPage.jsp..??
    Java specific forums claim that this is not possible directly and can be only done on submit function or through hidden fields in the form. Any ideas with regard to the form that is present in umLogonPage.jsp..??
    Thanks
    Deepak

    Hi,
    we use this for saving the login time of the user. There are few therads about creating a custom login module (for example: [Custom Login Module - how to go on |http://forums.sdn.sap.com/thread.jspa?threadID=357616]).
    We have created a login module which extends AbstractLoginModule, in login() method :
    public boolean login() throws LoginException  {
    Object option = g_sharedState.get("javax.security.auth.login.name");
    if (option != null && !option.equals(""))  {
      String l_userID = (String)option;
      IUserAccount l_account = UMFactory.getUserAccountFactory().getUserAccountByLogonId(l_userID);
      IUserAccount mutableAccount = accountFactory.getMutableUserAccount(account.getUniqueID());     
      l_mutAccount.setLastSuccessfulLogonDate(new Date());
      l_mutAccount.commit();
    about login modules and login stacks start here: [http://help.sap.com/saphelp_nw04/helpdata/en/8c/f03541c6afd92be10000000a1550b0/frameset.htm|http://help.sap.com/saphelp_nw04/helpdata/en/8c/f03541c6afd92be10000000a1550b0/frameset.htm]
    Hope this helps,
    Romano

  • Assigning date value to a date variable

    Hi,
    How can I hard code a date (09/22/2006) in a date variable?  Help me out.
    Thank you.
    Regards,
    Dhana

    Hi,
    it depends if your input is already parsed and how you want to set the time (hours, etc.).
    Two sample ways :
            String s = "09/22/2006";
            SimpleDateFormat sd = new SimpleDateFormat("MM/dd/yyyy");
            Date date1 = sd.parse(s);
            Calendar c = Calendar.getInstance();
            c.set(2006, 8, 22); //month is zero based
            Date date2 = c.getTime();
    Btw for basic java programming I would suggest searching for some java tutorials on the net and reading on your own instead of posting in forums. At least for me that is better way to learn.
    HTH
    Peter

  • Variable preceded with exclamation mark

    A colleague of mine just noticed something that I have never seen before and can't see the purpose of - preceding a variable with !.
    DATA:
      mydate TYPE d.
    mydate = sy-datum.
    ADD 1 TO !mydate.
    WRITE: mydate, !mydate.
    The memory reference is identical, changing MYDATE changes !MYDATE too.  Works for internal tables too.
    Odd.
    Scott

    Hi Christian,
    from my point of view, you are perfectly right.
    One should try not to use "reserved ABAP words" at all(even if ABAP doesn't have "reserved words" in a technical sense9. And to be perfectly sure to do so, one must follow some naming conventions because you can never be sure that a unprefixed word, that is not an ABAP word today, will not become an ABAP word in a future release.
    But this is my personal opinion. Officialy, ABAP does not enforce naming conventions and names that are equal to ABAP words are allowed. In some cases like
    DATA i TYPE i.
    this can be okay (different namespaces for types and data objects). But other declarations that lead to  syntactically correct statements like
    READ TABLE TABLE WITH TABLE KEY TABLE = TABLE.
    should of course be avoided, even if you do not have to use the escape symbol!
    So, it is the developers own responsibility to keep his or her source code readable. Naming conventions can be a great help, but are no necessity. But in fact there should never be a situation, where you use names that force you to use the escape symbol (introducing ! into above READ TABLE statment is not mandatory but would make it more readable).
    Regards
    Horst

  • Assigning values to a javascript variable

    Hi,
    Using request dispatcher, i'm forwarding the control to a html from a servlet like this(obj.forward(/index.html?field1=value1&field2=value2).
    In the receiving end, ie., in the html i would like to assign those 2 field1,field2 values to a javascript variables. Javascript located in the index.html.
    I don't know how to do this.
    Pls any one help me to get of this pblm
    Thanks in Advance
    Kannan.T

    Hi thanks for ur reply,
    You r telling while forwarding a request from one
    servlet to another servlet, we can't add query
    string(requestparameters). But then how come this
    code is working?
    RequestDispatcher
    rdis=getServletContext().getRequestDispatcher("/MyServ
    let?type=normal");
    rdis.forward(req,res);Well I owe an apology here - I was not completely correct. I have tested and found that you can indeed add parameters that way. The catch is that these parameters are nested to that forwarded /included resource. It is not available in the original jsp or to some other resource included from the original jsp unless ofcourse you add the parameter again.
    >
    please give me a solution.
    Like this i have to forward my request (with
    querystring) to a html page.
    That htmlpage should receive parameters and assign
    the values to a javascript variables.
    how can i achieve this.
    thanks in advance.My original reply stands.
    You cannot do that in a html page. You have to have a jsp that generates the html.
    ram.

  • How to assign a value to ODI Variable using ODI Procedure

    Hi ,
    Is it possible to assign a value to a ODI Variable using ODI Procedure ?
    If it is possible how we can do that.
    BEGIN
    IF #Counter=1
    Then
    #Next_Increment:=#Counter+1;
    End if;
    END;
    In my example I have 2 ODI Variables #counter and #Next_increment.
    I am trying to assign VALUE TO A ODI VARIABLE #next_increment from another ODI Variable #counter.
    thanks
    prasanna

    Prasanna,
    I have a similar requirement where I need to assign values to ODI variables within a procedure. How do we make use of an ODI package to accomplish this ?
    Actually, I have a sequence of ODI steps, and there is a call to a procedure 'LOG ERROR' from every step which gets called in case error occurs in any step. I just need to identify from which step the error came.
    Please help.

  • Can I Access the Value of a Global Variable in a Trigger

    I'm using a Global variable in a Package which i use in the BIU Trigger to populate a column. After assigning the value for that global variable, I run an INSERT in the same package. But I find only the default value of the Global variable populated in the column. Can I use a Global Variable in a Trigger? Is there any way to put in a common value across all the tables in an application for all DMLs of a particular session?

    Helios,
    I'm already having the same setup mentioned in the thread. And I'm doing exactly whats given there. But the issue seems to be something different. I'm assigning the value to the Global Variable in the Package through Apex. Here's the Package Code:
    CREATE OR REPLACE PACKAGE Schema1.SPMS_SECURITY_PKG
    AS
    X_app_user_id NUMBER DEFAULT -1;
    FUNCTION USER_ID RETURN NUMBER;
    END SPMS_SECURITY_PKG;
    CREATE OR REPLACE PACKAGE BODY Schema1.spms_security_pkg
    AS
    FUNCTION user_id
    RETURN NUMBER
    IS
    BEGIN
    -- RAISE_APPLICATION_ERROR(-20001,'USER ID'||'*'||X_app_user_id);
    RETURN NVL (x_app_user_id, -1);
    -- RETURN NVL (sys_context('USERENV', 'CURRENT_USER'), -1);
    EXCEPTION
    WHEN OTHERS
    THEN
    RETURN -1;
    END;
    And Here is the Trigger Code:
    CREATE OR REPLACE TRIGGER Schema1."USER_DETAILS_TRIGGER"
    BEFORE INSERT OR UPDATE
    ON PMS_SICAL.SPMS_USER_DETAILS REFERENCING NEW AS NEW OLD AS OLD
    FOR EACH ROW
    BEGIN
    IF INSERTING
    THEN
    :NEW.created_by := spms_security_pkg.user_id;
    :NEW.created_date := SYSDATE;
    :NEW.START_DATE := SYSDATE;
    ELSIF UPDATING
    THEN
    :NEW.updated_by := SPMS_SECURITY_PKG.X_app_user_id;--spms_security_pkg.user_id;
    :NEW.updated_date := SYSDATE;
    END IF;
    END;
    But I always get -1 in the both in the table after the DMLs.

  • PL/SQL Function call error while reading or assigning returned value

    Hi,
    I am getting the following error while tryih to read the value of the PL/SQL Function. I am calling a function in one of my PL/SQL Packages passing mutliple IN parametes and the function returns some value back. Now on BPEL side when I try to read the return value I am getting an error:
    *<summary>*
    empty variable/expression result.
    xpath variable/expression expression "/ns3:OutputParameters/ns3:TEST_FUNCTION" is empty at line 124, when attempting reading/copying it.
    Please make sure the variable/expression result "/ns3:OutputParameters/ns3:TEST_FUNCTION" is not empty.
    *</summary>*
    Even though in the console when I check the Invoke Output Parameter it does shows me a valid value being retuned by a Function but when I am trying to Assgn this value to some variable using Assign Activity I get the above error.
    Even though all goes fine but looks like I am not able to read or assign the value returned from the Function.
    So just wondering if this even works as to me I have a very simple example and that seems not to work. Function is called successfully and is returning the value as I can see it in the BPEL console but when tryin to read or assign that value to some other variable I get the above error.
    Any ideas?
    Thanks

    This issue has come up a lot. The problem is with a mismatch between the version of JDeveloper and SOA. You'll encounter namespace issues if you use 10.1.3.1 in combination with 10.1.3.3 (or 10.1.3.4). You MUST synchronize both JDev and SOA to 10.1.3.3 or 10.1.3.4 (mixing 10.1.3.3 and 10.1.3.4 is OK). We changed when going to 10.1.3.3 by adding elementFormDefault="qualified" to the generated XSD. We used the default "unqualified" in 10.1.3.1. So you'll encounter namespace issues unless you're using 10.1.3.3 or higher JDev AND SOA. The fact that I see &lt;*db:*...&gt; tells me that you're using 10.1.3.1 JDeveloper. The correct solution is to upgrade your components.

  • How to Display WBS's with Zero values in a report created by CJE2

    Hi All,
    I have created a report using CJE1 (Report painter). When I execute the report, it only shows WBS that have values. How do I display WBS elements that do NOT have values? i.e. display items with zero values. I'm certain there is a setting either within report painter or forms...
    Help appreciated.
    Samir

    Menu>Formatting>Report Layout and then tab Rows. Check if setting under 'Treatment of zero rows' helps.
    Regards
    Sreenivas

  • Error while assigning a character value to a numeric variable.

    I fire a sql statement and check the number of rows returned by the sql.
    I check this result with the application logs.
    The application logs keeps the sqls fired by the application and the no of rows returned, in the example below the sql returned 8454 rows.
    My script compares the two results.
    ***********Application Log***********
    4/14/2008 11:15:01 AM: 0059 SQL SELECT "CLUSTER_CD",
    4/14/2008 11:15:01 AM: 0060 "PRODUCT_DESC",
    4/14/2008 11:15:01 AM: 0061 "TEAM_CD"
    4/14/2008 11:15:01 AM: 0062 FROM "OPS$TMS"."MAP_CLUSTER_TEAM_PROD"
    4/14/2008 11:15:01 AM:      3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD, 8,454 lines fetched
    ***********Application Log***********
    My script:
    #!/bin/ksh
    typeset -i resA
    typeset -i resB
    opstms_conn_string="abc/[email protected]"
    set `sqlplus -s $opstms_conn_string << EOF
    set pages 0
    WHENEVER SQLERROR CONTINUE
    SELECT count(*)
    FROM MAP_CLUSTER_TEAM_PROD;
    exit
    EOF`
    resA=$1 ##returns 8454
    resB=`grep '3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD,' BCVP_Main_Loader.qvw.log | awk '{print $10}'`
    ##resB returns 8,454
    ## here i get syntax error
    if [ $resA -eq $resB ]; then
    echo "QA passed for sql1"
    else
    echo "QA failed for sql1"
    fi
    The problem is as resB is integer variable it does not accept character value: 8,454 so returns a syntax error:
    How do I change the value assigned to resB into a numeric variable?
    error:
    + grep 3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD, BCVP_Main_Loader.qvw.log
    run.ksh[52]: 8,454: syntax error

    Change:
    resB=`grep '3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD,' BCVP_Main_Loader.qvw.log | awk '{print $10}'`
    to this:
    resB=`grep '3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD,' BCVP_Main_Loader.qvw.log | awk '{print $10}' | tr -d ,`
    to drop the comma. Or you could do it in awk(1):
    resB=`grep '3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD,' BCVP_Main_Loader.qvw.log | awk '{ gsub( /,/, "", $10 ); print $10}'`
    Or you could to it all in awk(1):
    resB=`awk '
    /3 fields found: CLUSTER_CD, PRODUCT_DESC, TEAM_CD/ {
    gsub( /,/, "", $10 )
    print $10
    ' BCVP_Main_Loader.qvw.log`
    (This example was not tested, it's just for a model.)
    Someone more of an SQL guru than I can probably tell you how to change your numeric locale to avoid presenting those commas in the first place and avoid the problem.
    HTH

Maybe you are looking for

  • Purchase Price Variance (Standard Costing) with Intercompany

    We are missing Intercompany transactions in Purchase price variance report. Is there a setup which let's us include these transactions to be captured by PPV report We do have standard costing in all Organizations

  • Configure PHP Server: Why Can't I Create a Folder in the Web Root?

    Hi, I'm trying to create a new Flex 3 app with PHP as the application server type. I'm running: Flex 3.2, MAMP, Zend, PHP on an iMac with OS X 10.5.8. Unfortunately, Flex won't let me validate my configuration. a) I created a folder in htdocs called

  • Problem adapter JDBC/Receiver

    Hello, I am running a stored procedure with CC JDBC/Receiver, and it returned me the following error: Message processing failed. Cause: com.sap.aii.af.ra.ms.api.RecoverableException: Error processing request in sax parser: Error when executing statem

  • Edited Theme through Eclipse doesn't have UR folder

    Hi All , I have edited a standard SAP theme through Eclipse tool . I have made some color changes in that and downloaded the theme . After checking the portal.zip folder ..... UR folder is missing in that theme , So how to do that one ? Please help m

  • Can i save to the mac side when i'm in windows?

    i just bought a MBP about a month ago. i installed windows xp and have been using both very effectively. i was wondering if i can save to the mac side when i'm logged in windows? i can see the windows partition when i'm in the mac side but how do i s