2009 Apr 01 6:40 AM
hi frnds
I have a variable like itab-maktx which have this value
CONTINUOUS CAST COPPER WIRE ROD-8 MM
and i want output 8 MM so i want to splite it from - , so plz tel me how to spite from - and how to get 8 mm , and plz give solution which r dynamic , not harcoded
thnks
2009 Apr 01 6:48 AM
Hi Prasant,
Use the following syntax:
SPLIT itab-maktx AT '-' INTO v_desc v_measure.
You will get : v_desc = 'CONTINUOUS CAST COPPER WIRE ROD' , and
v_measure = '8 MM'.
Hope this helps,
Regards
Arnab.
2009 Apr 01 6:43 AM
2009 Apr 01 6:45 AM
HI,
Test the following Sample Code.
data: string1 TYPE string VALUE 'CONTINUOUS CAST COPPER WIRE ROD-8 MM',
string2 type string,
string3 TYPE string.
SPLIT string1 at '-' into string2 string3.
WRITE: / string2, / string3.
Best Regards,
Faisal
2009 Apr 01 6:48 AM
Hi Prasant,
Use the following syntax:
SPLIT itab-maktx AT '-' INTO v_desc v_measure.
You will get : v_desc = 'CONTINUOUS CAST COPPER WIRE ROD' , and
v_measure = '8 MM'.
Hope this helps,
Regards
Arnab.
2009 Apr 01 6:53 AM
2009 Apr 01 7:03 AM
Hi,
Try below code, it works only when the unit is at last letters in the string.
DATA : name1 TYPE string.
DATA : str TYPE i,
unt type i,
ch(4) TYPE c.
name1 = 'ABCT2XRYTURC2JADJABCDEFGHTURC 2TURCLLTUR-8 MM'.
str = STRLEN( name1 ).
unt = str - 4.
ch = name1+unt(4).
Regards
Bala Krishna