on 12-13-2007 6:22 AM
Hi all,
I have a string of certain chars... i wish to check if the number of characters is less than 35 chars, i will need to add blank spaces behind the string. How can i do this in SAPScript? I tried the below code but it does not work. Pls help.
DATA: Z_INT TYPE I,
SPACE_NO TYPE I.
Z_INT = STRLEN( FCOY_NAME ).
IF Z_INT < 35.
SPACE_NO = 35 - Z_INT.
ENDIF.
DO 20 TIMES.
CONCATENATE FCOY_NAME &SPACE& INTO FCOY_NAME.
ENDDO.
My requirement was to add 5 spaces in betwwen 2 strings and i wrote below code and it worked for me,
REPORT ztestttt.
DATA : kunnr TYPE kunnr,
vkorg TYPE vkorg,
text TYPE string.
DATA : lc(5) TYPE c VALUE ' '.
kunnr = 'W8400'.
vkorg = '2500'.
CONCATENATE kunnr vkorg INTO text SEPARATED BY lc.
WRITE : text.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
write as
<b>&FCOY_NAME(F )&</b> in ur script
This will put leading spaces if less dan 35 chars r present
Hope dis helps..
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Declare
constans : c_space type c value ' '.
notice..there's one space betn the inverted commas.If u want two spaces ,accordingly increase the length and give the value as ' '.i.e two spaces betn the inverted commas.
Then in concatanate statement use...
separated by c_space , at the end of the statement.
Hope this helps.
Regards
Rudra
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
85 | |
10 | |
9 | |
9 | |
6 | |
6 | |
6 | |
5 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.