ā2013 Jul 25 8:59 AM
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.
ā2013 Jul 25 1:10 PM
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!
ā2013 Jul 25 12:44 PM
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
ā2013 Jul 25 1:10 PM
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!
ā2013 Jul 29 6:45 AM
ā2013 Jul 25 1:13 PM
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.
ā2013 Jul 25 2:41 PM
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.
ā2013 Jul 27 8:04 AM
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
ā2013 Jul 25 2:55 PM
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.
ā2013 Jul 25 5:53 PM
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).
ā2013 Jul 25 6:29 PM
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.
ā2013 Jul 27 12:54 PM
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
ā2013 Jul 27 11:40 PM
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.
ā2013 Jul 29 6:09 AM
ā2013 Jul 29 6:27 AM
Hi Karthik,
You can use string as data type and put a limit 2000
ā2013 Jul 29 7:52 AM
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.