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 issue

AJeB
Participant
0 Kudos
2,891

why the last character is missing after split ?

this is just a sample.

DATA(text) = 1234567890,abcde.

SPLIT text AT ',' INTO res1-num res2-letter.


The length of the res1-num is 10 but after split it only get the 123456789

output:
res1-num = 123456789 "0 or last number is missing after split"
res2-lettter = abcde "resutl is correct"
___________________________________________________________________________________________
Code from debug

1 ACCEPTED SOLUTION
Read only

AJeB
Participant
2,798

reply from sandra.rossi

FFFE is the invisible character for UTF-16LE (little endian) Unicode Byte Order Mark (BOM). You should not include it in your text variable. The exact solution depends on what you do to load the text. Or if you don't want to know how it works, just remove this first character.

thanks for the idea
__________________________________________________________________________________________

already fix by changing the file

I changed the csv that I uploaded from the application server from CSV UTF8(Comma Delimited) to CSV (Comma Delimited) after that the HEX FFFE is not showing

17 REPLIES 17
Read only

xiswanto
Active Participant
0 Kudos
2,798

this quick test I've done contradicted with your statement which the last character before split is missing, are you sure your receiving field is defined correctly?

DATA(z_a1) = '1234567890,abcde'.
SPLIT z_a1 AT ',' INTO DATA(z_a2) DATA(z_a3).
Read only

AJeB
Participant
0 Kudos
2,798

yes it is defined correctly the length is correct, but I don't know why it is passing up to 9 characters only

the res1-num and res2-letter is from the structure, I checked the debug and the res1-num is receiving a wrong data

Read only

TarunTakshak
Participant
2,798

Hi bolivs22,

checked in debug getting exact output

DATA(text) = '1234567890,abcde'.
SPLIT text AT ',' INTO data(res1-num) data(res2-letter).
WRITE : res1-num,res2-letter.

Read only

0 Kudos
2,798

weird its not working on me

Read only

0 Kudos
2,798

bolivs22 share screenshot of debugging screen

Read only

0 Kudos
2,798

Here the <fs_data> is P000177154 but after the split it only pass the P00017715
Note: value of <fs_data> is coming from application server

Read only

matt
Active Contributor
0 Kudos
2,798

bolivs22

What is the full hex for WA_POCNF-ODOO_PO? And the first 12 characters of <FS_DATA>?

Read only

2,798

the full hex of wa_pocnf-odoo_po is FFFE500030003000300031003700370031003500

this is the hex of the first 12 characters of <fs_data> -> P000177154 = FFFE5000300030003000310037003700310035003400

Read only

2,798

bolivs22

FFFE is the invisible character for UTF-16LE (little endian) Unicode Byte Order Mark (BOM). You should not include it in your text variable. The exact solution depends on what you do to load the text. Or if you don't want to know how it works, just remove this first character.

That's the reason.

Read only

matt
Active Contributor
2,798

Darn, missed that!

Read only

gaddamarunkumar
Participant
0 Kudos
2,798

Hi Aaron,

can I know the data declaration of the res1-num?

Read only

0 Kudos
2,798

its just a sample I can't give you a data declaration for that
please see the reply from taruntakshak, I have debug screen shot

Read only

AJeB
Participant
0 Kudos
2,798

Hi gaddamarunkumarreddy
Its just a sample please see the answer in the comment below

Read only

Sandra_Rossi
Active Contributor
2,798

especially because dot and comma look very similar in the forum, Please edit your question (Actions>Edit), select your code and press the button [CODE], which makes the code appear colored/indented, it'll be easier for people to look at it. Thanks!

, and .

versus

, and .

dot and comma look very different in the two situations.

Read only

matt
Active Contributor
0 Kudos
2,798

Try this program:

REPORT.

DATA: BEGIN OF test,
field1 TYPE char10,
field2 TYPE char10,
END OF test.

DATA(input) = 'P000177154,127007'.

SPLIT input AT ',' INTO test-field1 test-field2.

WRITE: test-field2, test-field2.

Do you get the same issue?

Read only

AJeB
Participant
2,799

reply from sandra.rossi

FFFE is the invisible character for UTF-16LE (little endian) Unicode Byte Order Mark (BOM). You should not include it in your text variable. The exact solution depends on what you do to load the text. Or if you don't want to know how it works, just remove this first character.

thanks for the idea
__________________________________________________________________________________________

already fix by changing the file

I changed the csv that I uploaded from the application server from CSV UTF8(Comma Delimited) to CSV (Comma Delimited) after that the HEX FFFE is not showing

Read only

Sandra_Rossi
Active Contributor
0 Kudos
2,798

Thx for feedback and the good solution.