2007 Mar 14 12:35 PM
Hi all,
I want some solution regarding truncation.
Currently I am having a variable A with data type NUMC (5).
If A =00000, then it should display blank
If A = 00006, then it should display only 6
If A = 00012, then it should display only 12.......and likewise.
Please provide me necessary solution.
Regards,
Mainak
one more variation is
<b>data : a(5) type n ,
b(5) type c .
a = b = '0'.
write:/ a no-zero. " you can use no-zero in the write
write:/ b.</b>
2007 Mar 14 12:37 PM
Hi,
Declare a variable with data type C for first value i,e to display space when it is 0000 and for other values display four variables with data type I and move the values accordingly and display them.
Regards,
Anji
2007 Mar 14 12:37 PM
Take a look at the no-zero command.
Or you could move to a field of type C then do
SHIFT <FIELD> LEFT DELETING LEADING '0'.
Message was edited by:
Martin Shinks
2007 Mar 14 12:40 PM
Hi,
You can use <b>write numc no-zero.</b> option.
Otherwise.
Do the following.
<b>DATA: CHAR(5) , N(5) TYPE N.
CHAR = N.
DO 5 TIMES.
IF CHAR+SYINDEX(1) = '0'.
CHAR+SYINDEX(1) = ' ' .
ELSE.
EXIT.
ENDDO.
CONDENSE CHAR.</b>
Reward if my answer helps you.
Regards,
Sandhya
2007 Mar 14 12:40 PM
Hi,
There are 3 ways .
1. Use CONVERSION_EXIT_ALPHA_OUTPUT each time before you print it. along with no-zeroes option of write statement.
2. Change the datatype
3. Create one more variable of type i, and assign this variable a to newly created variable and then print newly created variable.
Hope that helps.
Regards
Kapadia
***Assigning points is the way to say thanks in SDN.***
2007 Mar 14 12:41 PM
Execute the code .
data : a(5) type n ,
b(5) type c .
a = b = '5'.
write:/ a.
write:/ b.assign it to a char dataype and use this in the display instead of numc.
regards,
vijay
2007 Mar 14 12:41 PM
2007 Mar 14 12:42 PM
one option is move this value to character variable and replace all zeroes with spaces.
I mean :
data B(5) type c.
move a to b.
And then replace zeroes with spaces.
regards,
G@urav.
2007 Mar 14 12:46 PM
one more variation is
<b>data : a(5) type n ,
b(5) type c .
a = b = '0'.
write:/ a no-zero. " you can use no-zero in the write
write:/ b.</b>
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |