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: 

Is there a text qualifiers in SAP that can handle SPLIT

Former Member
0 Kudos
305

Hi All,

The file is comma delimited, however the text fields are qualified by quotation marks, such as "NAME", "LAST", "AB,001"

How can SAP programmed so that it recognizes the quotation mark as text qualifier?

I am using a split command, but it fails when we have a comma in the field value...

Thanks,

Tatvagna.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
106

Hi,

The Following code will help, try and revert back;

DATA : STR(100) TYPE C VALUE '"NAME","LAST","AB,001"'.
DATA : NAME(10),LAST(10), VALUE(10).
DATA : LEN TYPE I.
SPLIT STR AT '","' INTO NAME LAST VALUE.
LEN = STRLEN( NAME ).
NAME = NAME+1(LEN).
LEN = STRLEN( VALUE ) - 1.
VALUE = VALUE+0(LEN).
WRITE : NAME, LAST,VALUE.

Regards

Karthik D

5 REPLIES 5

MarcinPciak
Active Contributor
0 Kudos
106

You can do it line by line, with FIND or SEARCH for phrase ", then split the line based on result and offset. Though, not state of art approach but should work.

Regards

MArcin

Former Member
0 Kudos
107

Hi,

The Following code will help, try and revert back;

DATA : STR(100) TYPE C VALUE '"NAME","LAST","AB,001"'.
DATA : NAME(10),LAST(10), VALUE(10).
DATA : LEN TYPE I.
SPLIT STR AT '","' INTO NAME LAST VALUE.
LEN = STRLEN( NAME ).
NAME = NAME+1(LEN).
LEN = STRLEN( VALUE ) - 1.
VALUE = VALUE+0(LEN).
WRITE : NAME, LAST,VALUE.

Regards

Karthik D

Former Member
0 Kudos
106

Don't remember how I solved this...was long time back

Former Member
0 Kudos
106

try this:

DATA: lv_file_rec TYPE string VALUE '"NAME", "LAST", "AB,001"'.

WRITE / LV_FILE_REC.

TRANSLATE lv_file_rec USING '" ' .

WRITE / lv_file_rec.

Output: NAME , LAST , AB,001

kiran_k8
Active Contributor
0 Kudos
106

Dude,REGEX can help you in achieving this.You can do a search in SDN using the key word REGEX to get more info.

Thanks,

K.Kiran.