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: 

HI simple query

Former Member
0 Kudos

Hi Guru,s

I had a requirement my string has data

ie V_data = REL FRE CTRD VRT

I want to store thm in a internal table as my internal table contains REL as seprate FRE as seperate ie

IT_DATA contains

REL

FRE

CTRD

VRT

Is there any FM which can perform this and after space it treats seprate character

Please send me dummy code

Regards

Hitesh

4 REPLIES 4

gopi_narendra
Active Contributor
0 Kudos
split v_data at SPACE into text1 text2 text3 text4.

You can make use of the SPLIT command

Check thsi sample code


DATA: names(30)    TYPE c VALUE 'You Me SAP',
      one(10)      TYPE c,
      two(10)      TYPE c,
      three(10)    TYPE c.

SPLIT names AT space INTO one two three.

WRITE : one.
WRITE : two.
WRITE : three.

Regards

Gopi

Former Member
0 Kudos

Hi,

The string you mentioned is the system status. If yes you can get the text as it is by calling a BAPI in which you can find the description of the field.

If this is the system status than this is a good way to do it else you have to hit two tables to get the description.

Thanks,

Mohit

Former Member
0 Kudos

data: begin of istruc,

one type string,

two type string,

three type string,

four type string,

end of istruc.

data: itab like table of istruc.

data: v_data type string value 'REL FRE CTRD VRT'.

split v_data at ' ' into istruc-one istruc-two istruc-three istruc-four.

append istruc to itab.

Former Member
0 Kudos

try this code...


PARAMETERS : P_TEXT(90).

DATA : BEGIN OF ITAB OCCURS 0,
       TEXT(15),
       END OF ITAB.

DATA : TEXT1(15)  ,TEXT2(30).
DATA : LEN TYPE I.

START-OF-SELECTION.
LEN = STRLEN( P_TEXT ).
DO LEN TIMES.
SPLIT P_TEXT AT SPACE INTO TEXT1 TEXT2.
REPLACE FIRST OCCURRENCE OF TEXT1 IN P_TEXT WITH SPACE.
CONDENSE P_TEXT.
ITAB-TEXT = TEXT1.
APPEND ITAB.
IF TEXT2 IS INITIAL.
 EXIT.
ENDIF.
ENDDO.

it may be helpful.

regards

shiba dutta