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

Display a count

Former Member
0 Likes
1,231

Hi all,

My requirement is that I want to display the total number of items I have in my internal table the moment I enter my selection criteria.... any suggestions plz.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,096

Hi,

You write the code based on the selecion criteria.

After that


TABLES: mara.
DATA: BEGIN OF itab OCCURS 0.
        INCLUDE STRUCTURE mara.
DATA: END OF itab.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECT * INTO TABLE itab
               FROM mara
              WHERE matnr IN s_matnr.

IF sy-subrc = 0.
  WRITE:/ sy-dbcnt.
ENDIF.

Also you can use

DESCRIBE TABLE ITAB LINES n.

Try this, will solve ur problem.

8 REPLIES 8
Read only

Former Member
0 Likes
1,097

Hi,

You write the code based on the selecion criteria.

After that


TABLES: mara.
DATA: BEGIN OF itab OCCURS 0.
        INCLUDE STRUCTURE mara.
DATA: END OF itab.
SELECT-OPTIONS: s_matnr FOR mara-matnr.
SELECT * INTO TABLE itab
               FROM mara
              WHERE matnr IN s_matnr.

IF sy-subrc = 0.
  WRITE:/ sy-dbcnt.
ENDIF.

Also you can use

DESCRIBE TABLE ITAB LINES n.

Try this, will solve ur problem.

Read only

0 Likes
1,096

I tried it but using WRITE:/ sy-dbcnt. always gives me fix number I mean to say if I have 3 records I'm getting 20 and if I have 30 I 'm getting 20....

tried to use DESCRIBE TABLE ITAB LINES n. but not getting any display of any number on my screen.

Read only

0 Likes
1,096

HI,

The stmt. is:

WRITE:/ n. "where n is the total entries in internal table.

Regards

Subramanian

Read only

0 Likes
1,096

hi,

kindly chk ur itab contains dat or not.

if itab[] is not initial.

DESCRIBE TABLE ITAB LINES n.

write n.

endif.

rgds

Anver

Read only

0 Likes
1,096

after using DESCRIBE TABLE ITAB LINES n

write n.

amit

Read only

Former Member
0 Likes
1,096

use like this , to count the number of lines in IT -

tables mara.

DATA: N TYPE I.

SELECT-OPTIONS: s_matnr FOR mara-matnr.

SELECT * INTO TABLE ITAB

FROM MARA

WHERE matnr in s_matnr.

if sy-subrc = 0.

DESCRIBE TABLE ITAB LINES N.

endif.

Result: N contains the value.

Read only

Former Member
0 Likes
1,096

Hi,

Once you have all your data in the internal table,

write a stmt like :

describe table itab lines ws_lines.

ws_lines has the total number of entries in the internal table ITAB.

Regards

Subramanian

Read only

Former Member
0 Likes
1,096

i think you want to show it before showing the list.

then you have to code at :

at selection-screen.

here select the data into itab.

now use describe table.

here you can call a popup with the variable.

fm like POPUP_TO_DISPLAY_VALUE.

start-of-selection.

regards

shiba dutta