‎2008 Oct 14 9:22 AM
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.
‎2008 Oct 14 9:43 AM
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
‎2008 Oct 14 9:43 AM
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
‎2008 Oct 14 9:45 AM
see F1 help for SPLIT or search the forum with SPLIT, you will get lots of code samples.
Regards
Karthik D
‎2008 Oct 14 9:50 AM
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.
‎2008 Oct 14 12:11 PM