Padding a julian date with leading zeros ?
Hi,
I have gernerated a julian date, which I am appending to another two digit number to create a five digit serial number.
Is there a simple way to pad the first 99 days with leading zeros ( i.e. 001, 002....025...099) so that I maintain a five digit serial number ?
I am using Get Date In Time/Seconds > Number To Decimal String > Unbundle >Number to Decimal String.
Thank you in advance for any advice,
Alan
Here's the simplest way to do it (with he 2 digit number), I believe:
Message Edited by Matthew Kelton on 02-21-2008 12:43 AM
Attachments:
Julian1.png 3 KB
Julian2.png 2 KB
Similar Messages
-
BPC 7.5 NW: Master Data with leading zeros
In BPC 7.5 NW, is it still an issue to have Master data with leading zeros?
In other words, is it still not advisable to have leading zeros in the Master data.
Let me know your views.
Thanks.I was also having the same issue almost in the same version.
Other than what you mentioned, the master data was also jumbling up like 0120, 0130, 0145, were set up as 120, 145, 130....
The workaround that we took was to put a leading alphabet, when the data comes into BPC.
Try doing that, it will surely help.
Hope this helps.
Thanks.
Anand -
Export to Excel - data with leading zeros
Does anyone have any tips or tricks for running a query then exporting to Excel without dropping leading zeros from the data?
Examples: numeric Item codes with leading zeros, telephone numbers that have been entered with no spaces.
Regards,
Douglas McDove< Font Color="RED" Size = 3 Face=Verdana>
I liked the challenge and therefore.......I got this for you
</Font>
SELECT CHAR(28) + T0.CardCode [BP Code\] FROM [dbo\].[OCRD\] T0
SELECT CHAR(29) + T0.CardCode [BP Code\] FROM [dbo\].[OCRD\] T0
SELECT CHAR(30) + T0.CardCode [BP Code\] FROM [dbo\].[OCRD\] T0
SELECT CHAR(31) + T0.CardCode [BP Code\] FROM [dbo\].[OCRD\] T0
Any of the above 4 should work. T0.CardCode is the database field I tested, you can substitute this with any database field and it should work.
Regards
Suda -
Create Master Data with leading zero
Dear Expert,
Our customer request to create Customer Master/Vendor Master/Material Master with leading zero. For example: they want to create Customer 0234578.
I can do that for material, would you please advise how to do the same for customer/vendor?
Thanks you,Dear Mr.
Our customer number is in numeric, then this error happen. If customer number constants 1 char, then system will keep zero leading (ex: 012A4) But if customer number constants only numeric, even i type zero, system will remove leading zero.(01234 ==> 1234)
Please help. -
Conditionnal Formating Data with leading zeros
Hi,
I have a report which is displaying the name of CD's lile this:
C2009-1
C2008-257
C2008-3456
C2008-12984
In the database, there is a column
Type: C
Year: 2008
CDNum: 1
How, when I'm displaying the report, it always return a 5 digits number, with zero before to have this output:
C2009-00001
C2008-00257
C2008-03456
C2008-12984
thanks,
Roseline
Edited by: Roseline on Oct 1, 2009 8:58 PM
Edited by: Roseline on 6 oct. 2009 08:50Thanks for your help.
My boss ask me to show 4 digits if the year = 2008 or 2007 or 2006, etc
and 5 digit if the year = 2009
C2009-1
C2008-257
C2009-3456
C2008-12984
In the database, there is a column
Type: C
Year: 2008
CDNum: 1
SELECT type || year || '-' || LPAD(cdnum, 5, '0') *IF YEAR < 2009*
FROM your_table
or
SELECT type || year || '-' || LPAD(cdnum, 5, '0') *IF YEAR = 2009*
FROM your_tableSo basiccly, I need to insert an IF in my SQL statement, can I do that??
thanks,
ROseline
Edited by: Roseline on 6 oct. 2009 08:45
Edited by: Roseline on 6 oct. 2009 08:49 -
Padding a value with leading zeros
Hi
I am trying to create a filename (String) using a sequence int. I need this int to be 6 digits, with leading zeros
i.e. if my seqence number is 23 my filename (String) should be:
FILE000023
Obviously I can do this by creating my own method that iterates through the number, but I was wondering if there was a simple method to change an int to a String and pad it out with leading zeros.
Thanks
Neil.import java.text.*;
public class DecimalFormatTesting {
public static void main( String[] args ) {
DecimalFormat format = new DecimalFormat("###.###");
format.setMinimumIntegerDigits( 6 );
String integ = format.format( 123 );
System.out.println("str: " + integ);
} // end of main()
}hope this helps
partha -
Download records to EXCEL file with Leading Zero's for numbers
Hi All,
I am able to download the data to EXCEL file on the presentation server.
There are few fields (Plant,SalesOrder Number ..with Leading Zero's) in the record.
These values are downloaded with out Leading Zero's to excel( EX: 0000004122 as 4122).
Please help me to download the data to EXCEL file with leading zero's.
Thanks and Regards,
KC>
Krishna Chaitanya G wrote:
> The excel file which is to be downloaded..will be used by some other program..to upload the values to the sap.
> It matters there....
> KC
HI KC,
then no need to download the zeros,
after uploading, loop at that uploaded internal table and use CONVERSION_EXIT_APLHA_INPUT and pass the vbeln(without zeros) to this FM, it will return the value with added zeros.
hope this solves your query
a small example
Loop at itab into is.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
INPUT = is-vbeln "( this is without zeros)
IMPORTING
OUTPUT = is-vbeln. "( this is with leading zeros)
modify itab from is.
endloop.
Edited by: Soumyaprakash Mishra on Oct 6, 2009 2:16 AM -
** Please help urgently ** Budget upload field with leading zeros
We need to load a characteristic that has leading zeros. For example 0000350. When saving down to CSV, we lose the leading zeros (0000) so that only 350 is loaded into BW. Saving the codes as 'text' in excel does not seem to help.
We cannot therefore see the name for any of these codes when refreshing the workbook in BW.
Could some please urgently tell us the correct method to save the file for loading into the BW infopackage, with all zeros intact ?
Regards, FrederickHi Frederick,
Just some additional thoughts,
assuming field A1 in Ecel contains 350 and you want to create a string with 8 digits, you could use formula '=text(A1;"00000000")' in an empty column and copy it back to column A. Then 00000350 should be provided in A1. This can be saved in a normal .csv file and be opened with a text editor (e.g. notepad) in order to check content.
If you don't want to manipulate Excel data, transformation to a field with leading zeros can be easily be processed with a routine in transfer rules.
Regards
Joe -
How load ean with leading zeros
Hi,
I need help for load leading zeros in ean. If someone can send me the documentation of why SAP delete leading zeros when to load ean code in the field mean-ean11 and mara-ean11. I'm consultan and the client need know this aswer. Because they no want load the articles without zeros. Now if knowledge a enhancement please.
We are using SAP Retail ECC 6.0 and I finding to very notes and I can't find and answer.
Thank you,Hi friends,
My general problem is that I'm using the idoc ARTMAS05 but when to load data delete leading zeros in EAN fields.
Example of my problem:
I have a article with this ean code 0056789 and have other article with this ean 00056789, but when to load data the second article it is no stored because shows error message "Ean code already exits". Now I´m finding the way for to be able to load the zeros of the ean.
I have 23000 article with this problem.
Thank... -
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
SolitaireI 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. -
Hi,
I have a column SRL_NUM with datatype varchar2(4 char).I have 3000 records in this table and want to make SRL_NUM like 0001,0002,0003 etc.It should increment but entire 4 characters should be filled.How do i do this?
Thanks.user10698496 wrote:
I have a column SRL_NUM with datatype varchar2(4 char).I have 3000 records in this table and want to make SRL_NUM like 0001,0002,0003 etc.It should increment but entire 4 characters should be filled.How do i do this?Why is the sequence a varchar2 and not a number?
IMO it makes more sense to use a native number data type as that is what a sequence generator outputs - and then render that as a text string with leading zero as "+how it looks like+" is a presentation layer issue.
I would not use a numeric sequence generator to generate unique strings as surrogate key values. There are inherent problems with mixing data types like that. -
SapScript problem with leading zeros
Hi,
I print field LTAP-NLENR.
But when i use <AP-NLENR& leading zeros are cut.
I need to display it with leading zeros. (ex. 0000000000010000000001)
Please help.
Regards,
Greg.<AP-NLENR(K)& works fine for me with your requirment.
I have defined a L_VAR like this:
data: L_VAR type LTAP-NLENR.
l_var = '0000000000010000000001'.
In my script I use like this:
P1 &L_VAR(K)&
SO, try to pass that value to some other variable and see what happens.
Regards,
Naimesh Patel -
Mateiral no. with leading zero
Dear Experts,
My case is that I created a material with ext no. assignment e.g. 1234 via BAPI without leading zero. In OMSL, the 2 checkboxes do not check anyaway.
I check it does exist in MARA, MARC and store with leading zero.
But I try to display MM03 for that material and enter 1234, the error says "The material 1234 does not exist or is not activated".
I check that in debugger mode, there is leading zeros added for that material whcih leads to this result.
Do you know how to solve it?
Thanks.Hi dear,
Note the following
1.Lexicographical Indicator: - The appearance of the material no on the front end is governed by this indicator. This indicator is relevant only for numeric material numbers either internally or externally defined.
2.If the Lexicographical Indicator is not set (indicator is not ticked) incase of external material number assignment, the material numbers are stored with leading zeros. i.e. pure numeric material no 5007453 may look like 0005007453 if the material no length maintained as 10.
3.If the Lexicographical indicator is set (indicator is ticked) incase of the external material number assignment, the material numbers are not stored with leading zeros. i.e. pure numeric material no 5007453 will look like as 5007453.
4.If the Lexicographical indicator is set (indicator is ticked) incase of internal material assignment, the material numbers would be padded with leading zeros
5.This indicator can not be changed once there are numeric materials numbers in the system.
6.Leading zero indicator: - Along with Lexicographical indicator there is leading zero indicator on the same screen. If the indicator is set (ticked) material number is shown with leading zero, but if the Lexicographical indicator is ticked leading zero indicator is ignored by the system.
5007453 Material no length 10 External No range Indicator Not ticked Result 0005007453
5007453 Material no length 10 External No range Indicator Ticked Result 5007453
5007453 Material no length 10 Internal No range Ticked Ticked Result 0005007453 -
ABAP-based web service returns numeric values with leading zeros
Hi SOA experts,
I have created a web service out of an ABAP function module. Beside other values, this service returns a list of document numbers. All of these numeric values are returned by the web service with leading zeros, but we do want these values w/o leading zeros.
Any ideas how I can tell the web service to not print any leading zeros?
Thanks in advance for your help!
Kind regards, Matthias
PS: The according function module does not print any leading zeros for the numeric valueshi,
just a guess: I'd try to use I instead of NUMC for the document numbers.
NUMC is no number but a character string with numeric characters only. only some display routines in SAP know that this string of numerals represents a number and omit leading zeroes.
my 2 cents,
anton -
Need formula to take text from one cell, add that to a serial number with leading zeros
I'm trying to create a spreasdheet cell that simplifies creating videotape Numbers from a job name in cell and appends a serial number with leading zeros, and that would survive an export to EXCEL.
The result would look like
A Column
Job Name
B ColumnTape #
Formula needed for B
ClientName-TapeType-
ClientName-TapeType-001
=
ClientName-TapeType-
ClientName-TapeType-002
=
I've tried using a custom cell format that had the text in front of the (Integer) drag and drop, with three integers and leading zeros.
That worked, but requires recreating the custom cell format for each client and tape type.
So, I've used the formula =A2& in order to play around with different things, but haven't hit on something that adjusts for increased numbers and retains the leading zeros.
I don't mind doing a starter for the first row and then adding +1 in the formulas for the rows below.
I've done that using the custom cell formats for the first B cell and then using =Bx+1 in the following cells. It works, but I'm hoping to find something simpler or that can be copied and pasted in multiple rows on one paste.
Thanks in advance.
Suggestions much appreciated!
TedTed,
This expression in B will give you the pattern I believe you are looking for:
=A&RIGHT("00"&ROW()-1, 3)
Here's a screen shot...
Jerry
Maybe you are looking for
-
Error #2057: The page could not be added to the print job.
I've been making myself crazy over this one. I'm trying to print a complex multi-page "report" in Flex, but I keep getting this error every time I try to call FlexPrintJob.addObject(page): Error #2057: The page could not be added to the print job. H
-
Hi, I am new to livecycle and wondering if there is any sample for setting up the dynamic table with XML schema so I can access the data through workbench's xpath. thanks.
-
Replicating characters to form a string
Hello, I'm trying to write a method which creates a string consisting of n characters. Something like: replicate(Char, n); where Char is a character and n is the number of times thischaracter is replicated in the string. e.g. replicate("U",10); would
-
i have some photo;s wich have to appear in order (slowmotion capture of a collapsing bridge) but when in sync my ipod(4th gen 4.3.5) it places them in the wrong order.. anybody with a solution
-
Hi. I do manage about five oracle database (both 9iR2 and oracle 8). Everything is okay, but management wants me to produce some form of graphic report showing database availaibily, disk space usage and so on. I know OEM can do some of these stuffs,