Character Field as Number, Need commas?

I move a quantity to a character field for a form display output. I left justify the character by shift character field left deleting leading spaces. This way it formats perfectly in the column on my report/form.
Is there any easy syntaxfunction module, etc.,  that will take char field 1000.0 and put inn a comma 1,000.0?
I don't want the value to shift back to the right (right-justify).
     Thank-You
Edited by: TMM on Jan 30, 2009 11:30 AM

Hi,
Ok..Please check this..
* Input character.
DATA: v_input   TYPE char20 VALUE '1000.0',
      v_output  TYPE char20,
      v_num     TYPE p DECIMALS 1.
* Move it to numeric variable.
v_num = v_input.
* Use the write statement to add the thousands separator.
WRITE v_num TO v_output.
* Make sure in the user settings the decimal notation is 1,234,567.89
* otherwise use this code.
SET COUNTRY 'US'.
WRITE v_num TO v_output.
SET COUNTRY space.
* Remove the leading spaze.
SHIFT v_output LEFT DELETING LEADING space.
* Display
WRITE:/ v_output.
Thanks
Naren

Similar Messages

  • Dashboard Prompt - Integer field (material number) - remove commas

    Hi all,
    We have a problem with one number field that added as a prompt in the dashboard. This is an integer field contains Material numbers shows commas and we need to remove commas. Problem is we cannot cast it because we need to keep it as ineteger field to sort the column. Please advise to correct this either repository area or in the dashboard prompt sql statment that applicable to an **integer** field to remove commas.
    Appreciate all your help!!
    Thanks,

    Thank You Svee. I have already tried override and treat number as number but that still showed the commas.
    What I was missing was clicking on save as the system-wide default. I never tried that before and this worked. I appreciate your help.

  • 7 character field to purchase order ,customer number

    please help
    1)
    data : kunnr1(7) type c.
    data : kunnr like kna1-kunnr.
    kunnr1 has only field length 7 and it is of type character.
    kunnr is a sap field.
    everytime i need to fill the data from the field kunnr1 to sap kunnr and pass to bdc .
    suppose kunnr1 = 1930903 ie 7 characters .
    and in sap shall i simply copy like this
    kunnr = kunnr1. " will this work
    or
    concatnate '000' kunnr1 to kunnr.
    or
    any other one .
    2)same with the purchase order number.
    data : po(7) type c.
    dat : bstdk type vbak-bstdk.
    po = asdefgr
    bsdtk = po
    or
    concatenate '' po to bsdtk.
    if i assign value from po to bsdtk will at end command will work on bstdk?
    example
    loop at itab into workarea.
    at last bsdtk." i need this to work so tell me how to assign the value from po to bsdtk
    endloop.

    i checked the customer number in sap system,
    in the sales order it is stored as 1277494
    i checked in vbak table and it is stored as 1277494and rest blank spaces.
    i checked in kna1 table , the same kunnr is stored as 0001277494.
    why is this difference?
    so i need to use the 'CONVERSION_EXIT_ALPHA_INPUT' for kunnr?
    I checked for po but that is stored as a charater format and no need to add the leading zeros, is that right?
    I used CONVERSION_EXIT_MATN1_INPUT for material do i need to use CONVERSION_EXIT_ALPHA_INPUT for material also?
    thank you for the solutions given.

  • Custom Search Help for the field Equipment number

    Hi,
    I have enchanced sales order transaction and included a field Equipment number(EQUI-EQUNR).
    Here after pressing F4(Search help) standard search help is display.
    I have a requirement wherein, the standard search help should not appear and a customised search where a specific Equipment category type values should appear in the search help.
    Ex. Field equipment  category (EQTYP).EQUNR(Equipment Number).
    Please let me know how to work for the customised search help.

    Hi,
    You need to create a customized search help.
    [Elementary Search Help - Structure|http://help.sap.com/saphelp_nw04/helpdata/EN/cf/21ee38446011d189700000e8322d00/content.htm]
    [Creating Elementary Search Helps|http://help.sap.com/saphelp_nw04/helpdata/EN/cf/21ee5f446011d189700000e8322d00/content.htm]
    Then you need to attach the search help to the screen field..
    [Assigning Search Helps to Screen Fields|http://help.sap.com/saphelp_nw04/helpdata/EN/cf/21ee93446011d189700000e8322d00/content.htm]
    [Hierarchy of Search Help Call|http://help.sap.com/saphelp_nw04/helpdata/EN/0b/32e9b798da11d295b800a0c929b3c3/content.htm]
    regards
    Nitesh

  • How to get a currency format for a character field

    for some specifix reason, we have a requirement to show character field (which results in value 633948) in the format $633,948
    how do i do this?
    if i do SELECT to_char(:c_1,'$999,999')) from dual;
    it gives me ora: 01722: invalid number error
    c_1 is a user parameter of data type character

    Try using TO_NUMBER first, as in something like:
    SQL> VARIABLE c_1 VARCHAR2(6)
    SQL> EXECUTE :c_1 := '633948';
    PL/SQL procedure successfully completed.
    SQL> SELECT TO_CHAR(TO_NUMBER(:c_1), '$999,999') FROM DUAL;
    TO_CHAR(T
    $633,948Hope this helps.

  • How to accomodate more than 255 characters in character field

    HI All
    i need to accomodate more than 255 characters in character field. How can i do that ?
    thanks in advance!!!

    Hi,
    You can try the following things:
    1. Use a datatype STRING and check it will work.
    2. In se11 transaction goto datatype and search for char* in data elements.
    You will find predefined data types ,you can make use of it.
    For eg. char2000,char3000,char4000 etc.
    Hope this will help.
    Regards,
    Nitin.

  • Sql injection character fields

    Is it true that with MSSQL in the background, character fields can't be used for sql injection?
    A)   One source says that in MSSQL single quotes are escaped into double quotes.
    B)   Another source says that " SQL injection (within ColdFusion apps) is really only an issue with non textual fields. If a text value is tampered with you'll end up with tampered text, but that text will all be part of the core string (within quotes) passed as a value, and will therefore not be executed as separate statements. Numbers, on the other hand, are not enclosed within quotes, and so extraneous text can be tampered "
    Questions about A):   How does escaping 's with "s help, by making string literals in MSSQL not valid?
                                    How could A) above be true when names like O'Mally are being stored with a single quote ?
    Questions about B)    Does it mean code like DELETE * FROM atable would just be stored as a string and not execute ?
                                    If so, is that accurate ?

    To actually answer your question's.
    A) A single quote in SQL is a comment.  To store a single quote as DATA one has to escape it by doubling it.  So to store O'Mally it would be passed as o''Mally.
    The simple SQL injection attack is to end a number value with a random value, that is followed with a ; to end the SQL statment and then another statement can be run, this is then followed by a single quote to comment out any other SQL in the original statement.  ColdFusion automatically escapes single quotes in text fields in most situations, so this is harder to do with text fields, but not impossible.

  • PDF form field calculation help needed

    I need to make some simple calculations on a pdf form and need some help.
    I have a form field for number of guests.
    A field for a set cost for various tickets (there are 3 levels of ticket prices) (I might not need this field).
    A subtotal of the guests attending and ticket price.
    A grand total of the subtotals.
    I can't figure out how to either put in a fixed cost in a form field or input a calculation so that the number of tickets is muliplied by a fixed number and gives me a subtotal.
    Thanks.

    Ok. I finally got the calculations to work. But..... when I save and open in Reader, they don't work. Go back to Pro, they don't work there now either. They also don't show up under the Set Field Order Calculations. To reset them, i have to erase the calculations, save, redo the calculations. Preview the form and everything works — calculations happen and i get a total.
    Adobe Reader usage rights are enabled.
    Why is this so hard?
    I found this thread http://forums.adobe.com/message/1152890#1152890 about it. Is this bug still going on since 2009?
    Ok. Apparently you have to enable reader rights after the form is done. It seems to work now. What a pain.

  • Field Tax Number 1 in VA01

    Hi I am using the BAPI sd_salesdocument_create to create sales orders and need to pass the field Tax Number 1 (STCD1) for the case of a customer CPD. I'm using the table EXTENSIONIN as follows but not recorded the field.
    EXTENSIONIN-STRUCTURE = 'VBPA3KOM'
    EXTENSIONIN-VALUEPART1 = '          00000010406707933'
    Thanks.

    hi dvalesp,
    Have you tried placing a breakpoint in SD_SALESDOCUMENT_CREATE at SE37?
    perform ms_move_extensionin tables extensionin
                                         sales_items_in
                                         sales_schedules_in
                                  using
                                         sales_header_in.
    This is in line 222-226 of the source code of the BAPI.
    Then check subroutine ms_move_extensionin of include program LVBAKF0C.
    * BAPI enhancement <b>for</b> CPD Customer Information <b>for</b> table VBPA3
          WHEN 'VBPA3KOM'.
            CATCH SYSTEM-EXCEPTIONS conversion_errors  = 1.
              MOVE extensionin+lv_length TO wa_vbpa3kom.
              APPEND wa_vbpa3kom TO ex_vbpa3kom.
            ENDCATCH.
        ENDCASE.
      ENDLOOP.
    try to check what is being transferred in the code "MOVE extensionin+lv_length TO wa_vbpa3kom." You may try to change the value of wa_vbpa3kom during debugging and continue the program to check if it works. If it works, that means all you have to change is the values inside extensionin.
    Regards,
    Paul

  • Quantity field moved to character field

    Hi,
    when I move a quantity field with decimals to a character field, and place that character field on my sapscript form, the comma that was in the quantity has now become a point. (0,128 has become 0.128)
    Is there a way to avoid that and keep the comma?
    thx.

    Hi There,
    when you debug if you see '.' in character field. then do this  way.
    if lv_char ca '.'
    replace ...<press f1>
    hope this helps.
    Reg

  • Character field in excel output exist some junk character's

    PlatForm :IBM630,PC
    Operation System:windows xp,windows 2003,AIX 5.3
    IAS version :10.1.2
    Language :Chinese
    When set desformat parameter equal to spreadsheet, character field in excel output exist some junk character's,
    and as excel output data gather volume,junk character's will more and more.
    But when I only get the record include junk character's,then the excel output will be ok.
    How can I do to solve the problem?
    Thanks in advance!
    lind
    Message was edited by:
    user565112

    PDF,RTF DESFORMAT is right,but users need spreadsheet desformat too.
    the characterset is unicode,and end signal of junk character is ?/SPAN>.
    When I get excel output include junk character,the same time get the junk character's record,and then get excel output only include the junk character's record,the excel output will be showed correctly,no junk characters.
    How to sovle the problem?
    thanks.
    Message was edited by:
    user565112

  • Add new field (Check number) in Txn FBL1N

    Hi SAP,
    Is there any way or configuration i need to do so that i can add new field (Check number) in vendor line item (Txn FBL1N)?
    Here the details of the field (Check number):
    Field name: CHECT
    Table name: PAYR
    Program name: SAPMFCHK
    Appreciate your help. I will give points who help me solve this problem.
    TQ
    Regards,
    Nazrul

    Hi,
    For that you Go through this below method.
    I tested this senario it is working properly.
    Go T.code  O7E4
    IMG > Financial A/cing > Accounts Receivable and Accounts Payable > Vendor Accounts > Line Items > Display Line Items > Define Line item without ALV>Choose Selection Fields
    Account type  K
    Insert Field Name whichever you want
    Save
    Next Go to the FBL1N.
    Select change layout button and select check number from
    Save the layout
    That is enough For that
    If Have any doubt regarding this feel free to ask
    May be this information is useful to you
    Regards
    Surya

  • Padding character fields with zeros

    Hello,
    I need to add zeros to the end of character fields TYPE C. I know i can use the conversion routines but that only works for numeric fields.
    Thanks

    Thanks for all the replies.
    STRLEN will give me the lenght of the field but i need the offset of the last chararcter.
    Your post gave me an idea though. I'm doing the following and it's working.
    value = 'Thank You          '.
    tmp    = '00000000000000'.
    FIND REGEX `\w[ [:space:] ][ [:space:] ]` IN value MATCH OFFSET moff.
    IF SY-SUBRC = 0.
       OVERLAY value+moff WITH tmp.
    ENDIF.
    The find looks for the last alphanumeric char and 2 spaces after it meaning the last alphanumeric char in the string.
    Thanks to all, i will reward as fairly as possible.

  • How to sort a character field with numbers and letters on the end

    I have an internal table with character field which has data like this after I sort it.  This is not what I expect from the sort.:
    13A
    15A
    29A
    30A
    31A
    33A
    123A
    125
    62 
    76 
    94A
    I expect this, which is sorted number first, then alpha.  Any ideas how to get this sort?:
    13A
    15A
    29A
    30A
    31A
    33A
    62 
    76 
    94A
    123A
    125

    Thanks for the suggestions.  After reading the suggestions and reviewing some other post threads, here's what I did to get the sort to work:
    Add a dash - to the end of any record that did not have an alphabet character at the end.  This way, all records have at least one non-numeric character at the end.  Then I overlayed zeros  '0000000'  over each record.  Then I sorted the table.  Afterwards, I removed the dashes and zeros.
    The long way around, but it worked for me.  Since the internal table is processed in memory, it doesn't add much overhead to the run time.

  • Display a number with commas

    Here's a way to display a number with commas. See attached
    code.
    I had searched here for help on how to do it, and couldn't
    find anything. So, then I wrote this. I'm a hack, self-taught
    coder, so there may be a more eloquent way, but this does
    work.

    Nice, I'm always happy to be humbled.
    One more point. If you're going ot use a return statement I
    like to keep it
    at the very end of the function. So, in a conditional
    statement, setting a
    local variable to the value to be returned allows you to
    return that local
    variable and always keep the return statement as the last
    line. It just
    saves a little searching around for returns in longer
    functions. Just a
    style choice not necessarily better.
    Craig Wollman
    Word of Mouth Productions
    phone 212 928 9581
    fax 212 928 9582
    159-00 Riverside Drive West #5H-70
    NY, NY 10032
    www.wordofmouthpros.com
    "duckets" <[email protected]> wrote in
    message
    news:[email protected]...
    >
    quote:
    Originally posted by:
    FasterPastor
    > I had searched here for help on how to do it, and
    couldn't find
    > anything.
    >
    > You should have asked! here's one I have had sitting
    around for a while.
    > (code
    > attached below). It handles lots of cases which the
    other handlers posted
    > so
    > far do not. Specifically:
    >
    > Negative numbers - input: -123456
    > - craig's: -,123,456
    > - dougs's: -,123,456
    > - mikes's: -,123,456
    > - duck's: -123,456
    >
    > Floating point numbers - input: pi
    > - craig's: 3
    > - dougs's: 3
    > - mikes's: 3.1,416
    > - duck's: 3.1416
    >
    > Numbers larger than the maxinteger - input: 149668992000
    > - craig's: -,654,863,360
    > - dougs's: -,654,863,360
    > - mikes's: 14,966,899,200,0.0,000
    > - duck's: 149,668,992,000
    >
    > Negative floats - input: -123456.7890
    > - craig's: -,123,457
    > - dougs's: -,123,457
    > - mikes's: -12,345,6.7,890
    > - duck's: -123,456.789
    >
    > Floats larger than the maxinteger - input:
    2233445566.7788
    > - craig's: -2,061,521,729
    > - dougs's: -2,061,521,729
    > - mikes's: 223,344,556,6.7,788
    > - duck's: 2,233,445,566.7788
    >
    > Yes.. the code is longer, but if you want to print
    something like the
    > distance
    > in meters to the sun, you need to handle floats
    properly!
    >
    > enjoy ;-)
    >
    > - Ben
    >
    >
    >
    > on stringNumber n
    >
    > outputString = ""
    > inputString = string(n)
    >
    > if inputString.char[1] = "-" then
    > negative = true
    > delete inputString.char[1]
    > else
    > negative = false
    > end if
    >
    > fraction = ""
    >
    > if inputString contains "e" then
    >
    > mantissa = inputString.char[1..(offset("e",
    inputString)-1)]
    > exponent = value(inputString.char[(offset("e",
    > inputString)+1)..inputString.length])
    >
    > decimalChar = mantissa.char[2]
    > mantissa = mantissa.char[1] &
    mantissa.char[3..mantissa.length]
    >
    > if mantissa.length < exponent+1 then
    > plainNumber = mantissa
    > repeat while plainNumber.length < exponent+1
    > put "0" after plainNumber
    > end repeat
    > else
    > plainNumber = mantissa.char[1..(exponent+1)]
    > fraction = mantissa.char[(exponent+2)..mantissa.length]
    > end if
    >
    > else
    >
    > if offset(".", inputString)>0 then
    > decimalChar = "."
    > end if
    > if offset(",", inputString)>0 then
    > decimalChar = ","
    > end if
    >
    > if offset(decimalChar, inputString)>0 then
    > plainNumber = inputString.char[1..(offset(decimalChar,
    > inputString)-1)]
    > fraction = inputString.char[(offset(decimalChar,
    > inputString)+1)..inputString.length]
    > else
    > plainNumber = inputString
    > fraction = ""
    > decimalChar = string(1.2).char[2]
    > end if
    >
    > end if
    >
    > if decimalChar = "." then
    > separatorChar = ","
    > else
    > separatorChar = "."
    > end if
    >
    >
    > repeat while plainNumber.char[1] = "0"
    > delete plainNumber.char[1]
    > end repeat
    >
    >
    > repeat while plainNumber.length > 0
    > if plainNumber.length > 3 then
    > nextDigits =
    >
    separatorChar&plainNumber.char[plainNumber.length-2..plainNumber.length]
    > delete
    plainNumber.char[plainNumber.length-2..plainNumber.length]
    > else
    > nextDigits = plainNumber
    > plainNumber = ""
    > end if
    > put nextDigits before outputString
    > end repeat
    >
    > repeat while fraction.char[fraction.length] = "0"
    > delete fraction.char[fraction.length]
    > end repeat
    >
    > if fraction.length > 0 then
    > put decimalChar&fraction after outputString
    > end if
    >
    >
    > if negative then
    > put "-" before outputString
    > end if
    >
    > return outputString
    >
    > end
    >

Maybe you are looking for

  • Problem about BIEE Integration with LDAP

    Hello, I have a problem in OBIEE11.1.1.6 I do BI EE 11g Security Integration with OPENLDAP follow below link, http://www.rittmanmead.com/2010/11/oracle-bi-ee-11g-security-integration-with-microsoft-active-directory/ It works well using user that stor

  • RPM in Solaris

    Hi I have problem with RPM installing in Solaris 10. I am using RPM version 4.1. I can successfully build rpm but during installation (or un-installation) it hands. During investigation I have found problem is in Install/Erase-time Scripts. When any

  • ADOBE PHOTOSHOP CC 14.1

    Hi, I have Adobe photoshop cc 14.1 and how I can do installion repair ?

  • To see whole orders of the month

    I want to see all the sales orders/deliveries/ invoices...in this month...how???how should i do it????

  • Need Query for Update

    CREATE TABLE TEST_MATCH MTCH1 NUMBER(9), MTCH2 NUMBER(9), UPDT_MTCH CHAR(2 BYTE), UPDT_NBR NUMBER(10) SET DEFINE OFF; Insert into TEST_MATCH (MTCH1, MTCH2, UPDT_MTCH) Values (2616131, 300137070, '02'); Insert into TEST_MATCH (MTCH1, MTCH2, UPDT_MTCH)