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 at # ?

Former Member
0 Likes
611

Hello,

Ik have some sentence like this:

welke bevestiging wenst u?: wandbeugel#Wilt u geluid bij uw plasma?: ja#Welke bron gaat u op de plasma aansluiten?: PC/Laptop#ja

I need it to be split at every # into new filed of it_table

Can some one help me please?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
581
REPORT YCHATEST LINE-SIZE 350.

DATA : V_STRING TYPE STRING.

DATA : BEGIN OF ITAB OCCURS 0,
         STR(100),
       END OF ITAB.

V_STRING = 'welke bevestiging wenst u?: wandbeugel#Wilt u geluid bij uw plasma?: ja#Welke bron gaat u'.

SPLIT V_STRING AT '#' INTO TABLE ITAB.

LOOP AT ITAB.
  WRITE : / ITAB-STR.
ENDLOOP.
5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
581

The # may be representing a tab or other non-printable character, in this case you must use the hex value or the attribute from class CL_ABAP_CHAR_UTILITIES.

split str at CL_ABAP_CHAR_UTILITIES=>horizontal_tab into it_table-field1
                                                                                it_table-field2
                                                                                it_table-field3.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
581

do like that

LOOP AT itab1.

SPLIT itab1 AT ',' INTO:

itab-osek_morsh

itab-company_name

itab-company_code.

APPEND itab.

ENDLOOP.

if u dont understand try to write in english and i try ti help

regards

Read only

Former Member
0 Likes
581

Hello,

Use Command like :

SPLIT string AT '#' INTO TABLE it_table.

this will give you internal table field with lines of split-parts of string.

Thanks.

Read only

Former Member
0 Likes
582
REPORT YCHATEST LINE-SIZE 350.

DATA : V_STRING TYPE STRING.

DATA : BEGIN OF ITAB OCCURS 0,
         STR(100),
       END OF ITAB.

V_STRING = 'welke bevestiging wenst u?: wandbeugel#Wilt u geluid bij uw plasma?: ja#Welke bron gaat u'.

SPLIT V_STRING AT '#' INTO TABLE ITAB.

LOOP AT ITAB.
  WRITE : / ITAB-STR.
ENDLOOP.
Read only

0 Likes
581

@chandrasekhar j...

TKANKS!!