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 command not working

0 Kudos

Hi Experts,

I am uploading a note pad file separated with tab to application server using CG3Z.

Please find the screen shot of CG3Z from attachment.

But while using :

TYPES : BEGIN OF tys_strc,

   bp_num(10) TYPE c,

   reltyp(6) TYPE c,

   partner2(10TYPE c,

   pavip(1) TYPE c,

   abtnr(4) TYPE c,

   pafkt(4) TYPE c,

   paauth(1) TYPE c,

   parem(40) TYPE c,

   fnctn(40) TYPE c,

   dprtmnt(40) TYPE c,

   roomnum_c(10) TYPE c,

   floor_c(10) TYPE c,

   building_c(10) TYPE c,

   tel_number(30) TYPE c,

   tel_extens(10) TYPE c,

   mob_number(30) TYPE c,

   fax_number(30) TYPE c,

   fax_extens(10) TYPE c,

   smtp_addr(241) TYPE c,

   END OF tys_strc.

IF sy-subrc EQ 0.

   DO.

     READ DATASET file_path INTO lv_str.

     IF sy-subrc <> 0.

       EXIT.

     ELSE.

* Data coming to lv_str with separator '#'.

SPLIT lv_str AT '#' INTO lwa_strc-bp_num lwa_strc-reltyp lwa_strc-partner2 lwa_strc-pavip

                                lwa_strc-abtnr

                                lwa_strc-pafkt

                                lwa_strc-paauth

                                lwa_strc-parem

                                lwa_strc-fnctn

                                lwa_strc-dprtmnt

                                lwa_strc-roomnum_c

                                lwa_strc-floor_c

                                lwa_strc-building_c

                                lwa_strc-tel_number

                                lwa_strc-tel_extens

                                lwa_strc-mob_number

                                lwa_strc-fax_number

                                lwa_strc-fax_extens

                                lwa_strc-smtp_addr.

       APPEND lwa_strc TO lt_strc.

ENDIF.


Problem: Here in split command only BP number is coming into the structure.


Please Help.


Thanks.....

1 ACCEPTED SOLUTION

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Split using cl_abap_char_utilities=>horizontal_tab .

Regards.

3 REPLIES 3

rosenberg_eitan
Active Contributor
0 Kudos

Hi,

Split using cl_abap_char_utilities=>horizontal_tab .

Regards.

Former Member
0 Kudos

Hi Amit,

Tabs are represented by # while doing a debugging.

Try split lv_str at CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB into

                                 lwa_strc-bp_num

                                 lwa_strc-reltyp

                                 lwa_strc-partner2

                                 lwa_strc-pavip

                                lwa_strc-abtnr

                                lwa_strc-pafkt

                                lwa_strc-paauth

                                lwa_strc-parem

                                lwa_strc-fnctn

                                lwa_strc-dprtmnt

                                lwa_strc-roomnum_c

                                lwa_strc-floor_c

                                lwa_strc-building_c

                                lwa_strc-tel_number

                                lwa_strc-tel_extens

                                lwa_strc-mob_number

                                lwa_strc-fax_number

                                lwa_strc-fax_extens

                                lwa_strc-smtp_addr.

       APPEND lwa_strc TO lt_strc.

ENDIF.

Hope it will be helpful for you.

Regards,

Kannan

Former Member
0 Kudos

data : lt_string type string.


SPLIT  lt_strc AT cl_abap_char_utilities=>newline INTO TABLE lt_string.

Thanks.