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

Syntax Error

Former Member
0 Likes
1,305

Hi we are upgrading to Ecc 6 from 4.6 and have the following Syntax error.

The Error is - "HT" must be a character-type data object (data type C, N, D, T or STRING)

data declaration,

DATA: BEGIN OF ht,

x(1) TYPE x VALUE '09',

END OF ht.

DATA: BEGIN OF itab1x,

condition_id(10) TYPE c,

change_date(10) TYPE c.

DATA: END OF itab1x.

DATA: BEGIN OF itab1 OCCURS 0,

condition_id(10) TYPE c,

change_date(10) TYPE c.

DATA: END OF itab1.

the error is at,

SPLIT fieldy AT ht INTO

itab1x-condition_id

itab1x-change_date.

MOVE-CORRESPONDING itab1x TO itab1.

APPEND itab1.

ANy Suggestions please.

Thanks,

Raju..

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Likes
1,279

Have you tried:

SPLIT fieldy AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB INTO itab1x-condition_id itab1x-change_date.

matt

12 REPLIES 12
Read only

Former Member
0 Likes
1,279

you should try writing ht in quotes like 'ht' try it once

Read only

Former Member
0 Likes
1,279

hi ,

it will not allow the type x check it and let me know..

regards,

venkat.

Read only

Former Member
0 Likes
1,279

You can't use the type x variable because of the unicode in ECC.

What is the real value of '09'? You could replace it with a method in cl_abap_char_utilities?

I also heard there's a type CVALUE to define chars the same way you did it with variable x, try it that way, I'm also in 4.6 and can´t check it

Read only

0 Likes
1,279

ANy More suggestions.

I am still Unable to get this.

If this dosent work what would be an alternative for this.

Raju.

Read only

matt
Active Contributor
0 Likes
1,280

Have you tried:

SPLIT fieldy AT CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB INTO itab1x-condition_id itab1x-change_date.

matt

Read only

Former Member
0 Likes
1,279

Thanks Matthew,

What would be the data Declaration for this.

I see you didnt use ht in the split statement.

Thanks,

Raju.

Read only

Former Member
0 Likes
1,279

Any More Suggestions.

Raju...

Read only

Former Member
0 Likes
1,279

try declaring x as type xstring

But matthew's suggestion is the right way to do it in ECC, it should work

Edited by: Ramiro Escamilla on Feb 25, 2008 5:00 PM

Read only

matt
Active Contributor
0 Likes
1,279

You don't need a declaration, you use CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB precisely as I've stated.

matt

Read only

Former Member
0 Likes
1,279

Thanks All.

Thanks Matthew. The problem is solved but I am still wondering where are we splitting now and how does the statement you have specified works.

Thanks,

Raju.

Read only

matt
Active Contributor
0 Likes
1,279

You're splitting at the horizontal tab character represented in hex as x09. You can reference any public constant (a_constant) of some class (cl_class) using the following syntax:

cl_class=>a_constant. It's standard ABAP syntax.

In this case you are accessing the constant public attribute HORIZONTAL_TAB of class CL_ABAP_CHAR_UTILITIES. This constant was provided specifically by SAP to address the fact that in a unicode system you can't use the "ht" approach you tried anymore.

If you look at class CL_ABAP_CHAR_UTILITIES, you'll see useful methods, and other attributes you can use; e.g. NEWLINE.

matt

Read only

Former Member
0 Likes
1,279

Hi,

Check the following link:

http://www.sap-img.com/abap/doubt-in-unicode-enabling.htm

Regards,

Bhaskar