Application Development 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: 

How can I find the fields of tbl_names in my internal table

nsserkan
Explorer
0 Kudos
213

Hi Expert.

I have a problem.I have a table named ZSO_IGSCANLI and in this table I have a field with tbl_name. There are 9050 records in total in the tbl_name field. These records are all in a table or structure. The number of lines inside these tables or structures is requested. And then i will print alv output. My only problem is that I can't find how to create the line numbers of the tables and structures in the table. I am asked to do it with select count(*) operation. Can you help or guide me?

1 ACCEPTED SOLUTION

nsserkan
Explorer
0 Kudos
133

Solution of the problem.

DATA lv_tabname(50).

LOOP AT gt_igstbl INTO gs_igstbl.
CLEAR gs_igstbl-nmbr.
lv_tabname = gs_igstbl-tbl_name.

SELECT COUNT(*) FROM (lv_tabname)
INTO lv_count.

SELECT COUNT(*) FROM dd03l
WHERE tabname = lv_tabname
AND fieldname = 'MANDT'.

gs_igstbl-nmbr = lv_count.
INSERT gs_igstbl INTO gt_igstbl.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM gt_igstbl.

3 REPLIES 3

Sandra_Rossi
Active Contributor
133

I don't understand. Could you provide a real example?

nsserkan
Explorer
0 Kudos
133

I solved my problem. Thank you for your interest, I leave my code below with the intention of helping the future.

nsserkan
Explorer
0 Kudos
134

Solution of the problem.

DATA lv_tabname(50).

LOOP AT gt_igstbl INTO gs_igstbl.
CLEAR gs_igstbl-nmbr.
lv_tabname = gs_igstbl-tbl_name.

SELECT COUNT(*) FROM (lv_tabname)
INTO lv_count.

SELECT COUNT(*) FROM dd03l
WHERE tabname = lv_tabname
AND fieldname = 'MANDT'.

gs_igstbl-nmbr = lv_count.
INSERT gs_igstbl INTO gt_igstbl.
ENDLOOP.
DELETE ADJACENT DUPLICATES FROM gt_igstbl.