‎2008 Feb 19 9:04 AM
Hello
I m making sapscript n one of tht field is 50 char long.
i wnt to use strlen func for getting length of that field .
hw cn i do this ?
if ne othr method is thr pls tell me...
Thanks in Advance.
‎2008 Feb 19 9:09 AM
Use the Key word STRLEN to find teh string length in the print program. And pass same value to SAP Script.
Thanks,
‎2008 Feb 19 9:16 AM
Hello,
Check this code:
DATA: STR(50) VALUE 'How to get string length? '.
DATA: LEN TYPE I.
LEN = STRLEN( STR ).
WRITE: LEN.
Cheers,
Vasanth
‎2023 Mar 07 3:47 PM
Adding:
It can be used also in conditional expressions
IF ( strlen( lv_all_mails ) + strlen( another_email ) ) LE 130.
CONCATENATE lv_all_mails another_email INTO lv_all_mails SEPARATED BY space.
ENDIF.
‎2008 Feb 19 9:17 AM
Hi,
Data : V_string(50) VALUE 'ABCDEFGH',
v_cnt TYPE I.
v_cnt = strlen( v_string ).
write : v_cnt.
Pls. reward if useful..
‎2008 Feb 19 9:25 AM
Hi ,
Use STRLEN .
For example
DATA: int TYPE i,
word1(20) TYPE c VALUE '12345',
word2(20) TYPE c ,
word3(20) TYPE c VALUE ' 4 '.
int = strlen( word1 ). WRITE int.
int = strlen( word2 ). WRITE / int.
int = strlen( word3 ). WRITE / int.
Hope this helps .
Regards,
Chandru