Application Development 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: 

how to splite data in a variable

former_member459142
Participant
0 Kudos
136

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

1 ACCEPTED SOLUTION

Former Member
0 Kudos
106

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.

5 REPLIES 5

GauthamV
Active Contributor
0 Kudos
106

Press F1 on SPLIT.

faisal_altaf2
Active Contributor
0 Kudos
106

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

Former Member
0 Kudos
107

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.

0 Kudos
106

thanks all

problem solved

former_member585060
Active Contributor
0 Kudos
106

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