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

describe statement.

Former Member
0 Likes
792

what is the function of describe statement.?

5 REPLIES 5
Read only

Former Member
0 Likes
657

Just read the help documentation.

Read only

Former Member
0 Likes
657

hi,

( 1 ) DESCRIBE FIELD f. :Gets a particular attribute or allattributes of the field f.

( 2 ) DESCRIBE TABLE itab. :Gets the attributes of the internaltable itab.

You must use at least one of the additions listed below.

a))) LINES n : Places the numebr of filled lines of the table itab into the field n. The value returned to n has typeI.

Example

DATA: N TYPE I,

ITAB TYPE TABLE OF I.

...

CLEAR ITAB.

APPEND 36 TO ITAB.

DESCRIBE TABLE ITAB LINES N.

Result: N contains the value 1.

b))) OCCURS n : Places the value of the OCCURS or INITIALSIZE parameter from the definition of itab (DATA) into the variable n. The value returned ton has the type I.

Example

DATA: N1 TYPE I,

N2 TYPE I,

ITAB1 TYPE TABLE OF I INITIAL SIZE 10,

ITAB2 TYPE I OCCURS 5.

DESCRIBE TABLE ITAB1 OCCURS N1.

DESCRIBE TABLE ITAB2 OCCURS N2.

Result: n1 has the value 10, N2 has the value 5.

c))) KIND k : Places the table typeof itab into the field k. The value returned to k has the type C. The return value is one of the constantsSYDES_KIND-STANDARD, SYDES_KIND-SORTED, orSYDES_KIND-HASHED from the type group SYDES.

TYPE-POOLS: SYDES.

...

FORM GENERIC_FORM USING ITAB TYPE ANY TABLE.

DATA: K TYPE C.

DESCRIBE TABLE ITAB KIND K.

CASE K.

WHEN SYDES_KIND-STANDARD.

...

WHEN SYDES_KIND-SORTED.

...

WHEN SYDES_KIND-HASHED.

...

ENDCASE.

ENDFORM.

( 3 ) DESCRIBE LIST NUMBER OF LINES lin.

- DESCRIBE LIST NUMBER OF PAGES n.

- DESCRIBE LIST LINE lin PAGE pag.

- DESCRIBE LIST PAGE pag.

effect: Returns the attributes of a list. All variants have theaddition ... INDEX idx allowing you to determine the attributesof a particular list level (SY-LSIND = 0,1,2,3,... ).

Regds

Sivaparvathi

Please reward points if helpful...

Read only

Former Member
0 Likes
657

Hi,

Describe is used to get the type or the number of lines or the initial size of an internal table.

e.g. describe table my_table lines lv_num.

lv_num will contain the number of lines currently in the internal table

If you need to know more details do F1 help on Desceribe.

You will get to know the meaning in more detail.

Please reward if useful.

Regards,

Lalit

Read only

Former Member
0 Likes
657

Hi,

See below documentation.

DESCRIBE - Return attributes of an internal table

Basic form

DESCRIBE TABLE itab.

Effect

Returns the attributes of the internal table itab. You must use at least one of the additions listed below:

Note

The DESCRIBE statement cannot be used for all ABAP types. In connection with ABAP Objects, SAP has introduced a RTTI concept based on system classes to determine type attributes at runtime. This concept applies to all ABAP types and as such covers all the functions of the DESCRIBE TABLE statement.

Extras:

1. ... LINES n

2. ... OCCURS n

3. ... KIND k

Addition 1

... LINES n

Effect

Places the number of filled lines of the table t in the field lin. The value returned to lin has type I.

Note

The number of filled lines of the table itab can also be ascertained using the predefined function lines( itab ).

Example

DATA: N TYPE I,

ITAB TYPE TABLE OF I.

...

CLEAR ITAB.

APPEND 36 TO ITAB.

DESCRIBE TABLE ITAB LINES N.

Result: N contains the value 1.

Addition 2

... OCCURS n

Effect

Passes the size of the OCCURS parameter from the table definition (as defined with DATA) to the variable n. The value returned to n has type I.

Example

DATA: N1 TYPE I,

N2 TYPE I,

ITAB1 TYPE TABLE OF I INITIAL SIZE 10,

ITAB2 TYPE I OCCURS 5.

DESCRIBE TABLE ITAB1 OCCURS N1.

DESCRIBE TABLE ITAB2 OCCURS N2.

Result: OCC contains the value 10 and N2 the value 5.

Addition 3

... KIND k

Effect

Writes the table type from itab to the variables n. The value returned to k is of type C. The constants SYDES_KIND-STANDARD, SYDES_KIND-SORTED and SYDES_KIND-HASHED are defined in the type group SYDES for the return values.

Example

Generic FORM routine any table type

TYPE-POOLS: SYDES.

...

FORM GENERIC_FORM USING ITAB TYPE ANY TABLE.

DATA: K TYPE C.

DESCRIBE TABLE ITAB KIND K.

CASE K.

WHEN SYDES_KIND-STANDARD.

...

WHEN SYDES_KIND-SORTED.

...

WHEN SYDES_KIND-HASHED.

...

ENDCASE.

ENDFORM.

Notes

Performance: The runtime for executing the DESCRIBE TABLE statement is approximately 4 msn (standardized microseconds).

The DESCRIBE TABLE statement also passes values to the SY-TFILL and SY-TLENG System fields

Thanks,

Sriram Ponna.

Read only

Former Member
0 Likes
657

Hi,

Describe which will returns the no.of entries in your internal table. find the below syntax.

DATA: N TYPE I,

DESCRIBE TABLE ITAB LINES N.

find the some other usages.

1) DESCRIBE FIELD f.

this will give the internal length of field f is placed in fieldlen.

2)DESCRIBE DISTANCE BETWEEN f1 AND f2 INTO f3.

Determines the distance between the fields f1 and f2 and places the result (in bytes) in f3

3)DESCRIBE LIST NUMBER OF LINES lin.

Returns the number of lines in the list.

4)DESCRIBE LIST NUMBER OF PAGES n.

Returns the number of pages in the list.

5)DESCRIBE LIST LINE lin PAGE pag.

Returns the number of the page for the line linin the list.

Reward if useful.

Thanks,

Sreeram.