Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

SPLIT Command

I am trying to use the SPLIT command for splitting a field to an Internal table.I have added the code snippets in case 1 the program runs fine but in case 2 it creates a problem.When data is assinged manaully the split works fine but when I am uploading a fiel and trying to use the uploaded data it fails.

Any help in this regard is much appreciated.

CASE 1 :

TYPES : BEGIN OF gty_table,

field(1024) TYPE c,

END OF gty_table.

TYPES : BEGIN OF gty_tabl,

field1(10) TYPE c,

field2(10) TYPE c,

field3(10) TYPE c,

field4(10) TYPE c,

field5(10) TYPE c,

END OF gty_tabl.

DATA : gt_table TYPE STANDARD TABLE OF gty_table WITH HEADER LINE.

DATA : gt_tabl TYPE STANDARD TABLE OF gty_tabl WITH HEADER LINE.

gt_table-field = 'AUART#VKORG#VTWEG#KUNNR#MATNR#MENGE#MEINS#WERKS'.

READ TABLE gt_table INDEX 1.

SPLIT gt_table-field AT '#' INTO TABLE gt_tabl.

CASE 2 :

Table gt_table gets populated from a TXT file upload and has same data value as CASE 1 but doesnt work.

READ TABLE gt_table INDEX 1.

SPLIT gt_table-field AT '#' INTO TABLE gt_tabl.

Tags:
replied

Hi Gaurav,

The '#' you see in the file is not actually a # but it must be a Line feed character or a horozontal tab or a end of line indicator.

That is the reason the case 2 is failing.

so try your code with

SPLIT gt_table-field AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB INTO TABLE gt_tabl.

Regards,

Ravi

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question