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

How much record in table

Former Member
0 Likes
914

Hi

i want to know how much field there is in table in code

(the table is in dictionary)

Thanks

Have a nice day

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
883

Try to use

SELECT COUNT(*) FROM DD03L WHERE tabname = <table name>.

or use FM ::

  CALL FUNCTION 'DDIF_FIELDINFO_GET'
       EXPORTING
            tabname   = tabname
       TABLES
            dfies_tab = dfies_tab
       EXCEPTIONS
            OTHERS    = 1.
  DESCRIBE TABLE dfies_tab LINES nb.

Regards

Hi

i want to know how much field there is in table in code

(the table is in dictionary)

Thanks

Have a nice day

6 REPLIES 6
Read only

Former Member
0 Likes
883

your question is not clear.....there can be any number of fields in a dictionary table as you want....

may be there is a limit for table maintenance generation...not very sure on that..

please clarify a bit more on what you want to know..

Message was edited by:

Priyank Jain

Read only

0 Likes
883

For example in structure BAPIMEPOSCHEDULE

you have 21 field

PO_ITEM

SCHED_LINE

DEL_DATCAT_EXT

DELIVERY_DATE

QUANTITY

DELIV_TIME

STAT_DATE

PREQ_NO

PREQ_ITEM

PO_DATE

ROUTESCHED

MS_DATE

MS_TIME

LOAD_DATE

LOAD_TIME

TP_DATE

TP_TIME

GI_DATE

GI_TIME

DELETE_IND

REQ_CLOSED

Read only

0 Likes
883
data : it_dd03l type table of DD03L initial size 0.
data : n type I.
select * from DD03L 
            into it_dd03l
            where tabname = 'BAPIMEPOSCHEDULE'.

describe table it_dd03l lines N.

Regards

Gopi

Read only

Former Member
0 Likes
883

Hi Balan,

Do you mean to say, you want to know the number of records in a database table during runtime???

If yes, declare an internal table similar to the database table.

Then do a SELECT * from the database table to the internal table.

Now use

DESCRIBE TABLE itab LINES lv_lin

.

lv_lin should be of type Integer. This will give you number of records in the table.

<b>Reward points for helpful answers.</b>

Best Regards,

Ram.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
884

Try to use

SELECT COUNT(*) FROM DD03L WHERE tabname = <table name>.

or use FM ::

  CALL FUNCTION 'DDIF_FIELDINFO_GET'
       EXPORTING
            tabname   = tabname
       TABLES
            dfies_tab = dfies_tab
       EXCEPTIONS
            OTHERS    = 1.
  DESCRIBE TABLE dfies_tab LINES nb.

Regards

Read only

0 Likes
883

Hi,

you can use fm REUSE_ALV_FIELDCATALOG_MERGE

EX.

DATA : I_ALV_FC TYPE SLIS_T_FIELDCAT_ALV.

CALL FUNCTION REUSE_ALV_FIELDCATALOG_MERGE

exporting

i_program_name = sy-repid

i_tab_name = 'ITAB'

i_inclname = sy-repid

changing

ct_fieldcat = I_ALV_FC

CNT = 0.

LOOP AT I_ALV_FC.

CNT = CNT + SY-TABIX.

ENDLOOP.