Application Development 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: 

SPLIT - Delimiter Not Found

Former Member
0 Kudos

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

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

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

Regards,

Rich Heilman

3 REPLIES 3

RichHeilman
Developer Advocate
Developer Advocate
0 Kudos

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

Regards,

Rich Heilman

0 Kudos

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

0 Kudos

Thanks.