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 TABLE

Former Member
0 Likes
1,478

Can any one explain me the following statement.

DESCRIBE TABLE I_MAIN LINES SY-TFILL.

IF SY-SUBRC <> 0.

MESSAGE E001 WITH TEXT-056.

STOP.

ENDIF.

Rewards will be awarded.

Regards,

Murugan Arumugam

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,272

i think ur changing the value of sy-tfill, which is invalid leading to the non-execution of the statement succesfully and hence the sy-subrc is not 0.

try giving some other value there, it will surel work

reward if useful

regards,

Prashant

11 REPLIES 11
Read only

Former Member
0 Likes
1,272

The first statement will return the no.of lines in the internal table to system field sy-tfill...

If your internal table is not having records...then the system field sy-subrc will be not equal to zero...then it will throw a error message with the text element 056 and stop the execution.

Read only

0 Likes
1,272

Hi Ramu,

My internal table contains many records. But still sy-subrc NE 0. why.. i dont now ? is there any reason. ?

Regards,

Murugan Arumugam

Read only

Former Member
0 Likes
1,272

Places the number of filled lines of the table i_main into field sy-tfill.

Read only

Former Member
0 Likes
1,272

Hi

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.

For detailed information about an internal table, you should use the methods of RTTS instead of the statement DESCRIBE TABLE.

Without the specification of an addition, the statement DESCRIBE TABLE only sets the system fields sy-tfill and sy-tleng.

The current number of table rows of the internal table itab is determined and is assigned to the data object lin.The data type i is expected for the data object.

As of release 6.10, the current number of rows of an internal table can also be determined using the in-built function lines.

<b>Reward if usefull</b>

Read only

Former Member
0 Likes
1,272

In general you should not write into sy-fields if you don´t really have to...

Try this:

data linecount type i.

describe table i_main lines linecount.

Read only

Former Member
0 Likes
1,272

Hi,

You can acheive the above said functionality by using the below code.

IF not i_main[] is initial.

MESSAGE E001 WITH TEXT-056.

STOP.

ENDIF.

OR

Data:v_line like sy-tabix.

DESCRIBE TABLE I_MAIN LINES v_line.

IF v_line > 0.

ELSE.

MESSAGE E001 WITH TEXT-056.

STOP.

ENDIF.

Cheers,

Bujji

Read only

Former Member
0 Likes
1,273

i think ur changing the value of sy-tfill, which is invalid leading to the non-execution of the statement succesfully and hence the sy-subrc is not 0.

try giving some other value there, it will surel work

reward if useful

regards,

Prashant

Read only

0 Likes
1,272

HI all,

The statement which results sy-subrc ne 0 is

DELETE ADJACENT DUPLICATES FROM I_MAIN COMPARING EBELN EBELP.

After this statement ,

SORT I_MAIN1 BY EBELN EBELP.

DESCRIBE TABLE I_MAIN LINES SY-TFILL.

IF SY-SUBRC <> 0.

MESSAGE E001 WITH TEXT-056.

STOP.

ENDIF.

After execution of Describe statement the Sy-SUBRC still remains 4. Pls tell me the reason.

Read only

0 Likes
1,272

One thing I see right away:

You sort table I_MAIN1, but delete from table I_MAIN... is that correct???

Keep in mind that you have to sort BEFORE deleting adjacent.

If no entries are deleted, you will receive SY-SUBRC 4 as result.

Your describe statement does not change the return code, therefore it remains 4.

Still you should NOT describe into SY-TFILL, but use an integer-variable instead.

Read only

0 Likes
1,272

SORT I_MAIN1 BY EBELN EBELP.

DELETE ADJACENT DUPLICATES FROM I_MAIN COMPARING EBELN EBELP.

DESCRIBE TABLE I_MAIN LINES SY-TFILL.

IF SY-SUBRC <> 0.

MESSAGE E001 WITH TEXT-056.

STOP.

ENDIF.

Read only

0 Likes
1,272

Youre question actually should be answered by now.

Please mark it as answered if so.