‎2020 May 22 4:27 AM
CONSTANTS : lv_string type char40 value 'we%123456789 gift%happy birthday',
lv_c1 TYPE char03 VALUE 'we%',
lv_c2 TYPE char03 VALUE 'gift%'.
data: str1 type string,
str2 type string,
s1 type string,
s2 type string.
SPLIT : lv_string at ' ' into str1 str2,
str1 at lv_c1 into s,
str2 at lv_c2 into s2.
write:/ str1.
write:/ str2.
write:/ s1.
write:/ s2.
Can any one correct my code? it showing error.
‎2020 May 22 5:32 AM
Hello naveena_10,
There were few errors, you can use the below code which i hope satisfies your requirement.
CONSTANTS : lv_string TYPE char40 VALUE 'we%123456789 gift%happy birthday',
lv_c1 TYPE char03 VALUE 'we%',
lv_c2 TYPE char05 VALUE 'gift%'. --> There was error here in Data type declaration.
DATA: str1 TYPE string,
str2 TYPE string,
s1 TYPE string,
s2 TYPE string,
s3 TYPE string,
s4 TYPE string.
SPLIT : lv_string AT ' ' INTO str1 str2,
str1 AT lv_c1 INTO s1 s2, --> You failed to provide two variables as destination
str2 AT lv_c2 INTO s3 s4. --> You failed to provide two variables as destination
WRITE:/ str1.
WRITE:/ str2.
WRITE:/ s1.
WRITE:/ s2.
WRITE:/ s3.
WRITE:/ s4.Regards!
‎2020 May 22 5:32 AM
Hello naveena_10,
There were few errors, you can use the below code which i hope satisfies your requirement.
CONSTANTS : lv_string TYPE char40 VALUE 'we%123456789 gift%happy birthday',
lv_c1 TYPE char03 VALUE 'we%',
lv_c2 TYPE char05 VALUE 'gift%'. --> There was error here in Data type declaration.
DATA: str1 TYPE string,
str2 TYPE string,
s1 TYPE string,
s2 TYPE string,
s3 TYPE string,
s4 TYPE string.
SPLIT : lv_string AT ' ' INTO str1 str2,
str1 AT lv_c1 INTO s1 s2, --> You failed to provide two variables as destination
str2 AT lv_c2 INTO s3 s4. --> You failed to provide two variables as destination
WRITE:/ str1.
WRITE:/ str2.
WRITE:/ s1.
WRITE:/ s2.
WRITE:/ s3.
WRITE:/ s4.Regards!
‎2020 May 22 9:05 AM
Please use the CODE button to format your code so that it's shown in a more user-friendly format (colorized).