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: 

Number of records in sap tables

Former Member
0 Kudos
2,837

LOOP AT it_tab INTO wa_tab.
v_var = wa_tab-tablename.
SELECT COUNT(*) FROM (v_var) INTO count.
WRITE:/ count.
CLEAR v_var.

while counting records in SAP tables i am getting dump like this. please provide an solution for this.

Error analysis
An exception has occurred which is explained in more detail below. The
exception, which is assigned to class 'CX_SY_DYNAMIC_OSQL_SEMANTICS' was not
caught and
therefore caused a runtime error. The reason for the exception is:
The current ABAP program attempted to execute an Open SQL statement
containing a dynamic entry. The parser returned the following error: ""ERUN"
is not defined in the ABAP Dictionary as a table, projection view, or
database view."


8 REPLIES 8

DominikTylczyn
SAP Champion
SAP Champion
0 Kudos
2,166

Hello swathi8

At one of the loop passes v_var variable gets value of ERUN. That's not an ABAP Dictionary table, projection view or database view i.e. a ABAP dictionary object that you can read data from. Hence short dump in the SELECT statement.

As you have explained how you fill it_tab internal table, I can't help you more.

Best regards

Dominik Tylczynski

cdprasanna
Active Participant
2,166

Hi

3a9e4ce873a94034b33dc62b0ce600ee mentioned dump is because trying to execute select query with non Dictionary table if you want to filter your it_tab with only tables then you can filter that by passing them to table dd02l where the type is TRANSP.

Thanks and regrads,

Prasanna CD.

venkateswaran_k
Active Contributor
0 Kudos
2,166

Dear Swati,

I assume you are getting list of tables in your internal table it_tab.

In the loop before executing the count, please make the following check.

LOOP AT it_tab INTO wa_tab.
    v_var = wa_tab-tablename.
    select single tabclass from DD03VT into v_tabclass WHERE TABNAME = (v_var).
    IF v_tabclass = 'TRANSP'
      SELECT COUNT(*) FROM (v_var) INTO count.
      WRITE:/ count.
    ENDIF.
    CLEAR v_var.

The reason you get dump, (as explained by Dominik and Prasanna - the object is not a table or view or any projections. It appears to be a structure and hence the dump.

This check above executes only when your object is of table type.

Please update your result.

Regards,

Venkat

0 Kudos
2,166

Thank you.

Problem is solved.

0 Kudos
2,166

I believe the answers solves your problem?

If this answer has solved your problem, accept the answer and close the thread.

This will help other who search for the same solutions.

Regards,

Venkat

Sandra_Rossi
Active Contributor
0 Kudos
2,166

Why don't you use the standard SAP program which already does that? (search the forum to find out its name, or even the SAP notes; I hope it doesn't short dump because I think there will be no official support).

venkateswaran_k
Active Contributor
0 Kudos
2,166

I believe the answers solves your problem?

If this answer has solved your problem, accept the answer and close the thread.

This will help other who search for the same solutions.

Regards,

Venkat

venkateswaran_k
Active Contributor
0 Kudos
2,166

I believe you got the answers solves your problem? If this answer has solved your problem, accept the answer and close the thread.

Please follow up comment if the problem is still not resolved.

Closing the thread with solution - will help other who search for the same solutions.