<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>leading zeros &#8211; SAP EWM Help</title>
	<atom:link href="https://www.sapewmhelp.com/question-tag/leading-zeros/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.sapewmhelp.com</link>
	<description>SAP EWM questions answered by experts — ABAP, S/4HANA, warehouse management</description>
	<lastBuildDate>Sat, 23 Aug 2025 21:11:30 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0.2</generator>
	<item>
		<title>How to remove the leading zeros from the output of program in SAP ABAP ?</title>
		<link>https://www.sapewmhelp.com/question/how-to-remove-the-leading-zeros-from-the-output-of-program-in-sap-abap/</link>
					<comments>https://www.sapewmhelp.com/question/how-to-remove-the-leading-zeros-from-the-output-of-program-in-sap-abap/#respond</comments>
		
		<dc:creator><![CDATA[DPM125]]></dc:creator>
		<pubDate>Sat, 23 Aug 2025 21:11:30 +0000</pubDate>
				<guid isPermaLink="false">https://www.sapewmhelp.com/?question=how-to-remove-the-leading-zeros-from-the-output-of-program-in-sap-abap</guid>

					<description><![CDATA[Common Methods to Remove Leading Zeros in ABAP WRITE statement with NO-ZERO When outputting with WRITE, you can suppress leading zeros like this: code: DATA: lv_num TYPE n LENGTH 10 VALUE &#8216;0000123456&#8217;. WRITE lv_num NO-ZERO. &#8221; Output: 123456 SHIFT statement You can shift the contents to the left to remove zeros: code: DATA: lv_num TYPE [&#8230;]]]></description>
										<content:encoded><![CDATA[<p>Common Methods to Remove Leading Zeros in ABAP</p>
<h5><strong>WRITE statement with <code>NO-ZERO</code></strong></h5>
<p>When outputting with <code>WRITE</code>, you can suppress leading zeros like this:</p>
<p>code:</p>
<p>DATA: lv_num TYPE n LENGTH 10 VALUE &#8216;0000123456&#8217;.</p>
<p>WRITE lv_num NO-ZERO. &#8221; Output: 123456</p>
<h5><strong>SHIFT statement</strong></h5>
<p>You can shift the contents to the left to remove zeros:</p>
<p>code:</p>
<p>DATA: lv_num TYPE n LENGTH 10 VALUE &#8216;0000123456&#8217;.</p>
<p>SHIFT lv_num LEFT DELETING LEADING &#8216;0&#8217;.<br />
WRITE lv_num. &#8221; Output: 123456</p>
<h5></h5>
<h5>CONDENSE with <code>NO-GAPS</code></h5>
<p>Works if the field is CHAR/NUMC:</p>
<p>DATA: lv_char TYPE char10 VALUE &#8216;0000123456&#8217;.</p>
<p>CONDENSE lv_char NO-GAPS. &#8221; removes spaces<br />
SHIFT lv_char LEFT DELETING LEADING &#8216;0&#8217;.<br />
WRITE lv_char. &#8221; Output: 123456</p>
<p>&nbsp;</p>
<h5>Conversion Exit (for SAP standard fields)</h5>
<p>Some SAP fields (like Material Number <code>MATNR</code>) have <strong>conversion exits</strong> to display without leading zeros.</p>
<p>&nbsp;</p>
<p>DATA: lv_matnr TYPE matnr VALUE &#8216;000000000000123456&#8217;.</p>
<p>CALL FUNCTION &#8216;CONVERSION_EXIT_ALPHA_OUTPUT&#8217;<br />
EXPORTING<br />
input = lv_matnr<br />
IMPORTING<br />
output = lv_matnr.</p>
<p>WRITE lv_matnr. &#8221; Output: 123456</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
<p><strong>Best practice:</strong></p>
<ul>
<li>
<p>Use <code>CONVERSION_EXIT_ALPHA_OUTPUT</code> if dealing with SAP database fields like <code>MATNR</code>, <code>KUNNR</code>, <code>LIFNR</code>.</p>
</li>
<li>
<p>Use <code>SHIFT ... DELETING LEADING '0'</code> or <code>WRITE ... NO-ZERO</code> for simple variables.</p>
</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.sapewmhelp.com/question/how-to-remove-the-leading-zeros-from-the-output-of-program-in-sap-abap/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
