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

field split

Former Member
0 Likes
688

Hi Experts,

i have the field lenth 25. example kjsh89907 lfjii999k87hu48 i want to split the above value after tha space like

kjsh89907

fjii999k87hu48 and then i wnat store the value in another field.

can any one tell me pls.

Thanks & Best Regards,

Rakhi.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
650

try this FM : HR_ES_SPLIT_STRING_TO_4_CHAR50

e.g.

pass your string to string variable.

declare as:

string type string, "Local variable to store ARKTX(Short text for sales order item)

string1 type SY-MSGV1, "Message Variable

string2 type SY-MSGV1, "Message Variable

string3 type SY-MSGV1, "Message Variable

string4 type SY-MSGV1, "Message Variable

CALL FUNCTION 'HR_ES_SPLIT_STRING_TO_4_CHAR50'

EXPORTING

IN_STRING = WA_out-string

STR_LEN = 27

IMPORTING

CHAR1 = WA_out-string1

CHAR2 = WA_out-string2

CHAR3 = WA_out-string3

CHAR4 = WA_out-string4.

you van vary the STR_LEN value according to your needs.

Sid

4 REPLIES 4
Read only

Former Member
0 Likes
651

try this FM : HR_ES_SPLIT_STRING_TO_4_CHAR50

e.g.

pass your string to string variable.

declare as:

string type string, "Local variable to store ARKTX(Short text for sales order item)

string1 type SY-MSGV1, "Message Variable

string2 type SY-MSGV1, "Message Variable

string3 type SY-MSGV1, "Message Variable

string4 type SY-MSGV1, "Message Variable

CALL FUNCTION 'HR_ES_SPLIT_STRING_TO_4_CHAR50'

EXPORTING

IN_STRING = WA_out-string

STR_LEN = 27

IMPORTING

CHAR1 = WA_out-string1

CHAR2 = WA_out-string2

CHAR3 = WA_out-string3

CHAR4 = WA_out-string4.

you van vary the STR_LEN value according to your needs.

Sid

Read only

Former Member
0 Likes
650

see F1 help for SPLIT or search the forum with SPLIT, you will get lots of code samples.

Regards

Karthik D

Read only

Former Member
0 Likes
650

hai,

SPLIT text AT space INTO: str1 str2 str3,

TABLE itab.

or

try this

DATA: patt TYPE string VALUE ` `,

text TYPE string,

result_tab TYPE match_result_tab.

data: off(3) type c,

re(5) type c,

p1(15) type c,

p2(15) type c,

p(25) type c value `Everybody knowsthisisnowh`.

FIELD-SYMBOLS <match> LIKE LINE OF result_tab.

FIND ALL OCCURRENCES OF patt IN

p

RESULTS result_tab.

LOOP AT result_tab ASSIGNING <match>.

off = <match>-offset.

*WRITE: / <match>-offset, <match>-length.

ENDLOOP.

re = 25 - off.

write 😕 p0(off) , poff(re).

shan.

Read only

Former Member
0 Likes
650

Hi,

SPLIT string at space into str1 str2.

Thanks,

Kishore