Dashed format & leading zeros

Hi,
1)   Iam getting the SSN from P0002.But my client requirement is the SSN format should be in Dashed format like XXX-XX-XXXX.How i will get the dashed format?
iam getting SSN like this.
w_MetLife_detail-rdssn = p0002-perid.
2)How i send the value with leading zeros.
for example for this query : Hourly employee( PA0008-LGART = 1001): pa0008-BET01
Send values with leading zeroes
i written the code like
w_MetLife_detail-rdempsalary = p0008-bet01.
Kinldy help me on this.
Regards,
Sujan

Hi Sujan,
Here is the sample code.
1) Iam getting the SSN from P0002.But my client requirement is the SSN format should be in Dashed format like XXX-XX-XXXX.
How i will get the dashed format?
iam getting SSN like this.
w_MetLife_detail-rdssn = p0002-perid.
W_METLIFE_DETAIL-RDSSN = 1234567890.
WRITE /: W_METLIFE_DETAIL-RDSSN USING EDIT MASK '___-___-____'.
2)How i send the value with leading zeros.
for example for this query : Hourly employee( PA0008-LGART = 1001): pa0008-BET01
Send values with leading zeroes
i written the code like
w_MetLife_detail-rdempsalary = p0008-bet01.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
  EXPORTING
    INPUT  = W_METLIFE_DETAIL-RDEMPSALARY
  IMPORTING
    OUTPUT = W_METLIFE_DETAIL-RDEMPSALARY.
Thanks & regards,
Dileep .C

Similar Messages

  • How can I format a cell in Numbers to have leading zeros in a number?

    I imported a spreadsheet from Excel (Office 2014, Win 7) through iCloud and some numbers were formatted to have leading zeros (012358) in the original Excel file but the leading zero format was lost in Numbers.  Is there a way to format cells to have a number displayed with the leading zero in Numbers?  The leading zero is part of an identification and is important to the numbers (0027 is not the same as 27 in these records).
    thanks,
    Bob

    James has the formating part, but if you already did the import you can use the following formula to replace the zeros that were leading if you know it is a four digit reference number....
    =right("000" & A2,4)
    copy those values into your text formatted column from James' answer and you got it.
    Jason

  • How can I format a number with leading zeros?

    I need to convert an int to occupy exactly 3 positions in a StringBuffer... I need the space in the StringBuffer to be filled with leading zeros where appropriate. Can anyone show me how to do this correctly please ?
    At the moment I am using a pretty dumb workaround to fill the target with "000" first and then parse the int into either 1 2 or 3 positions depending on its value ... it works, but there must be a more correct way to do this ...
    Thanks in advance ...

    Have you had a look at the class java.text.DecimalFormat? It does exactly what you want... example:
    StringBuffer sb = new StringBuffer();
    DecimalFormat format = new DecimalFormat("000");
    format.format(2, sb, new FieldPosition(0));
    System.out.println(sb);
    prints out the string 002.

  • Pad leading zeros in a string.Format function

    How could use the string.Format function and in the format text pad a leading zero? 
    Pseudo code is:
    string parm = “5”;
    string format = “Some number formatted as 3 dig: Format({0}, 000)”;
    string output = string.Format(format, parm);
    Where the output would look like this:
    “Some number formatted as 3 dig: 005”
    Thanks.

    Thanks everyone. Unfortuantly there's a constraint where the padding operation needs to be embedded in the format string. This entire operatin is being put together dynamically where the format strings are being pulled from a library of format strings stored
    in a database. at runtime we don't know how which format will be used and how many parameters will be passed in. we have logic to handle the unknown number of paramters as there is metadata which helps us with that.
    the need for leading zeros needs to be part of the overall format defined in the format string.  for example, a real format string stored in the database looks like this:
    "LINE_NO = '{0}',  AND GEO_LOCATION = 'T{1}, {2},  R{3}, {4}, , Sec. {5}'"
    and its output from the string.Function is:
    "LINE_NO = 'TG-G2469',  AND GEO_LOCATION = 'T155, N,  R93, W, , Sec. 5'"
    the last parameter (param 5) had a value of 5.  In another case the output requirement might need to look like this:
    "LINE_NO = 'TG-G2469',  AND GEO_LOCATION = 'T155, N,  R93, W, , Sec. 05'"
    note the "05" at the end...
    the logic of using the leading zero needs to be embedded in the overall format string text.
    Thank you.

  • How to get leading zeroes in exponent of e-format

    In order to mimic an ancient file specification, am trying to write DBL numbers in e-format where the exponent is padded to two digits with leading zeroes.
    For example:  -1.15091E-03
    Is there a simple format code that does this or do I need to write something from scratch?
    LabVIEW Champion . Do more with less code and in less time .

    I am writing to a file.
    (Currently, I use the following workaround: format as %12.5e, then scan the substring after the "E", format it as %+03d, and recombine with the mantissa)
    LabVIEW Champion . Do more with less code and in less time .

  • Leading zero getting truncated in .CSV format GUI_DOWNLOAD

    Hello experts,
    I am trying to download the data using GUI_DOWNLOAD in .CSV format but the leading zeros are getting truncated. For instance Company code 0001 is displayed as 1 in the CSV File. But when I open the same file in notepad I am seeing 0001. Is this a known issue or this is how .CSV format should be?
    I have gone through some threads in SDN but they are not helpful.
    Your expert advise is much appreaciated.
    Thanks
    Abdul Hakim

    That is how excel displays values like 0001. It interprets them as a number and removes leading zeros.
    If you don't want this happen and you want excel to treat them like text, you need to append a quote at the beginning of the token like '0001
    You can use concatenate like below to append a single leading quote
    field = '0001'.
    CONCATENATE ''''  field INTO field.

  • Display numbers formatted with leading zeros or spaces.

    There are some cases where you might need to display numbers with leading zeros or leading spaces, or trailing zeros.  I experimented with several methods and came up with some examples.  This is a Console application, but the results can just
    as well be output to a listbox in a Windows form.
    Sub Main()
    Dim snum As String, inum As Integer = 56
    snum = inum.ToString()
    Console.WriteLine(snum & vbTab & " ToString()")
    snum = inum.ToString("D4") 'adds leading zeros
    Console.WriteLine(snum & vbTab & " ToString(""D4"")")
    snum = inum.ToString("F4") '4 decimal places with trailing zeros
    Console.WriteLine(snum & vbTab & " ToString(""F4"")")
    Console.WriteLine()
    snum = String.Format("{0,4}", inum) 'leading spaces
    Console.WriteLine(snum & vbTab & " Format{0,4}")
    snum = String.Format("{0:D4}", inum) 'leading zeros
    Console.WriteLine(snum & vbTab & " Format{0:D4}")
    snum = String.Format("{0:F4}", inum) '4 decimal places with trailing zeros
    Console.WriteLine(snum & vbTab & " Format{0:F4}")
    Console.WriteLine()
    snum = inum.ToString().PadLeft(4, "0"c) 'leading zeros
    Console.WriteLine(snum & vbTab & " PadLeft(4, ""0""c)")
    snum = inum.ToString().PadLeft(4, " "c) 'leading spaces
    Console.WriteLine(snum & vbTab & " PadLeft(4, "" ""c)")
    Console.ReadLine() Console.Clear()
            For x As Integer = 1 To 20
                snum = x.ToString("D4")
                Console.WriteLine(snum)
            Next x
            Console.ReadLine()
    End Sub
    Solitaire

    I would add that many of these methods also work with numeric types that are not integers.
    Note that the "D4" format string doesn't work for non-integral types (such as Double and Decimal), and the "F4" format string doesn't pad with trailing zeros, it rounds to 4 decimal places (which can lose information). PadLeft works with
    the entire string, it isn't aware of the decimal point.

  • Field format in Excel - losing leading zero

    I have field in query, which is varchar2 in database, but contains only numbers, most of which have leading zeros, i.e. '0123'.
    When the report is viewed as html, pdf, or rtf data is shown correctly, '0123', but when viewed in Excel, the data is '123'.
    Also, I have a column that is simmilar to this one - varchar2 containing only numbers (SSCC if anyone is familiar). This information is 17 characters long, so instead of '38503341002862100' i get '3,85033E+16' in Excel.
    I noticed in both cases that the cell format in Excel is general, instead of text.
    How can this be changed?

    hi arubelj,
    Excel sheet is made specificaly for number calculations.....and each cell which is having data is by default considered as number...and in numbers 0123=123 ,this is the reason why it is not displaying 0 in start..... i had cheched the excel setup options also..... but did not found anything there to change the default column or row type as text....
    Regards
    Ravi

  • Require a Number Format Mask to show leading zeros on decimals

    Hi,
    My users are complaining about the decimal point not being very clear when fractional numbers are shown. I need a format mask to show a leading zero for numbers between 0 and 1 (eg. 0.5) but not have a trailing point after whole integers.
    by example:
    10 should show "10"
    .5 should show "0.5"
    I have tried the following
    FM99990D99 which displays as
    10 as "10."
    .5 as "0.5"
    The whole integer of 10 then gets a trailing decimal point. Very ugly as the decimal is the exception to the rule which is why I need to highlight it.
    The user do not want a forced decimal place either as follows:
    FM999990D09
    10 as "10.0"
    0.5 as "0.5"
    The trailing decimal place is not a practical solution because 99% of numbers are whole numbers and the decimal just pollutes the screen with more zeros, making the numbers harder to read, resulting in more errors.
    I am looking for a format mask that shows:
    10 as "10"
    .5 as "0.5"
    I am using Oracle Forms which means I cannot set_item_instance_property for the records which have decimals. I need a single format mask for all options...
    Any help would be appreciated.
    Thanks,
    Tim.

    Thanks Francois.
    Looks like there is not a simple solution using a format mask alone.
    I have implemented a very similar solution to your suggestion. I have a character, non-base table field which I populate and dynamically set a format mask if the value is between -1 and 1 (and not zero).
    i.e.
    if :purchase.qty > -1 and
    :purchase.qty < 1 and
    :purchase.qty != 0
    then
    :purchase.qty__dsp := to_char(:purchase.qty,'FM999999990D99');
    else
    :purchase.qty__dsp := to_char(:purchase.qty);
    end if;
    Thanks,
    Tim.

  • Format strings, need leading zeros

    I have a data input where serial data is converted to a numerical value, then multiplied by a conversion factor, and the result then converted back into a string for outputting to a data file.
    I have not been able to get small numbers, such as "497" to get converted into a string "0497". Have tried the %04d format string, which gives me an output of 4970000 - not quite what I need.
    Am using the FormatIntoString.vi, which has a "format string" input, but values which should work like "%04d" do not give me the leading zeros.
    Ideas? Thx!

    The format string works on the numeric input of the function. The string input is for adding a string prefix to the output and is not a required input. In your example, if you wire the string to a Scan From String function and wire the output of that to the numeric input of the Format Into String, everything will work just fine. I've attached a corrected VI.
    Attachments:
    TestFormat-Fixed.vi ‏14 KB

  • Format numbers with leading zeros

    Hi,
    Im returning the time as a string from a function like so
    return minutes + ":" + seconds + ":" + millisec;
    But I need each part to always display with two digits and
    show leading zeros.
    Can anyone tell me how
    Thanks

    Thanks NedWebs
    I have done this
    var minstring = minutes.toString();
    var secstring = seconds.toString();
    var millistring = millisec.toString();
    if( minutes < 10 )
    minstring = "0" + minstring;
    if( seconds < 10 )
    secstring = "0" + secstring;
    if( millisec < 10 )
    millistring = "0" + secstring;
    if( millisec < 100 )
    millistring = "0" + secstring;
    return minstring + ":" + secstring + ":" + millistring;
    Thought there must be a better way.
    But it works!

  • Autofill Leading Zeros

    Acrobat Pro 9
    Windows XP
    I have a 9 digit field that I want to be formatted with leading zeros if there's any sort of entry in that field, e.g., if a user types in "12345", I want the field to show "000012345".
    Right now the field is formatted for a max of 9 characters in an integer format. I tried the Arbitrary Mask of all 9s, but a user has to enter all 9 digits and the default error message is in geek speak.
    There was an earlier thread on how to fill a field after an entry (like dashes after a checkbook value item) that I was hoping to get inspiration, but I can't find it.
    Thanks in advance for any help you can give me.

    Replace the Format script with the following:
    // Custom Format script
    (function () {
        // Get the character limit for this field
        var max_chars = event.target.charLimit;
        // Define the pad character to use
        var pad_char = "0";
        // If the field is not blank and there is a character limit, pad value with leading zeroes
        if (event.value && max_chars) {
            event.value = (new Array(max_chars + 1).join(pad_char) + event.value).slice(-max_chars);
    It depends on the character limit for the field being set to the maximum number of characters that you want. If you don't set a character limit, no formatting is applied.
    The last script was not general enough as it only worked for numbers less than 232 (maximum 32-bit integer).

  • IR - Column with leading Zeros issue

    Hello,
    I've got an IR report which includes as "default report settings" 1 column with leading 0s. In order to export to Excel that column as text rather than as a numeric I followed a workaround proposed before in this forum (excel copy drops leading zeros
    In essence this workaround is to create an identifical column but in "excel text format" and display the columns depending on the request value: INSTR(NVL(:REQUEST,'YABBADABBADO'),'CSV') <> 0 for example.
    This works just fine for the default report.
    The problem arise when a user creates his own customise report that includes the mentioned column and saves it as a named report. Here, when the results are exported to excel the "excel" column does not appear.
    In fact, just hiding one of the displayed columns produces the same undesired result.
    I would appreciate any comments or suggestions.
    Many thanks
    Edited by: Javier Gil on Jul 20, 2010 7:52 AM

    I have found a better method. In your IR query:
    SELECT LPAD(v.vendor, 7, ' ') vendor,
    /*Just LPAD to a length of the column defined in the database table or to 7, whichever is greater. */
    FROM v, r
    WHERE v.VENDOR = r.VENDOR
    AND date_rcv <= to_date(:P150_CUTOFF,'yyyy/mm/dd')
    AND inv_nbr = ' '
    AND to_stores <> 'T'
    AND (V.VENDOR = RPAD(:P150_VENDOR,10,' ') OR :P150_VENDOR = 'ALL')
    When you download to Excel by Download/XLS (Request=XLS), it preserves the leading zeros.
    In the case of dates, you should LPAD 10 minimum in this format.
    LPAD(to_char(date_rcv,'MM/DD/YY'), 10, ' ') date_rcv,
    I haven’t tried it yet but I think in the case of ‘MM/DD/YYYY’, you should LPAD 12 minimum in this format.
    LPAD(to_char(date_rcv,'MM/DD/YYYY'), 12, ' ') date_rcv,
    Drawbacks of this method:
    Since the string has leading white spaces, you cannot use the filter for the ‘=’ comparison operator. Even filtering using leading white spaces will not return anything. You must use the LIKE and NOT LIKE operator instead.
    Advantages of this method over the original one I posted yesterday:
    1)     You do not have to create another column for download, just one column will suffice.
    2)     Even though the query has leading white spaces, they will not display in the IR region.
    Edited by: richardlee on Aug 5, 2010 11:10 AM
    Edited by: richardlee on Aug 5, 2010 11:16 AM

  • CRM 7.0 Leading zeros on material in sales documents delta replication

    Hi
    During initial load of sales documents from ECC to CRM the item is replicated with leading zeros.
    The consequences is that CRM do not find the product and the crm order gets an error message that the product is not maintianed in product master.
    So my question is; how to replicate the order without leading zeros for items?
    BR
    Johan

    Hello Johan,
    You need to check txn:OMSL in ERP and you need to make sure that settings are in sync with CRM customizing path settings.
    SPRO>IMG>Cross-Applicaiton Component>SAP Product>Basic Settings-->Define O/P Format..
    Especially you need to check for the lexicographical flag.
    If this flag is set, then 0123 is different from 123.
    Hope this helps!
    Best Regards,
    Shanthala Kudva.

  • BAPI_PO_CHANGE document number leading zero problem

    Hi experts,
    The following code clears the "Delivery Complete" flag on a list of Purchase Orders uploaded from a CSV file.
    The PO number is 9 digits long, however, in EKPO table it is stored as 10 digits (prefixed with a zero). The BAPI does not recognise the document number unless it is prefixed with a zero in the CSV file (which adds extra work for the user to create custom format in Excel to add the leading zero).
    What code is required for the BAPI to recognise the 9 digit number without the leading zero?   Perhaps the leading zero could be hard-coded into the program?
    Any advice is much appreciated.  Thanks for your time.
    REPORT  Z_MASS_REMOVE_FDI_DCI_BAPI.
    *Check if file exists
    DATA: rc TYPE sy-ucomm.
    CALL FUNCTION 'WS_QUERY'
           EXPORTING
                query    = 'FE'  "File Exist?
                filename = 'X:\STO.TXT'
           IMPORTING
               return   = rc.
    IF rc EQ 0.
      WRITE: / 'File does not exist'.
    ENDIF.
    TYPES: BEGIN OF ty_tab,
            DOCNO(10),
            ITEM(4),
           END OF ty_tab.
    DATA : it_tab TYPE STANDARD TABLE OF ty_tab,
           wa_tab TYPE ty_tab.
    START-OF-SELECTION.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filename = 'X:\STO.TXT'
    *     FILETYPE = 'ASC
          has_field_separator = 'X'
    *     HEADER_LENGTH = 0
    *     READ_BY_LINE = 'X'
    *     IMPORTING
    *     FILELENGTH =
    *     HEADER =
          TABLES
          data_tab = it_tab
          EXCEPTIONS
          file_open_error = 1
          file_read_error = 2
          no_batch = 3
          gui_refuse_filetransfer = 4
          invalid_type = 5
          no_authority = 6
          unknown_error = 7
          bad_data_format = 8
          header_not_allowed = 9
          separator_not_allowed = 10
          header_too_long = 11
          unknown_dp_error = 12
          access_denied = 13
          dp_out_of_memory = 14
          disk_full = 15
          dp_timeout = 16
          OTHERS = 17.
    END-OF-SELECTION.
    LOOP AT it_tab INTO wa_tab.
      WRITE:/ 'DOCUMENT: ',
      wa_tab-DOCNO,
      ' ITEM: ',
      wa_tab-ITEM.
      WRITE: / '-----------------------------------------------------------------------'.
      DATA: s_header TYPE bapimepoheader,
            s_headerx TYPE bapimepoheaderx,
            s_item TYPE bapimepoitem,
            s_itemx TYPE bapimepoitemx,
            i_return TYPE bapiret2 OCCURS 0 WITH HEADER LINE,
            i_extension TYPE bapiparex OCCURS 0 WITH HEADER LINE,
            s_bapimepoheader TYPE bapimepoheader,
            s_bapimepoheaderx TYPE bapimepoheaderx,
            s_bapimepoitem TYPE bapimepoitem occurs 0 with header line,
            s_bapimepoitemX TYPE bapimepoitemX occurs 0 with header line,
            wa_message TYPE c LENGTH 100.
      s_bapimepoheaderx-po_number = wa_tab-DOCNO.
      s_bapimepoheader-po_number = wa_tab-DOCNO.
      s_bapimepoitemx-PO_ITEM = wa_tab-ITEM.
      s_bapimepoitem-PO_ITEM = wa_tab-ITEM.
    *Remove Delivery Complete Indicator (DCI)
      s_bapimepoitemx-NO_MORE_GR = 'X'.
      s_bapimepoitem-NO_MORE_GR = ' '.
      append s_bapimepoitem.
      clear s_bapimepoitem.
      append s_bapimepoitemx.
      clear s_bapimepoitemx.
      CALL FUNCTION 'BAPI_PO_CHANGE'
        EXPORTING
          purchaseorder = wa_tab-DOCNO
        TABLES
          return        = i_return
          poitem        = s_bapimepoitem
          poitemx      =  s_bapimepoitemx.
    *Message types: S Success, E Error, W Warning, I Info, A Abort
    *Supress all Warning Messages
    DELETE i_return WHERE ( TYPE EQ 'W' ).
    *Commit only if no errors have been returned
      read table i_return with key type = 'E'.
      if sy-subrc ne 0.
        COMMIT WORK AND WAIT.
      endif.
    *Display Return Messages on Screen
      LOOP AT i_return.
        WRITE: /   'RETURN MESSAGE: ',
        'ID: ',
        i_return-id,
        ' TYPE: ',
        i_return-type,
        ' NUMBER: ',
        i_return-number,
        i_return-message.
      ENDLOOP.
      WRITE: / '-----------------------------------------------------------------------'.
      refresh : s_bapimepoitem,s_bapimepoitemx.
    ENDLOOP.

    hi,
    Use the conversion exit to make it as 10 digit char CONVERSION_EXIT_ALPHA_INPUT.

Maybe you are looking for