Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

strlen funuction

Former Member
0 Likes
1,086

Hi Experts

i have written peace code in that i have used sstrlen( ) but it is giving output as '*'.

it is terminated the program .

actually I have used the  strlen( ) in  internal tables two times first was giving correct length but not for second.

data : k ,l type ty_cust.

loop at itab assigning <kittu>.

k =  strlen( <kittu>-cust_name ).  "it is working fine

l = strlen( <kittu>-cust_addr ).  "this is giving output as '*'.

endloop.

what would be the problem ?

how can I resolve this .

7 REPLIES 7
Read only

sashwin
Advisor
Advisor
0 Likes
1,040

Hi,

what are the data types of cust_name and cust_addr?

-Ashwin

Read only

Former Member
0 Likes
1,040

both are CHAR data types.

Read only

Former Member
0 Likes
1,040

both are CHAR data types.

Read only

Former Member
0 Likes
1,040

Hi Balakrishnan,

In you code above data : k ,l type ty_cust.

you have declared l type ty_cust.

Can you make this as char or int.

regards,

Amit

Read only

Former Member
0 Likes
1,040

Hi Balakrishna,

The Strlen function takes value of char type only.

Kindly ensure that your cust_addr is of type char only.

length = STRLEN( variable ).” provides lenght of character variable

Regards,

Amit

Read only

Former Member
0 Likes
1,040

You should declare the size of  char  variable   l.

For example : Data: l(3)  type  c.

Read only

Former Member
0 Likes
1,040

Hi,

I and K variables in your case should be of type I(integer type).

check here.

http://help.sap.com/saphelp_nw2004s/helpdata/en/fc/eb37b2358411d1829f0000e829fbfe/content.htm