10-08-2007 9:01 AM
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
10-08-2007 9:04 AM
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
10-08-2007 9:24 AM
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
10-08-2007 9:35 AM
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.
10-08-2007 10:36 AM
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