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 Function

Former Member
0 Likes
420

Hi Experts,

can any expert help me in providing me a sample code for the below logic.

Am working on BW.

Flatfile contains values like 16173 / 0180 / KLASSIK D/300 L258D VERN.

But the Result to be displayed should be only ---> 16173 / 0180 (Inbetween 2 numbers "/" is mandatory)

Please assist me.

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
392

hi ,

try this way...


w_string = '16173 / 0180 / KLASSIK D/300 L258D VERN'.

data : begin of itab occurs 0,
            w_char type chr60,
          end of itab.
data : w_cal type i.

spit w_string at '/' into table itab.

loop at itab .

w_cal = sy-tabix mod 2.

if w_cal eq 0.
   concatenate w_charout itab-w_char separated by '/' into w_charout .
   write w_charout .
   clear w_charout.   
else.
    move itab-w_char to w_charout.
endif.

endloop.

"The output is ..
 16173 / 0180 
 KLASSIK D/300 L258D VERN

Prabhudas

1 REPLY 1
Read only

Former Member
0 Likes
393

hi ,

try this way...


w_string = '16173 / 0180 / KLASSIK D/300 L258D VERN'.

data : begin of itab occurs 0,
            w_char type chr60,
          end of itab.
data : w_cal type i.

spit w_string at '/' into table itab.

loop at itab .

w_cal = sy-tabix mod 2.

if w_cal eq 0.
   concatenate w_charout itab-w_char separated by '/' into w_charout .
   write w_charout .
   clear w_charout.   
else.
    move itab-w_char to w_charout.
endif.

endloop.

"The output is ..
 16173 / 0180 
 KLASSIK D/300 L258D VERN

Prabhudas