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
1,405

Hi,

I am using the DESCRIBE statement to get the total number of lines in an internal table.

Could you tell me if the table needs to be sorted or not before I use the DESCRIBE statement?

Does the DESCRIBE statement affect performance?

Thanks,

Sandeep.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,308

HI Sandeep ,

There are no such prerequisits to use the describe statement , you can use it directly on an internal table and it does not effect the performance of the program also.

Regards

Arun

11 REPLIES 11
Read only

Former Member
0 Likes
1,309

HI Sandeep ,

There are no such prerequisits to use the describe statement , you can use it directly on an internal table and it does not effect the performance of the program also.

Regards

Arun

Read only

Former Member
0 Likes
1,308

that is not necessary to sort the itab.

i dont think it will be a performance issue.

Message was edited by:

SHIBA DUTTA

Message was edited by:

SHIBA DUTTA

Read only

Former Member
0 Likes
1,308

hi

<b>Describe for field..The gives you attributes of the field..

Ex..

DATA: FLD(8),

LEN TYPE I.

DESCRIBE FIELD FLD LENGTH LEN.

Describe for table..This gives you number of rows in the internal table.

Ex.

DESCRIBE TABLE ITAB.

WRITE: / ' Number of rows in ITAB', SY-TFILL.</b>

<b>u need not sort the table before use of describe.</b>

regards

ravish

<b>plz dont forget to reward points if helpful</b>

Message was edited by:

ravish goyal

Read only

Former Member
0 Likes
1,308

Hi,

No need to sort table befoe using the describe statement. I dont think it has much performace effects but do check the unicode comaptibility of this statement now.

Regards,

Devendra

Read only

Former Member
0 Likes
1,308

Hi

There is no need to sort the internal table before using DESCRIBE statement. DESCRIBE statement is used to count the number of lines stored in the internal table, even if u sort or not the number of lines in the internal table will not change.

It will not affect the performance of the program.

Regards

Haritha.

Read only

Former Member
0 Likes
1,308

<b>You can use the variants of the statement DESCRIBE listed above to

specify some of the properties that have data objects at runtime</b>

This statement determines some properties of the internal table itab and

assigns them to the specified variables. The various additions enable

you to determine the table type, the number of currently filled rows

and the initial memory requirement.

In addition, the system fields sy-tfill and sy-tleng are filled with

the current number of table rows and the length of a table row in bytes.

Notes

For detailed information about an internal table, you should use

the methods of RTTS of the DESCRIBE TABLE statement.

Without the specification of an addition, the statement

DESCRIBE TABLE only sets the system fields sy-tfill and sy-tleng.

<b>Example</b>

Descending sorting of a generically typed internal table in a subprogram.

Since sorted tables cannot be sorted in a descending order,

the table type is checked to avoid an exception that cannot be handled.

TYPE-POOLS sydes. 
... 
FORM sort_descending CHANGING itab TYPE ANY TABLE. 
  DATA tabkind(1) TYPE c. 
  DESCRIBE TABLE itab KIND tabkind. 
  IF tabkind = sydes_kind-standard OR 
     tabkind = sydes_kind-hashed. 
    SORT itab DESCENDING. 
  ELSEIF tabkind = sydes_kind-sorted. 
    MESSAGE '...' TYPE 'E'. 
  ELSE. 
    MESSAGE '...' TYPE 'E'. 
  ENDIF. 
ENDFORM. 

reward points if it is usefull ...

Girish

Read only

Former Member
0 Likes
1,308

hi sandeep

if u still have nay problem plz get back to me i can provide u with some more information.

regards

ravish

Read only

Former Member
0 Likes
1,308

hi sandeep,

describe statement is used for describing the fields n total lines in a internal table. for that there is no pre-requisit like sorting. sorting the table is mainly useful in at control statements before using at new, at first, at end of, at last stmnts.

and performance wise also describe has no affect.

if helpful reward some points.

with regards,

suresh babu aluri.

Read only

Former Member
0 Likes
1,308

In ECC 6 you don't need to use DESCRIBE at all.

L_lines = <b>LINES</b>( <i>Itab</i> ).

Even quicker than DESCRIBE and you don't need to sort the table.

Read only

0 Likes
1,308

hi,

for describe table u need not to sort it.

u can use like this

DESCRIBE TABLE itab LINES l_count.

in l_count u will get the no of lines,

regards,

sudha

Read only

Former Member
0 Likes
1,308

hi,

To find out the attributes of an internal table at runtime that were not available statically, use the

statement:

DESCRIBE TABLE <itab> [LINES <l>] [OCCURS <n>] [KIND <k>].

If you use the LINES parameter, the number of filled lines is written to the variable <lin>. If you

use the OCCURS parameter, the value of the INITIAL SIZE of the table is returned to the

variable <n>. If you use the KIND parameter, the table type is returned to the variable <k>: ‘T’ for

standard table, ‘S’ for sorted table, and ‘H’ for hashed table.

DATA: BEGIN OF LINE,

COL1 TYPE I,

COL2 TYPE I,

END OF LINE.

DATA ITAB LIKE HASHED TABLE OF LINE WITH UNIQUE KEY COL1

INITIAL SIZE 10.

DATA: LIN TYPE I,

INI TYPE I,

KND TYPE C.

DESCRIBE TABLE ITAB LINES LIN OCCURS INI KIND KND.

WRITE: / LIN, INI, KND.

DO 1000 TIMES.

LINE-COL1 = SY-INDEX.

LINE-COL2 = SY-INDEX ** 2.

INSERT LINE INTO TABLE ITAB.

ENDDO.

DESCRIBE TABLE ITAB LINES LIN OCCURS INI KIND KND.

WRITE: / LIN, INI, KND.

The output is:

0 10 H

1,000 10 H

Here, a hashed table ITAB is created and filled. The DESCRIBE TABLE statement is

processed before and after the table is filled. The current number of lines changes,

but the number of initial lines cannot change.

regards,