Do you Know ?

Finding String Length in SAP ABAP.


Go to TCode : SE38 and maintain the program name as shown in figure.




And Then select “Create” option.



Click on Save .



Now if you want transport the object then you have to give the Package Name or
Else select the Local Object.


Same program Screen Shot.


 Code :
_____________________________________________________________________

DATA LENGTH TYPE I.
DATA S1 TYPE STRING.
S1 = 'SAPFIRST'.
LENGTH = STRLEN( S1 )." SPACE BEFORE AND AFTER FOR ( S1 ).
WRITE:/ LENGTH.

 _____________________________________________________________________________________________

Note: SAP ABAP is nOt a CaSE SeNSitive LaNGuAGe J.

Maintain the code and then save the program.

Press Ctrl+S to save the program.

Press Ctrl+F2 to check for syntax errors.

And then

Press Ctrl+F3 to activate the program.

While activating the program, list of Objects will be displayed.

Simply Press Enter.

Object will be activated.

Press F8 to view the output.

Note: F8 is for Execution of program.



Here ‘8’ is the output as SAPFIRST contains 8 characters.


That’s all Folks J.