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

SPLIT - Delimiter Not Found

Former Member
0 Likes
997

Hi,

This is my split statement...

<b>SPLIT line AT delimiter INTO cur_ticket_num line.</b>

I want to catch if delimiter is not found in 'line'.

How can I achieve this?

Thanks,

Audrey

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
684

Use the SEARCH statement first, check sy-subrc, then do your SPLIT.

Regards,

Rich Heilman

3 REPLIES 3
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
685

Use the SEARCH statement first, check sy-subrc, then do your SPLIT.

Regards,

Rich Heilman

Read only

0 Likes
684

Here is some sample code.




data: s type string.
data: x type string.
data: y type string.

s = '12345,67890'.

search s for ','.
if sy-subrc = 0.
  split s at ',' into x y.
  write:/ 'Value X', x, 'Value Y', y.
else.
  write:/ 'Delimiter not found'.
endif.

Regards,

Rich Heilman

Read only

0 Likes
684

Thanks.