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

material code lenght

Former Member
0 Likes
757

hi,

i use the strlen function to measure the length of the material code. but, it returns an syntax error. Is there any other function that i can use??

6 REPLIES 6
Read only

JoffyJohn
Active Contributor
0 Likes
728

len = strlen( mara-matnr ).

in len field you will get the length of material code

Read only

Former Member
0 Likes
728

i tried it before, it returns

the field "STRLEN" is unknown, but there is a field with the similar name 'SLEN'.



  DATA:  MATLEN TYPE I.

  READ TABLE IT_CHARDATA INDEX COUNTER.
  CONCATENATE 'abc' IT_CHARDATA-LINE+4 INTO L_TEMPITEM-MATERIAL.

  MATLEN = STRLEN(L_TEMPITEM-MATERIAL).


Read only

Former Member
0 Likes
728

DATA:  MATLEN TYPE I.
 
  READ TABLE IT_CHARDATA INDEX COUNTER.
  CONCATENATE 'abc' IT_CHARDATA-LINE+4 INTO L_TEMPITEM-MATERIAL.
 
  MATLEN = STRLEN( L_TEMPITEM-MATERIAL ).
 

one space after ( and

one space before ).

regards

shiba dutta

Read only

Former Member
0 Likes
728

hi,

use code as below :

DATA: MATLEN TYPE I,

L_TEMPITEM-MATERIAL type mara-matnr.

concatenate 'abc' '1234' into L_TEMPITEM-MATERIAL.

  • FIND LENGTH OF A STRING

MATLEN = STRLEN( L_TEMPITEM-MATERIAL ). " Space after ( and before )

WRITE:/ 'LENGTH OF', L_TEMPITEM-MATERIAL, 'IS', MATLEN." Commas

Regards,

Sandeep Kaushik

Read only

Former Member
0 Likes
728

Hi

Try like this

DATA: w_len TYPE i.

w_len = STRLEN( v_pattern2 ).

Or else use this functionmodule SWA_STRINGLENGTH_GET

Regards

Pavan

Read only

Former Member
0 Likes
728

There should be a space between brackets


  DATA:  MATLEN TYPE I.
 
  READ TABLE IT_CHARDATA INDEX COUNTER.
  CONCATENATE 'abc' IT_CHARDATA-LINE+4 INTO L_TEMPITEM-MATERIAL.
 
  MATLEN = STRLEN( L_TEMPITEM-MATERIAL ).