08-02-2013 11:11 AM
Hi Expert,
How we find number of record in table by using before save event in table maintenance generator
Thanks
Rajeev
08-02-2013 12:05 PM
Hi Rajeev,
in the event,their will be Table Variable called 'TOTAL'.
you can use this code,
DATA : lin type I.
Describe table TOTAL lines lin.
you will get the total records number in the variable LIN.
Regards,
Sangamesh.
08-02-2013 12:20 PM
Kindly use table events on the table maintenance generator screen. In that there will be an event which gets called just before save. Event number is 01. Once you create an event you need to assign an subroutine to that event. In that subroutine the whole table entries are available.
Now using Describle table command you can get the number of table entries in the table.
08-02-2013 12:25 PM
Hi Rajeev,
before saving click enter it will shows how many records in it as highlighted
08-02-2013 12:27 PM
Hi,
There are two tables in TMG
1)TOTAL
2)EXTRACT.
TOTAL table contains the entire table contents that is present in the DB.
EXTRACT internal table contains the extract of the data that was created, deleted or changed during an action on the table maintenance screen.
Hope this helps you understand Total and Extract now..
Now you can decide what you want...reward if useful..
Regards,
Abdul
08-02-2013 12:45 PM
Hi Rajeev,
Create a event in table maintenance and try to find the number of records using describe table lines...
Thanks & Regards
akshay
08-02-2013 1:03 PM
Hi ,
In the table maintenance generator you can use the event 01 for this purpose.
The table total contains both the existing entries as well as newly added entries.
In order to get the count of old entries , you can use in the following way :
Delcare a internal table which is of structure TOTAL.
DATA : BEGIN OF wa_total .
INCLUDE STRUCTURE zXXX. ( Name of the table to which the event is assigned )
DATA: action TYPE c,
END OF wa_total.
DATA : IT_TOTAL LIKE STRANDARD STRUCTURE OF WA_TOTAL.
DATA : i_count TYPE i.
IT_TOTAL[] = TOTAL[].
DELETE IT_TOTAL where action = 'N'.
DESCRIBE TABLE it_total LINES i_count.
Thanks and Regards,
Sriranjani Chimakurthy.
08-02-2013 1:59 PM
Hi All ,
Thanks for your reply.
We solved the issue. describe will not work in TMG(table maintenance generator ) .
two way we found that either use total and get based on sy-tabix value or simply fetch the data from table and get the count from sy-dbcnt .
08-02-2013 2:13 PM
Hi Rajeev,
Good to know that you have resolved the issue. But i do not agree that describe will not work in TMG.
Can you please explain why will it not work?
Thanks and Regards,
Sriranjani Chimakurthy.
08-02-2013 2:19 PM
Hi Srir,
Thanks for asking the question. I checked with Describe only but count is only 1. so better use loop the total and use sy-tabix value to get number of count or i explained other logic .
01-21-2014 7:28 AM
Hi Sriranjani,
I have a requirement where i have to work on the changed /created or deleted records of a table through SM30.To get such records , I have followed the same way as you have described.
But while assigning total to created internal table i am getting dump that Two internal tables are neither compatible nor convertible.
My custom table has a field of type int4.Is that a problem.
Can you help me on this.
Regards,
Priyaranjan
01-21-2014 7:45 AM
Hi Gupta,
\Which two internal tables have you used? And which procedure you followed? Rajeev has used only one internal table to loop.
Regards,
-Vijay
01-21-2014 8:50 AM
I have done as follows : (As described by Sriranjani)
Delcared an internal table which is of structure TOTAL.
DATA : BEGIN OF wa_total .
INCLUDE STRUCTURE zXXX. ( Name of the table to which the event is assigned )
DATA: action TYPE c,
END OF wa_total.
DATA : IT_TOTAL LIKE STRANDARD STRUCTURE OF WA_TOTAL.
IT_TOTAL[] = TOTAL[]. - this statement is giving dump.
Regards,
Priyaranjan
01-21-2014 12:29 PM
Hi Priyaranjan,
The Total[] will hold your all the table data with new maintained value also. In the above code just change the
DATA : it_total LIKE STANDARD TABLE OF wa_total.
else you can directly use table[] as a internal table.
Thanks
01-22-2014 4:10 AM
Hi,
Please find the below link to find total number of records, modify or delete the record :
Table Maintenance Generator for event Number 01 and 05 - Contributor Corner - SCN Wiki
Problems with Table Maintenance Generator for e... | SCN
Thanks & Regards,
Akshay Ruia