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.
Showing results for 
Search instead for 
Did you mean: 

two internal table comparison (big tables)

0 Kudos


The internal tables contains huge data.

While Debugging this code it working fine but while executing (pressing f8) its not running the program (I mean program is continuously loading).

Please give me any advice.

LOOP AT it_tab1 INTO wa_tab1.
* loop at it_tab2 into wa_tab2
READ TABLE it_tab2 into wa_tab2 with key obj_name = wa_tab1-tablename.
* where obj_name = wa_tab1-tablename.
CLEAR wa_final.
wa_final-tablename = wa_tab1-tablename.
wa_final-description = wa_tab1-description.
wa_final-total_records = wa_tab1-total_records.
wa_final-package = wa_tab2-package.
wa_final-created_on = wa_tab2-created_on.
APPEND wa_final TO it_final.


Active Contributor
0 Kudos


Am afraid you have understood it differently.

When you keep a break point and execute you are forcefully stopping the program execution at that break-point hence your program stops there and for each function Key operation (F5, F6, F7 and F8) system may respond quickly and proceed further irrespective of the data volume.

Now consider when you execute directly system has to execute all the code lines before if actually comes out of program. In your case since the volume of the internal data is huge system will take considerable time to complete processing all the line items.

You may check for the correctness of the program by executing with a scenario where it has to deal with less data.

Note: In foreground system can run only for certain minutes(Depends on the configuration done by your BASIS team which is usually 45 Minutes), post that system may lead to dump. if you want to know the actual execution time for your case recommend you to execute in background and check the time duration in t-code SM37.


Active Contributor

Probably try field symbols. They do have performance benefit. Apart from that, it depends on how your tables are structured, what type they are (standard/sorted) and what kind of data is there. Please provide all these information to get better answers from community.

LOOP AT it_tab1 assigning field-symbol(<ls_tab1>).
READ TABLE it_tab2 assigning field-symbol(<ls_tab2>) with key obj_name = <ls_tab1>-tablename.
APPEND INITIAL LINE TO lt_final assigning field-symbol(<lfs_final>).

lfs_final>-tablename = <ls_tab1>-tablename.

*****Add other fields******

Active Contributor

If you mean "huge" in terms of table rows, then make sure that IT_TAB2 is either sorted or hashed according to field OBJ_NAME. Otherwise, the processing will be extremely slow.

Active Contributor
0 Kudos

The following coding will be better in terms of performance.

I wonder though, if your complete coding doesn’t have other issues as well, like an infinite loop, because based on your description, it never stops. (Do you stop it or do you run into a time out dump? Did you try running it in background and see how long it took then or does it also „never“ stop or is it not an „option“ because you need it as Dialoge report for display or download to GUI?)

Give us more information about your coding and the amount of data in your two tables, so we can assess your problem more thoroughly.

I assume your performance problem could also be related to TOTAL_RECORDS and how you compute that, if I am guessing right what your requirement is.

Are you actually going through ALL database tables, collecting their total-records, combining them with some DDIC info and then want to display or download that info?

I would expect „bad“ performance for any attempt like that.

Try using just Z-Tables or just several tables first and see how fast that is. You could use a select-options variable in your report for that to start slowly.

DATA it_tab2 TYPE SORTED TABLE your_table_type WITH NON-UNIQUE KEY objname.
FIELD-SYMBOLS <fs_tab1> LIKE LINE OF it_tab1.
FIELD-SYMBOLS <fs_tab2> LIKE LINE OF it_tab2.

CLEAR wa_final.
LOOP AT it_tab1 ASSIGNING <fs_tab1>.

  READ TABLE it_tab2 ASSIGNING <fs_tab2> WITH TABLE KEY obj_name = <fs_tab1>-tablename.  
  CHECK sy-subrc = 0. 

  wa_final-tablename = <fs_tab1>-tablename.
  wa_final-description = <fs_tab1>-description.
  wa_final-total_records = <fs_tab1>-total_records.
  wa_final-package = <fs_tab2>-package.
  wa_final-created_on = <fs_tab2>-created_on.

  INSERT wa_final INTO TABLE it_final.


Active Contributor
0 Kudos

sirirachamallu1234_5, please follow up on your open question.

  • comment answers or your question if there are still open issues.
  • otherwise mark an answer as accepted if it helped you solve your problem
  • or post an answer of yourself and accept it if you found another useful solution yourself
  • or redirect your question to another question that is related and was useful to solve your problem
  • in the end, close your question