10-05-2007 2:45 PM
Hello,
i have a char field with length = 30
in this field there is a 4 characters long value
i have to write this field in a file but with the 26 leading spaces ahead.
basically, i have XXXX and i would like to have ______________XXXX
i tried to concatenate spaces but it does not work.
How can i manage that please ?
Thanks
10-05-2007 2:46 PM
Hi,
Try the following :
shift field right deleting trailing space
This should work.
Please reward points if this helps.
Regards,
Nicolas.
10-05-2007 2:46 PM
Hi,
Please try this.
DATA: NUM TYPE I,
TEXT(30) TYPE C.
TEXT = 'XXXX'.
NUM = STRLEN( TEXT ).
DO NUM TIMES.
SHIFT TEXT LEFT CIRCULAR.
ENDDO.
WRITE: / TEXT.
Regards,
Ferry Lianto
10-05-2007 2:46 PM
Hi,
Try the following :
shift field right deleting trailing space
This should work.
Please reward points if this helps.
Regards,
Nicolas.
10-05-2007 2:47 PM
Please see in the below sample code:
data: amount(9) type c,
numc_amount(9) type n.
If char field only contains numeric data
if amount co '0123456789 '. "Added a space in here!"
numc_amount = amount.
endif.
If the numc amount is filled.
if not numc_amount is initial.
Do something with it! (for example: WRITE)
write: / 'Number is: ' numc_amount.
endif.
Hope that helps.
Please give me reward points
Thanks
Murali Poli
10-05-2007 2:49 PM
Hi,
The Data Type Char is Left-Justified.
So u have to use SHIFT command to add leading Spaces.
<b>SHIFT STRING BY 26 PLACES RIGHT.</b>
Regards,
Padmam.
10-05-2007 2:49 PM
Hello,
try CONDENSE, it will delete the spaces before.
best regards.
10-05-2007 2:53 PM
Thanks a lot guys
the shift field right deleting trailing space command works just as i wanted it to