‎2007 Apr 12 9:19 AM
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
‎2007 Apr 12 9:24 AM
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
‎2007 Apr 12 9:24 AM
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
‎2007 Apr 12 9:24 AM
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
‎2007 Apr 12 9:30 AM
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
‎2007 Apr 12 9:36 AM
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
‎2007 Apr 12 9:33 AM
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
‎2007 Apr 12 10:46 AM
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*
‎2007 Apr 17 5:27 AM
Thanks for all replies.I got a answer.Iam giving reward points to all.
Thanks & Regards,
sairam
‎2007 Apr 17 5:45 AM