08-12-2005 9:35 AM
hi all
i am facin one prblm..
i have an item in output like;
0010
0020
0030
.
.
0100
i have to delete the zero and to write the utput like:
1,2,3,,,10
can anyone please suggest..itw ill be great help
thanks
08-12-2005 9:47 AM
hi maheswari,
if u r goin to display that in report, you can simple make use of offset concept.
item = '0100'.
write item+0(3).//to avoid the trailing zero.
to avaoid even the leading zeroes,
write item+1(2).
Lemme know it soleved ur problem.
with regards,
praveen.
08-12-2005 9:47 AM
hi maheswari,
if u r goin to display that in report, you can simple make use of offset concept.
item = '0100'.
write item+0(3).//to avoid the trailing zero.
to avaoid even the leading zeroes,
write item+1(2).
Lemme know it soleved ur problem.
with regards,
praveen.
08-12-2005 9:53 AM
hi praveen
thanks for reply but i have to avoid both the trailing and the leading zeros .for ex;
if item is:
00100.
then output should be like: 1.
And if item is 0100.
the output should be like:10
any sugesstion plz.
thanks
08-12-2005 9:55 AM
08-12-2005 9:55 AM
another way.
shift <item> left deleting leading '0'.
shift <item> right deleting trailing '0'.
write:/ item .
Regards
Raja
08-12-2005 10:22 AM
Hi Anu,
Although the question has been marked answered,I would still like to add this to the list of solutions. You might also try something more straight forward provided by SAP, in case you wish to remove the leading zeroes.
There is a variant of WRITE statement:-
<b>WRITE <i><variable></i> NO-ZERO.</b>
If the contents of <i><variable></i> are equal to zero, only blanks are output; if <i><variable></i> is of type C or N, leading zeros are replaced by blanks.
Try the following code, see if the second list matches your desired list.
DATA: BEGIN OF itab OCCURS 0,
c(5),
END OF itab.
itab-c = '0010'.
APPEND itab.
itab-c = '0020'.
APPEND itab.
itab-c = '0030'.
APPEND itab.
itab-c = '0040'.
APPEND itab.
itab-c = '0050'.
APPEND itab.
itab-c = '0060'.
APPEND itab.
itab-c = '0070'.
APPEND itab.
itab-c = '0080'.
APPEND itab.
itab-c = '0090'.
APPEND itab.
itab-c = '0100'.
APPEND itab.
itab-c = '0110'.
APPEND itab.
LOOP AT itab.
WRITE 😕 itab.
ENDLOOP.
ULINE.
LOOP AT itab.
WRITE 😕 itab NO-ZERO.
ENDLOOP.
Hope this helps,
Best Regards,
Sanyam