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: 

Ztable not activated while using standard data type char2000

Former Member
0 Kudos
1,674

Hi All,

I need to create a field which can acquire 2000 characters.

I used the standard data type char2000.

But there are errors while activating the table.

Please give your Suggestions.

1 ACCEPTED SOLUTION

AbhishekV
Explorer
0 Kudos
315

Hi Karthik,

You can create the field by using LCHR datatype.
In this case you would also need to create an additional field(type INT2) where you would
be storing the length of the value.

So, consider if your field (type LCHR) is 'XYZ' then to the store the length of the data
contained in this field 'XYZ' another field (of type INT2) has to be created.

Refer the database table 'APQD' to understand it better!Hope this helps you!

14 REPLIES 14

Former Member
0 Kudos
315

Hi Karthik,

A field in a transparent table can have maximum length of 1333.

"CHAR: Character string. Fields of type CHAR can have a maximum length of 1333 in tables"

Please go through the link below :

http://help.sap.com/saphelp_nw70/helpdata/en/cf/21f2e5446011d189700000e8322d00/content.htm

Regards,

Akshay Ruia

AbhishekV
Explorer
0 Kudos
316

Hi Karthik,

You can create the field by using LCHR datatype.
In this case you would also need to create an additional field(type INT2) where you would
be storing the length of the value.

So, consider if your field (type LCHR) is 'XYZ' then to the store the length of the data
contained in this field 'XYZ' another field (of type INT2) has to be created.

Refer the database table 'APQD' to understand it better!Hope this helps you!

Former Member
0 Kudos
315

excellent answer karthik

Former Member
0 Kudos
315

The Maximum length of the fields in a transparent table  is limited to 1962. Including all the fields in the table.

You are trying to create a single field with character Length 2000 which is not supported.

former_member184569
Active Contributor
0 Kudos
315

CHAR: Character string. Fields of type CHAR can have a maximum length of 1333 in tables. If you want to use longer character fields in tables, you must choose data type LCHR. There are no restrictions on the length of such fields in structures.

LCHR: Character string of any length, but has to be declared with a minimum of 256 characters. You must locate fields of this type at the end of transparent tables (in each table there can be only one such field) and must be preceded by a length field of type INT2. If there is an INSERT or UPDATE in ABAP programs, this length field must be filled with the length actually required. If the length field is not filled correctly, this leads to a data loss in the LCHR field. Fields of this type cannot be used in the WHERE condition of a SELECT statement.


http://help.sap.com/erp2005_ehp_04/helpdata/en/cf/21f2e5446011d189700000e8322d00/content.htm

So you can use datatype LCHR, just that it should be the last field.

You can also refer this link which shows some technical specifications

http://www.sapdb.org/htmhelp/32/60a014540911d5a9fd00a0c9449261/content.htm

After making the changes, if its still not activating, go to SE14, correct structure and activate the ztable.

0 Kudos
315

Hi Susmitha,

Thanks For your useful links. Actually I am inserting the table from my coding. I am using Concatenate statement to insert the field value.

The problem is even though I declared the field by LCHR. during my debug I am getting only 261 char in that field.

For ex.

data : lv_1 type string,

          lv_2 type string,

          lv_3 type ztable-field1.  " field is declared in table as LCHR type

concatenate lv_1 lv_2 into lv_3.

in this case I am getting only 261 char.

more than 261 char is not inserting into lv_3.

After Inserting, I am sending this Via Function module.

So I can able to send only 261 char only.

My requirement is I need to Insert into Table and then send via RFC.

Regards,

karthik

Former Member
0 Kudos
315

Hello,

Use string type. it is the best option. Char2000 will not come at all. and something came like char1000 etc it will make ur table too bulky to work.

sjeevan
Active Contributor
0 Kudos
315

Declare your field in Z-table something similar to field KNBLK from table CUKN (checkout it's data element KNBLKN to figure out the Elementary type domain).

anilkumar_kalkivai
Active Participant
0 Kudos
315

Hi,

Below links may help you,

http://scn.sap.com/thread/1225569

http://scn.sap.com/thread/1110840

Change accordingly and also adjust your table in SE14 Tcode.

Regards,

Anil.

former_member491621
Contributor
0 Kudos
315

Hi Karthik,

You can also opt for string type of data element.

Please see the below link for your reference.

http://scn.sap.com/thread/866656

Hope this helps

Former Member
0 Kudos
315

Hi Karthik,

You can use a string as shown below. But a limitation is that you can't generate a maintenance for your table, as strings can't be taken as declarative components to show on screens.

Thanks.

former_member209120
Active Contributor
0 Kudos
315

Hi Karthik

Try like this

it is working

aarif_baig
Active Participant
0 Kudos
315

Hi Karthik,

               You can use string as data type and put a limit 2000

AbhishekV
Explorer
0 Kudos
315

Hi Karthik,

You can use string2000 as the type for declaring the field.

Now similar to the length field of type int2 that was required for LCHR field,you declare a

length field before the String2000 field that you have declared.

In code insert the contents of the fields in work area and insert it to the database table.

For instance, if 'length' is the int2 field and 'data' is the string2000 field declared in ztable then:

Concatenate  'hello karthik'

                    'how are you'

                    'We are trying to resolve the issue'

                    'lets work together on this issue'

                    into wa_ztable-data.

wa_ztable-length = strlen ( wa_ztable-data)

Insert ztable from wa.