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: 

Double-byte parser

Former Member
0 Kudos
491

Hey,

I need to load in 400 character string of data into text using the FM SAVE_TEXT in chucks of 60 characters. If the user logs in Japanese, they could be loading in a mix of single byte and double characters. I need to be able to check if I break my string of data at the 60th character, will I be corrupting a double character.

Does anyone know how to perform this test in ABAP?

Thanks for the feedback! Bill

1 ACCEPTED SOLUTION

Former Member
0 Kudos
79

Hi Bill,

If you are on version 6.2+ you could try using the NUMOFCHAR( ) command.

I guess you could do something like:


* First determine the number of actual
* characters in 60th and 61st bytes.
w_num_of_chars = NUMOFCHAR( w_text+60(2) ).

* If there is only 1, then split on 59.
IF w_num_of_chars = 1.
  .
  .
  .
* Otherwise, we have two characters so we can split at 60.
ELSE.
  .
  .
  .
ENDIF.

I must admit I'm a complete novice when it comes to double byte languages and their handling, so that may just be complete gobbledegook.

Hope that helps.

Cheers,

Brad

1 REPLY 1

Former Member
0 Kudos
80

Hi Bill,

If you are on version 6.2+ you could try using the NUMOFCHAR( ) command.

I guess you could do something like:


* First determine the number of actual
* characters in 60th and 61st bytes.
w_num_of_chars = NUMOFCHAR( w_text+60(2) ).

* If there is only 1, then split on 59.
IF w_num_of_chars = 1.
  .
  .
  .
* Otherwise, we have two characters so we can split at 60.
ELSE.
  .
  .
  .
ENDIF.

I must admit I'm a complete novice when it comes to double byte languages and their handling, so that may just be complete gobbledegook.

Hope that helps.

Cheers,

Brad