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

Error in Data Declaration

aaruljothi
Participant
0 Likes
2,116

Hi,

I have declared the following data.

CONSTANTS: con_cret TYPE x VALUE '0D',

con_tab TYPE x VALUE '09'.

when checking the programs for syntax errors i got the following error,

"con_tab" must be a character-type data object (data type C, N, D, T os String).field string).

Pls help me in rectifing this

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,685

hi,

u can remove this error by unchecking the unicode check active in attributes ( goto -> attributes ) .

16 REPLIES 16
Read only

Former Member
0 Likes
1,685

Hi,

What are you using <b>con_tab</b> for ?

The declaration seems to be OK.

Svetlin

Read only

0 Likes
1,685

I am using con_tab in the following code,

LOOP AT itab1 INTO wa_tab.

CONCATENATE wa_tab-field1 wa_tab-field2

... wa_tab-fieldn

INTO itab2 SEPARATED BY con_tab.

CONCATENATE con_ret itab2INTO itab2.

APPEND itab2.

ENDLOOP.

Read only

0 Likes
1,685

Hi,

If you are on greater than 4.6C version, you should use

CL_ABAP_CHAR_UTILITIES static parameters, intead of hex values.

CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB

P.S. If you find some answers useful, please assign reward points.

Svetlin

Message was edited by: Svetlin Rusev

Read only

0 Likes
1,685

HI ARUL,

BINGO!!! HERE IS THE SOLUTION.

First of all the error is not in the declaration part. The error is in this line.

<b>CONCATENATE wa_tab-field1 wa_tab-field2

... wa_tab-fieldn

INTO itab2 SEPARATED BY con_tab.</b>

Remember you can't use string operators like concatenate with TYPE X.

So change the declaration of con_tab as C and then try.

Else, have another variable declared as

DATA: con_tab1 type c.

Move the character value of the X type con_tab to con_tab1.

and then use the statement,

<b>CONCATENATE wa_tab-field1 wa_tab-field2

... wa_tab-fieldn

INTO itab2 SEPARATED BY CON_TAB1.</b>

Cheers,

Sam

Read only

0 Likes
1,685

Perhaps the problem is the CONCATENATE... from help:

..., you can only use character-type operands here

Read only

0 Likes
1,685

hi,

How to reward points. I am new to this forum. Pls bear with me

Read only

0 Likes
1,685

click on the radio buttons on the left side.

Regards

Raja

Read only

0 Likes
1,685

not against your name (post)

click on the radio button in the post which solved your issue.

you can also reward other posts within the same thread with helpful or very helpful

Regards

Raja

Read only

0 Likes
1,685

Hi,

If any reply has helped you solve the problem, you can scroll to those replies and choose the radio buttons on the left (any 1) and award points as to how helpful was the answer. (also remember <b> not to check the option solved on my own</b> in such cases )

Also, please lemme know if my answer helped you and if so reward points for the same.

Cheers,

Sam.

Read only

0 Likes
1,685

I think that everyone should aware of this.

https://www.sdn.sap.com/sdn/index.sdn?page=crp_help.htm.

Svetlin

Read only

0 Likes
1,685

i used to direct people to this weblog by mark

/people/mark.finnern/blog/2004/08/10/spread-the-love

Regards

Raja

Read only

Vinod_Chandran
Active Contributor
0 Likes
1,685

I am not getting any error for this in 4.7

Read only

Former Member
0 Likes
1,685

I'm working on 4.6C and not obtain your syntax error.

So (for my release) your data declaration is ok.

Which is your release?

Read only

Former Member
0 Likes
1,685

Could you be specific where you used it as it does not give any error for us.

Karthik

Read only

Former Member
0 Likes
1,685

Try giving data type as string instead of 'X'

Regards

Ashish

Read only

Former Member
0 Likes
1,686

hi,

u can remove this error by unchecking the unicode check active in attributes ( goto -> attributes ) .