This website is not affiliated with, sponsored by, or approved by SAP AG.

How suppres left zeros in the matnr

Development (ABAP Development WorkBench, ABAP/4 programming)

Moderators: Snowy, thx4allthefish, YuriT, Gothmog

How suppres left zeros in the matnr

Postby tunka » Thu May 08, 2003 3:33 pm

Hi,

I need suppress left zeros in the matnr code, just for manipulation, not in the table. Its important mention that the matnr code may have letters and number (eg. 0000000000000ACE01 will be ACE01)


TIA
tunka
 
Posts: 152
Joined: Mon Apr 07, 2003 7:17 am

Postby ABERRRR » Thu May 08, 2003 3:49 pm

USE SHIFT COMMAND TO DELETE THE LEADING ZEROS.
LIKE SHIFT MATNR LEFT DELETING LEADING ' 0'.
ABERRRR
 

Postby saper » Thu May 08, 2003 3:55 pm

use SHIFT '00000XYZ' LEFT DELETING LEADING '0'.

saper
saper
 
Posts: 133
Joined: Tue May 06, 2003 9:47 am
Location: USA

Postby tunka » Thu May 08, 2003 4:11 pm

Thx, :wink:
tunka
 
Posts: 152
Joined: Mon Apr 07, 2003 7:17 am

Postby ocvantol » Thu May 08, 2003 5:26 pm

Better take a look at Function Modules CONVERSION_EXIT*
ocvantol
 
Posts: 929
Joined: Tue Oct 22, 2002 3:19 am
Location: The Hague

Postby Guest » Thu May 08, 2003 8:05 pm

Hi,
when displaying to List use the option no edit mask for 'write' statements.

Regards,
Sen
Guest
 

No

Postby Dr Sidewalk » Fri May 09, 2003 1:58 am

As ocvantol pointed out you should at the very least use the CONVERSION_EXIT* FM's. However, there a specific conversion FM for MATNR which takes care of leading zeroes regardless of whether there are alpha-numeric characters in it. I just can't remember what it is at the moment. I will look it up and repost a little later.

Dr Sidewalk
"In the middle of difficulty lies opportunity" - Albert Einstein
"Money isn't everything in life, unless you don't have it"
"Fail to plan, plan to fail"
"Success is a journey, not a destination."
Dr Sidewalk
 
Posts: 3531
Joined: Mon Oct 21, 2002 11:06 am
Location: Everywhere...

Postby Rich » Fri May 09, 2003 2:51 am

The replies talkig about SHIFT or OVERLAY are incorrect. As Ocvantol and Dr Sidewalk point out Conversion Exits are the correct way to go.

For more information and code examples on how to use conversion exits, look here: http://www.sapfans.com/forums/viewtopic.php?t=22406

Rich
Rich
 
Posts: 7112
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool

Postby Guest » Fri May 09, 2003 3:57 am

always look on the domaine for the data element for a conversion routine.
For MATNR it is normaly MATN1 (on specific systems others)
Then use CONVERSION_EXIT_<conv-routine>_OUTPUT.

For your problem CONVERSION_EXIT_ALPHA_OUTPUT would also fit the problem.

regards
Hans
Guest
 

Postby Rouge » Fri May 09, 2003 4:00 am

No, not in this case.

CONVERSION_EXIT_MATN1_OUTPUT suppress the leading zeroes only if the material number is numeric.

Ciao, Giulio.
Rouge
 
Posts: 271
Joined: Fri Oct 25, 2002 4:29 pm
Location: Italy

Postby Rich » Fri May 09, 2003 5:26 am

Rouge wrote:No, not in this case.

CONVERSION_EXIT_MATN1_OUTPUT suppress the leading zeroes only if the material number is numeric.

Ciao, Giulio.


Yes.... but then if a user enters the alphanumeric code withoutn the zeroes the item will not be found so for material numbers that are alpha numeric displaying zeroes is correct if they have them on the front. Therefore the conversion exit is still correct.

Perhaps Tunka can explain a bit more about what he wants to do.

Rich
Rich
 
Posts: 7112
Joined: Thu Oct 31, 2002 4:47 pm
Location: Liverpool

Postby tunka » Fri May 09, 2003 7:11 am

Thx to all,

Im usign "SHIFT MATNR LEFT DELETING LEADING ' 0'." right now, and i don't have any problem, i want delete the left zeros only for presentation in my table control.

:)

Regards[/quote]
tunka
 
Posts: 152
Joined: Mon Apr 07, 2003 7:17 am

Dangerous!

Postby Wolfgang G Propfe » Fri May 09, 2003 8:53 am

Dear tunka:
(eg. 0000000000000ACE01 will be ACE01)


You better talk to your supervisor before you accept the 'solution' you want to go for. While it is possible to have a material 0000000000000ACE01, it is highly unlikely, because you would have to type all the zeroes when you create the material. But deleting the zeroes would actually falsify the value. What if you also have a material ACE01? Suppose 0000000000000ACE01 needs to be deleted and you display it as ACE01. Now the user goes to MM02 and deletes ACE01 (as displayed in your list). S/he would actually delete the wrong material.

Your code would not pass my source code review! Scary to think, that there are actually many people taking that 'shortcut'.

Regards,
Wolfgang
Wolfgang G Propfe
 
Posts: 469
Joined: Sun Oct 20, 2002 5:57 pm
Location: Houston, TX, USA

Postby tunka » Fri May 09, 2003 11:45 am

Dear Wolfang:

You are rigth at all and clarify a lot of things (unless for me), my example was wrong sorry :oops:

Thanks


Best Regards
tunka
 
Posts: 152
Joined: Mon Apr 07, 2003 7:17 am


Return to ABAP

Who is online

Users browsing this forum: No registered users and 6 guests





loading...


This website is not affiliated with, sponsored by, or approved by SAP AG.