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

how to splite data in a variable

former_member459142
Participant
0 Likes
841

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
Read only

Former Member
0 Likes
811

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
Read only

GauthamV
Active Contributor
0 Likes
811

Press F1 on SPLIT.

Read only

faisalatsap
Active Contributor
0 Likes
811

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

Read only

Former Member
0 Likes
812

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.

Read only

0 Likes
811

thanks all

problem solved

Read only

former_member585060
Active Contributor
0 Likes
811

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