Leading zero on char field
I have what would be a simple thing. A need to have leading zero retained on a variable..that holds a month.
I have a field that is 20090501 and I want to make it 20090401... that is take 1 month off
But problem is the calculation does not give leading zeros
... here is very cut down version of what I am doing
DATA: lv_Period(8) type c,
lv_mm(2) type c.
lv_mm = '05'.
lv_mm = lv_mm - 1. "becomes 4. " how do I make it "04".
concatenate '2009' lv_mm '01' into lv_Period. " this becomes 2009401 and not 20090401
DATA: lv_Period(8) type c,
lv_mm(2) type c.
lv_mm = '05'.
lv_mm = lv_mm - 1. "becomes 4. " how do I make it "04".
if lv_mm is LT '10'.
concatenate '2009' '0' lv_mm '01' into lv_Period.
else.
concatenate '2009' lv_mm '01' into lv_Period. " this becomes 2009401 and not 20090401
endif.
Similar Messages
-
Padding leading zeros to char field
Hi Gurus,
user enter number in the field which is char 10, and if they enter any value which is lesser than 10 then i have to pad leading zeros to cusno.
i am using following logic but its displaying error saying unable interpret 'v'.
any hep in this regard really appreciated.
data : cusno type char10 value 'PADA'.
Data : l type i.
data : v type c value '0'.
l = STRLEN( cusno ).
while l < 10.
concatenate v into cusno.
endwhile.Add Leading Zeroes
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = cusno
IMPORTING
output = cusno.
This will add leading zeroes to cusno if its length is less than 10. -
How to add leading zeros to kunnr field
Hi All,
I need to add leading zeros to KUNNR field runtime.
i.e for some customer it is displaying '2001084606'
some customer's it si displaying '10434'.
I want add leading zeros when customer length is
not equal to ten '10'.
plz kind let me know this is urgent.
Regards
BhaskarHi there,,
Kunnr is using a dataelement with Char 10.
You can do in this fashion to resolve your issue.
len = strlen (itab-kunnr).
len is having the lenght of the customer number.
if len < 10..
while len < 10.
concatenate '0' itab-kunnr into temp_text.
add 1 to len.
endwhile.
endif.
now finally you can assign temp_text to your itab-kunnr.
hope this way you can resolve your issue.
if found helpful,, don't forget to reward points.
Thanks-
Rahul. -
How can i avoid leading zeros for a field in smartform?
how can i avoid leading zeros for a field in smartform?
Hi,
Using the Symbols.
&symbol(Z)& Omit Leading Zeros &symbol(S)& Omit Leading Sign
&symbol(<)& Display Leading Sign to the Left
&symbol(>)& Display Leading Sign to the Right
&symbol(C)& Compress Spaces
&symbol(.N)& Display upto N decimal places
&symbol(T)& Omit thousands separator
&symbol(R)& Right justified
&symbol(I)& Suppress output of the initial value
Regards,
Shiva Kumar -
Adding leading zeros in a field mapping
Hi,
I am getting account as a 5 char field in the input file. I need to map this to a 10 char field in XI and add leading zeros in case the value is all numeric. Is there any standard data type/ mapping that can achieve this or I need to write a UDF.
Thanks,formatNum field will cause an exception if your input isnt all numeric...
I'd go for UDF id your input isnt always numeric.
Regards,
Henrique. -
Need to add leading zeros to the field if field length is less than 6
Actually the field length is 16.
But for some manual entries it is comming as 4 chars.
so if field length is less than 6 then it should be replaced by leading zeros.
Moderator message: very basic, please (re)search yourself before asking, @all: please do not reply to basic questions, points removed.
locked by: Thomas Zloch on Sep 9, 2010 11:43 AMHi Ravi,
Do it in 2 steps.
1. check the length of your entry by strlen function and get the length.
2. If the output is less than 6 call the FM CONVERSION_EXIT_ALPHA_INPUT to get leading zero
Regards,
anirban -
Add leading zero for character field on ALV
hi all ,
i am currently making an ALV report. i have a field which is 'rassc' char(6) in the internal table which should be shown on the report.
before i use function to show alv report , i saw the value of this field is '080' , but what i get on the report is '80'. i want the leading zero . but i don't know how .
plz guide me.
regards
Kevinhi,
check this.
DATA:
var TYPE matnr.
WRITE '80' TO var RIGHT-JUSTIFIED.
TRANSLATE var USING ' 0'.
WRITE: var. -
Delete leading zeros for a field on the pdf form
Hi,
i know it is possible to delete leading zeros via abap coding in the interface.
But is it also possible to this directly on the pdf form - scripting or a setting?
Thank you
Kind regards
ManfredI believe you can set this up as a field display pattern (if you use LCD 8.1 or something like that).
Or you can script that out. In formcalc you can easily process characater by character, test if that is zero and remove it.
http://help.adobe.com/en_US/livecycle/es/FormCalc.pdf
Otto -
Hi all,
help me in the issue . I am passing value to a numc(3) field . lets take the value as '073' but it is showing as 073 in the output . How to acheive leading zero for the same in the output for a standard field.
Thanks in advancedata : num(3) TYPE C VALUE '073',
val(3) type N.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = num
IMPORTING
OUTPUT = val .
write : val
No Eric FM CONVERSION_EXIT_ALPHA_INPUT also work. Try the above code.
/Edit: Ohh.. Go as per my earlier post.
Edited by: Mishra.Manas on May 5, 2010 1:39 PM -
How to remove leading Zeroes in all fields in Payload
Hi,
How can I remove the leading Zeroes in every Filed I have in whole Payload Structure.there are around 10000 fields that have to be removed the leading Zeroes.any good idea please.
<POSNR>000010</POSNR>
<MATNR>000002465640</MATNR>
<ARKTX>000012 KG D107</ARKTX>
<MATKL>00030010000</MATKL>
<WERKS>0000ORGC</WERKS>
<LGORT>0000GC55</LGORT>
<CHARG>000TEST</CHARG>
like this mutliple segments and multiple Fields.so I can take as whole payload with multiple fields should not have leading Zeroes.I can handle if they are 10 0r 20 fileds,but not like whole pay load/1000 fields right.
thank you,
PremHi
You can have an additional XSLT mapping, to your existing one..
use copy-of & apply-templates to copy the whole tree & make changes recursively.
below is a sample code , the marked line is where you need to try your logic of trimming Zeros. (this code does upper case)
add this below code in your interface mapping object, as XSLT mapping, which does the job (only try putting your logic)
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="2.0">
<xsl:output method="xml"
indent="yes"
omit-xml-declaration="yes"/>
<xsl:template match="*">
<xsl:copy>
<xsl:copy-of select="@*"/>
<xsl:apply-templates/>
</xsl:copy>
</xsl:template>
<xsl:template match="text()">
<xsl:value-of select="upper-case(.)"/>
</xsl:template>
</xsl:stylesheet>
hope this fixes your issue
Regards
Vishnu -
Leading zero's for field Serial Number
Hi All,
I need to be able to have leading zero's for the serial number field (GERNR). I have found a few notes for the industry solution for A&D but does anyone know if there is a solution for normal ECC?
Cheers
Chris
Edited by: Chris March on Sep 16, 2008 2:49 PMHi Chris
Did you manage to get a solution for this?
Regards
Anant -
Leading Zero w/ variable field length...
I'm creating a form in which I need a particular field to:
- Accept/Display a leading zero (or multiple leading zeros);
- Accept numbers numbers;
- Have a maximum field length of six numerals, but with the ability to accept fewer;
- Display an error message if the above criteria are not met.
I have some code (see below), but don't know how to make the field length variable.
var fmt = /^\d\d\d\d\d\d$/;
if(event.value != "")
if(!fmt.test(event.value))
app.alert("Incorrect format, field must contain numbers only.");
event.rc = false;
Make sense...? Can anyone help...?
Thank you.This drops the leading zero(s) and does not display the error message.
Adjustments...?
Thank you for your promp reply. -
Re: Material number with leading zeros (40 char long)
Hello Experts,
I am working on SAP ME 6.1.4.15.
I am having a problem with the material number appearing in production order / planned order request document in MEINT and failing there since the material it is looking for is with leading zeros (for example 1291 appearing as 0000000000000000000000000000000000001291) - a total of 40 char long.
But this material exists in ME as 1291 only. Can any one throw any light on this as to what could be the reason and how to solve it?
Thanks
SrinivasDear Srinivas,
SAP Note 1799009 - 'Presence of leading zeros is inconsistent over IDOC thus SAP MEINT cannot handle all inbound IDOC consistently' should help to resolve the problem.
Regards,
Alex. -
How to delete leading zeros for amount fields
Hi all,
I have problem with the leading zeros, where I am populating nearly 30 amount fileds in my statement.i want to delete leading zeros.
I have tried with shift and pack.
and I cannot call every time the function module *alpha_output or input.
can anybody suggest me the better solution.
Regards,
SreYou could use a syntax like
SHIFT: w10a LEFT DELETING LEADING '0',
w10b LEFT DELETING LEADING '0',
w10c LEFT DELETING LEADING '0',
w10d LEFT DELETING LEADING '0'.
or using macros like
DEFINE delzero.
shift &1 left deleting leading '0'.
END-OF-DEFINITION.
delzero: w10a, w10b, w10c, w10d.
Regards -
System is showing 7 leading zeros in assignment field
Hi,
I have posted one document through F-29 and in assignment field i have assigned cheque number which is a six digit number and then i run FF68 (Edit check deposit list), when i save that document system creates one accounting document but automatically showing leading 7 zeros in cheque number.
Thanks in advance.
Regardsdata : num(3) TYPE C VALUE '073',
val(3) type N.
CALL FUNCTION 'CONVERSION_EXIT_ALPHA_INPUT'
EXPORTING
input = num
IMPORTING
OUTPUT = val .
write : val
No Eric FM CONVERSION_EXIT_ALPHA_INPUT also work. Try the above code.
/Edit: Ohh.. Go as per my earlier post.
Edited by: Mishra.Manas on May 5, 2010 1:39 PM
Maybe you are looking for
-
Win 7 pro 100% cpu with only a few programs running
I have a 4.2 rating with a amd athlon 64 3400+ running at 2.41ghz, 2.5 gig ram in 32bit windows 7 pro. My motherboard doesn't have windows 7 drivers which may contribute to the issue. Asus k8N so I have no illusions that this computer should be lig
-
IPod not recognized by new computer
I downloaded iTunes and plugged in my 2009 ipod into my new computer. It is not recognized. Message says: USB device not recognized. It is fully charged and contains music I don't want to loose. Please advise on the steps to correct this. Thank you!
-
Opportunities For Similar Opportunity Products
We have populated the opportunity product object with information concerning the specific customer and product sales that came from each closed/won opportunity by creating an interface from our billing system. I would now like to create an in context
-
Authentication for Stream Analytics REST Api
Hi there, I am trying to use the stream analytics rest api from a java client. For other services (storage services for example), I am able to successfully use mutual certificate authorization. I create a management certificate using keytool and uplo
-
Active directory Schema - Multiple password policies
Hi All, I am new to AD and would need some suggestion to configure AD. I want to set up AD(2008 R2) for three categories of users: individual, dealers and organisations. Each dealer and each organisation will have further sub-categories based on thei