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: 

Opinion on that abap code

amine_lamkaissi
Active Contributor
0 Kudos

Hi experts,

In BW, i am inserting with an abap code some data to a custom SE11 table (ycnv_report)

I am calculating data with three different internal tables and i regroup all data in one internal table from which i am inserting data into my custom sap table.

REFRESH wt_report_final.

   INSERT LINES OF wt_report2 INTO TABLE wt_report_final.

   REFRESH wt_report2.

   INSERT LINES OF wt_report_x2  INTO TABLE wt_report_final.

   REFRESH wt_report_x2 .

   INSERT LINES OF  wt_report_y2 INTO TABLE wt_report_final.

   REFRESH wt_report_y2.

   SORT wt_report_final BY comp_code costcenter chrt_accts gl_account costelmnt /bic/y_tprtnr co_area profit_center y_labbu y_labdiv y_program part_prctr y_labprbu y_ptnrdiv doc_currcy loc_currcy fiscper version.

   DELETE ADJACENT DUPLICATES FROM wt_report_final COMPARING comp_code costcenter chrt_accts gl_account costelmnt /bic/y_tprtnr co_area profit_center y_labbu y_labdiv y_program part_prctr y_labprbu y_ptnrdiv doc_currcy loc_currcy fiscper version.

*  DELETE ADJACENT DUPLICATES FROM wt_report_final COMPARING ALL FIELDS.

   IF NOT wt_report_final IS INITIAL.

     INSERT ycnv_report FROM TABLE wt_report_final.

   ENDIF.

I made tests in DEV, it's working fine.

But before transporting, i would like to know your opinion and any possiblities of enhancements. In Production i have more data to treat and in few years my program will deal with many millions of records.

By the way, is there any settings that you recommand me to my SE11 table in my case?

Thanks for your help.

Amine

1 ACCEPTED SOLUTION

Former Member
0 Kudos

amine lamkaissi wrote:

... my program will deal with many millions of records.

As in: your program will update/insert millions of records? If that's the case you should consider to update/insert or modify in small packages instead of trying to do that in 1 single insert.

7 REPLIES 7

Former Member
0 Kudos

Hi Amine,

u can use the above code.

u can change One line of code .

  1.    IF NOT wt_report_final IS INITIAL. 
  2.      INSERT ycnv_report FROM TABLE wt_report_final. 
  3.    ENDIF. 

inspite of INSERT u can use MODIFY Statement.

  1.    IF NOT wt_report_final IS INITIAL. 
  2.      MODIFY ycnv_report FROM TABLE wt_report_final. 
  3.    ENDIF. 

Former Member
0 Kudos

Hi Amine,

U can change one more code.

  1.    INSERT LINES OF wt_report2 INTO TABLE wt_report_final. 
  2.    REFRESH wt_report2. 
  3.    INSERT LINES OF wt_report_x2  INTO TABLE wt_report_final. 
  4.    REFRESH wt_report_x2 . 
  5.    INSERT LINES OF  wt_report_y2 INTO TABLE wt_report_final. 
  6.    REFRESH wt_report_y2. 

Inspite of INSERT staement u can use APPEND.

APPEND LINES OF wt_report2 INTO wt_report_final. 

Thanks

Tarak

Former Member
0 Kudos

amine lamkaissi wrote:

... my program will deal with many millions of records.

As in: your program will update/insert millions of records? If that's the case you should consider to update/insert or modify in small packages instead of trying to do that in 1 single insert.

0 Kudos

Hi Maen,

How can i modify the insertion of data with small packages?

Thanks.

Amine

0 Kudos

By moving bits of the large table to a small table, doing the modify, refreshing the small table and repeating until everything is processed.

This will process 5000 lines at a time.

WHILE LINES( large_table ) > 0.

   LOOP AT large_table INTO wa.

     DELETE large_table INDEX 1.

     APPEND wa TO small_table.

     IF LINES( small_table ) >= 5000 OR LINES( large_table ) = 0.

       EXIT.

     ENDIF.

   ENDLOOP.

   "insert small table into database

   REFRESH small_table.

ENDWHILE.

Former Member
0 Kudos

Hi,

Try to create the secondary index for the fields which u want to access frequently. By doing so your program performance will be increased.

Regards,

Vineesh.

amine_lamkaissi
Active Contributor
0 Kudos

Thank you guys for your advices.

Amine