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

Concatenation

Former Member
0 Likes
1,028

Hi,

i write the logic for concatenates the material description with the characteristic values of the material.

Select single maktx into e_ vbap-arktx from makt where matnr = i_vbap- matnr.

Concatenate e_vbap-arktx ‘***’ I_VCSD_UPDATE_NEW- SDTEXT1 into e_vbap-arktx.

Concatenate value is SDTEXT1.

if Concatenate value is over 40 character i want to display the error message

" text more more than 40 characters".

Before checking this one condition is there.The MM functional spec should specify the parent (HALB) material be limited to 30 characters to allow enough space for the length in feet and length in inches characteristic to be appended. If this is not followed, the appended field should be truncated at 40 characters. A message will notify the user that the description was truncated at 40 characters.

How to calculate the character count?

Please give me replies?

Thanks & Regards,

sairam

9 REPLIES 9
Read only

Former Member
0 Likes
989

hi,

you can use FM STRING_LENGTH or STRLEN(Variable) and fin out the lengh of the string (Character count) and apply your conditions as per the logic..

regards

nazeer

Read only

Former Member
0 Likes
989

hi

you can know the number of characters by using the keyword STRLEN. by using this, you can know the length of each variable and do your calculations and specify conditions accordingly.

hope this helps.

thx

pavan

*pls reward for helpful answers

Read only

Former Member
0 Likes
989

sorry i am not enough clear about your query..

data : len type i,

vchar(15) type c value 'ABCGF'.

len = strlen( vchar ).

now len is 5.

regards

shiba dutta

Read only

Former Member
0 Likes
989

Hi,

i know how to calculate the string length.But i want to based on this condition

how to write the logic?

Thanks & Regards,

sairam

Read only

0 Likes
989

Hi..,

data :

wchar(75) type c value 'ABCGFasdfafrwevls;irjfsjoergsevfsdfverererererererr',

length type i.

length = strlen( wchar ).

if length gt 40.

wchar = w_char(40). "truncating to 40 characters..

message 'LEngth is more than 40 characters so it is truncated to 40' type 'I'.

endif.

regards,

sai ramesh

Read only

Former Member
0 Likes
989

hi

say for example, you want to get an output if the total length is more than 40.

you can write in this way..

len = strlen (var1) + strlen (var2) + strlen (var3).

if len > 40.

--

--

endif.

thx

pavan

*pls mark for helpful answer

Read only

Former Member
0 Likes
989

HI SAIRAM,

I WROTE THIS FOR YOU. JUS TAKE THE REFRENCE AND ENJOY.

REPORT ZVIJ_LENNTH_CHECKIN message-id zvijmsg.

DATA: LEN TYPE I.

DATA: ST_LEN1(75) TYPE C VALUE 'ABCDEFDFKJSKLFJKLJKLGFKL'.

DATA: ST_LEN2(76) TYPE C VALUE 'FKLSFJKLJGKSJGKASFJSKFJ'.

DATA: ST_LEN(150) TYPE C.

CONCATENATE ST_LEN1 ST_LEN2 INTO ST_LEN.

LEN = strlen( ST_LEN ).

.

*LEN = strlen( ST_LEN1 ) + STRLEN( ST_LEN2 ).

write: len.

if len gt 40.

ST_LEN = ST_len(40).

write: ST_LEN.

*message w002.

write: 'length is greater than 40 SO IT IS TRUNCATED'.

endif.

REGARDS

VIJAY

REWARDS*

Read only

Former Member
0 Likes
989

Thanks for all replies.I got a answer.Iam giving reward points to all.

Thanks & Regards,

sairam

Read only

Former Member
0 Likes
989

Thanku.