08-06-2008 5:57 AM
Hi,
I am new in ABAP. So Please guide me how to find out the length of a particular field and also give the function name with example.
Ram Shanker
08-06-2008 6:10 AM
Hi,
Here we use STRLEN for determinig the lenth of a field.
Even we use DESCRIBE statement.
DESCRIBE FIELD A LENGTH L.
DATA: WORD1(10) TYPE C VALUE 'STRINGA',
WORD2(20) TYPE C VALUE 'STRINGB',
I1 TYPE I.
I1 = STRLEN( WORD1 ) + STRLEN( WORD2 ).
WRITE: I1.
Hope this helps.
thanx,
dhanashri
Edited by: Dhanashri Pawar on Aug 6, 2008 7:11 AM
Edited by: Dhanashri Pawar on Aug 6, 2008 7:21 AM
Edited by: Dhanashri Pawar on Aug 6, 2008 7:23 AM
08-06-2008 6:03 AM
Hi,
Using the DESCRIBE FIELD <f>.... we can get the field length and the attributes of the field.
FYIP...
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3145358411d1829f0000e829fbfe/content.htm
Regards,
Ramesh
08-06-2008 6:03 AM
to find length of string.
STRELN( str_name )
to find length of a field
SE11->Enter table Name->View lenth of correspponding Field for its length in LENGTH Couln.
rgds
rajesh
Edited by: RAJESH KUMAR on Aug 6, 2008 10:34 AM
08-06-2008 6:03 AM
HI
to calculate the length of the work variables that you define in the program
DESCRIBE FIELD <f> LENGTH <l> TYPE <t> COMPONENTS <n>
OUTPUT-LENGTH <o>]DECIMALS <d>
[EDIT MASK <m> HELP-ID <h>.
to calculate the length of a string use STRLEN() function
Regards
Pavan
08-06-2008 6:04 AM
hi,
use DESCRIBE statement with length addtion.
syntax is
DESCRIBE FIELD <f> LENGTH <l>.
For detail ref to,
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3145358411d1829f0000e829fbfe/content.htm
regards,
Anirban
08-06-2008 6:05 AM
Hi,
use the predefined function
STRLEN
Number of characters in arg; blanks at the end of data objects with a fixed length are not counted, although they are counted in type string data objects. If you use a non-Unicode double-byte code, a character that occupies 2 bytes is counted twice.
Regards,
Jagadeesh.
08-06-2008 6:07 AM
08-06-2008 6:08 AM
hi,
To get the Length of the field Use DESCRIBE statement.
DESCRIBE FIELD <Field> LENGTH <len>.
To know more use F1 help in teh ABAP Editor you will find good Example for it.
Regards
Sumit Agarwal
08-06-2008 6:10 AM
Hi,
Here we use STRLEN for determinig the lenth of a field.
Even we use DESCRIBE statement.
DESCRIBE FIELD A LENGTH L.
DATA: WORD1(10) TYPE C VALUE 'STRINGA',
WORD2(20) TYPE C VALUE 'STRINGB',
I1 TYPE I.
I1 = STRLEN( WORD1 ) + STRLEN( WORD2 ).
WRITE: I1.
Hope this helps.
thanx,
dhanashri
Edited by: Dhanashri Pawar on Aug 6, 2008 7:11 AM
Edited by: Dhanashri Pawar on Aug 6, 2008 7:21 AM
Edited by: Dhanashri Pawar on Aug 6, 2008 7:23 AM
08-06-2008 6:10 AM
Use
DESCRIBE FIELD mara-matnr LENGTH l_matnr IN CHARACTER MODE..
rgds
rajesh
08-06-2008 6:13 AM
Hi RAM,
DESCRIBE FIELD
Syntax
DESCRIBE FIELD dobj
[TYPE typ [COMPONENTS com]]
[LENGTH ilen IN {BYTE|CHARACTER} MODE]
[DECIMALS dec]
[OUTPUT-LENGTH olen]
[HELP-ID hlp]
[EDIT MASK mask].
Effect
This statement determines several properties of the data object dobj and assigns them to the specified variables. The various additions enable you to determine the data type and the number of components for structures, the length used in the memory, the number of decimal places, the output length, the name of the data type for a reference to a data element of the ABAP Dictionary, and a possible conversion routine.
Notes
You can specify field symbols or formal parameters in procedures for dobj to determine the properties of the data object they represent at the time of the statement execution.
The statement DESCRIBE is used to determine the properties of data objects of elementary data types. When DESCRIBE is used for structures or data objects of deep data types like strings, internal tables, or reference variables, you can only determine elementary properties. Further details, for example, the static or dynamic type of a reference variable cannot be determined using DESCRIBE. For this kind of information, you can use the type classes of Run Time Type Services (RTTS). They enable you to determine all properties of data objects of all data types.