We have added search box. Key in SAP issue keyword to search
TopBottom

Announcement: wanna exchange links? contact me at sapchatroom@gmail.com.

RE: [sap-dev] Add Zeros to a Field in Internal Table

Posted by Admin at
Share this post:
Ma.gnolia DiggIt! Del.icio.us Yahoo Furl Technorati Reddit

Reply from RBIrving on Dec 20 at 10:48 AM
Obviously there are a number of ways to do this. The steps are simple.

get rid of the unwanted characters.
repack with zeros.

If you don't know what the offending characters will be.


data: cnt type i,
num18(18) type n.

do 18 times.
if <field> co '0123456789 '.
exit.
endif.
if <field>+cnt(1) cn '0123456789'.
delete <field>+cnt(1) .
endif.

add 1 to cnt.

enddo.

** not sure if this is even necessary but it won't hurt.
shift <field> right.

then use your favorite method to repack the zeros.

<field> = num18 = <field>.


Ralph B Irving
Senior Programmer Analyst

---------------Original Message---------------
From: john.louk
Sent: Thursday, December 20, 2012 10:36 AM
Subject: Add Zeros to a Field in Internal Table

I believe it also had a dash in it. Also, we have not heard back from the OP as to whether any of the suggestions helped. Nor, has the OP anwsered any of the questions. This issue with the leading zeroes would be if the field was then going to be used to select data in SAP as leading zeroes with non-numeric value still in the field would not work in selecting SAP material data. Unless, you change SAP's conversion routine (MATN1) which is two function modules.

Honestly too me an easy solution (if you really had to do this; I am not sure that I see a reason to do this) is below.

It is a character field length 18.

Shift right deleting trailing space (check sfull statement syntax).

translate <field> using ' 0' (there is a blank space before the zero). or use the REPLACE cammand either is fine (check sfull statement syntax).

Cheers


John

 
Reply to this email to post your response.
 
__.____._
Manage Settings | Unsubscribe | Create FAQ | Send Feedback
  
Copyright © 2012 Ziff Davis, Inc. and message author.
Ziff Davis, Inc. 28 E 28th Street New York, NY 10016
RBIrving  
 
Mark as helpful
View this online
Ask a new question
 
In the Spotlight
Earn Recognition for Your Contributions at Toolbox for IT. Gain Points for Community Achievements

_.____.__

0 comments:

Post a Comment

T r a n s l a t e to your language