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: 
Read only

TIMELIMIT EXCEEDED

Former Member
0 Likes
4,241

Hello.

My program reads a whole lot of data..

Now after a while I get this error: 'Time Limit Exceeded'.

What are possible things to do cause I can't run it in background because after the reading I want to output a summary of wat data is readed..

Thx

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
3,300

Hi

When I try to include FOR ALL ENTRIES IN It always loops trough every personell number even when I only have 1 number in the table..

Any idea what this could be?

28 REPLIES 28
Read only

Former Member
0 Likes
3,300

execute it in background and get that output summary from spool... or you can download that output to some file on application server.

G@urav.

Read only

Former Member
0 Likes
3,300

hi

maybe split your program into 2 separate programs:

first program will be read a lot of data and save this

data into z-table (in background)

and second program will be read this z-table and display

result?

best regards,darek

Read only

0 Likes
3,300

Yes but when I split the program. And run one part in background.

How do I continue after the first part is finished?

Read only

0 Likes
3,300

simple scenario is:

1.

user check manually in sm37 if the first report finished

or user receive e-mail about finshed job

(first report writing result to z-table)

2.

after that user execute second report which reads

z-table and display result

best regards, darek

Read only

0 Likes
3,300

Yes but my boss isn't gonna like that.

there must be as little user-interaction as possible..

Read only

Former Member
0 Likes
3,300

Hi Bert,

I presume the program needs fine tuning, may be that cud solve the issue.

Share the program, may be we could help you out

Regards,

Raja

Read only

0 Likes
3,300

Here s part of the program:


FIELD-SYMBOLS: <it> TYPE STANDARD TABLE,
                 <temp>,
                 <wa> TYPE ANY.

* create a dynamic table of the infotype
  DATA: infty_tab_pointer TYPE REF TO data.
  CREATE DATA infty_tab_pointer TYPE TABLE OF (tabname).
  ASSIGN infty_tab_pointer->* TO <it>.

    LOOP AT i_objects.
*     get data form internal table tabname into <it>
      SELECT * FROM (tabname) INTO CORRESPONDING FIELDS OF TABLE <it>
WHERE objid EQ i_objects-objid.

*      loop at every record of the selection
      LOOP AT <it> ASSIGNING <temp> .

*        loop at every datafield of the record
        LOOP AT datafields WHERE infotype = tabname.
          ASSIGN COMPONENT datafields-field_name OF STRUCTURE
<temp> TO <wa>.

          MOVE <wa> TO output_tab_pd-data+datafields-field_start.
        ENDLOOP.

        output_tab_pd-infotype = tabname.
        APPEND output_tab_pd.
      ENDLOOP.
    ENDLOOP.

Now look: This part of code is called for every selected table:

It loops through all objects and selects all data from that object from the table.

It loops through all selected records of the table and splits them with datafields. (datafields contains the structure of every table with the startposition so I can split it later on again).

Now everything goes write.

But when theres to much data selected (when this loop ' LOOP AT <it> ASSIGNING <temp> ' is executed more than 50.000 times ) it stops and gives the error (after 1200 secs. it says..)

Read only

0 Likes
3,300

Try to increase the time limit to ... say 1800 seconds...

Read only

0 Likes
3,300

hi,

Reason is , with in a loop you are extracting the data from database table.

Do one thing remove the select statement from loop and use for all entries...

IF NOT i_objects[] IS INITIAL.

SELECT * FROM (tabname)

INTO CORRESPONDING FIELDS OF TABLE <it>

FOR ALL ENTRIES IN i_objects

WHERE objid EQ i_objects-objid.

ENDIF.

If you have multiple records for each objid you loop with in loop else use read statement.

1. IF you have multiple records

LOOP AT i_objects.

loop at every record of the selection

LOOP AT <it> ASSIGNING <temp> WHERE objid EQ i_objects-objid .

  • loop at every datafield of the record

LOOP AT datafields WHERE infotype = tabname.

ASSIGN COMPONENT datafields-field_name OF STRUCTURE

<temp> TO <wa>.

MOVE <wa> TO output_tab_pd-data+datafields-field_start.

ENDLOOP.

output_tab_pd-infotype = tabname.

APPEND output_tab_pd.

ENDLOOP.

ENDLOOP.

Read only

0 Likes
3,300

It seems to give an error.. Any idea why?

Read only

Former Member
0 Likes
3,300

hi,

U can use progress indicator to avoid "Time Limit Exceeded "

After applying loop

use

CALL FUNCTION 'PROGRESS_INDICATOR'

EXPORTING

I_TEXT = 'Processing........ '.

second option is .

u can use binary search or other sorting methods to reduce time.

Read only

0 Likes
3,300

Where would I have to put the progress indicator?

Read only

Former Member
0 Likes
3,300

Lol I've just tried it with the progress indicator.

After 50 minutes I get the following error:

Memory low. Leave the transaction before taking a break!

I checked the tables in debug, and its around 1.5 million records now..

any ideas how to speed things up a bit..?

Read only

Former Member
0 Likes
3,301

Hi

When I try to include FOR ALL ENTRIES IN It always loops trough every personell number even when I only have 1 number in the table..

Any idea what this could be?

Read only

0 Likes
3,300

For sure use the FOR ALL ENTRIES suggestion as that will improve performance BUT check table i_objects is not empty first. Also make sure table DATAFIELDS is a sorted table to help speed up the loop search.

Read only

0 Likes
3,300

Hello.. Problem is that the table isn't empty :s

No mather wat the contents is, it always takes all records.

And can you explain a sorted table a bit more..?

Thx

Read only

0 Likes
3,300

Try this way


FIELD-SYMBOLS: <it> TYPE STANDARD TABLE,
                 <temp>,
                 <wa> TYPE ANY.
 
  DATA: infty_tab_pointer TYPE REF TO data.
  CREATE DATA infty_tab_pointer TYPE TABLE OF (tabname).
  ASSIGN infty_tab_pointer->* TO <it>.
    if not i_objects[] is initial.
      SELECT * FROM (tabname) INTO CORRESPONDING FIELDS OF TABLE <it>
         for all entries in i_objects
         WHERE objid EQ i_objects-objid.        
    endif.

    LOOP AT i_objects.
      LOOP AT <it> ASSIGNING <temp> where objid EQ i_objects-objid.
        LOOP AT datafields WHERE infotype = tabname.
          ASSIGN COMPONENT datafields-field_name OF 
                    STRUCTURE <temp> TO <wa>.
           MOVE <wa> TO output_tab_pd-data+datafields-field_start.
        ENDLOOP.
         output_tab_pd-infotype = tabname.
        APPEND output_tab_pd.
      ENDLOOP.
    ENDLOOP.

a®

Read only

0 Likes
3,300

Same problem.. I always get a selection without where cause..

Read only

0 Likes
3,300

Sure.

For the following loop over datafields:

LOOP AT datafields WHERE infotype = tabname.

it makes sense to declare datafields as a sorted table with non-unique key infotype. Doing this will speed up the above loop statement as a full table scan is not needed. Make sure datafields is sorted by field infotype and it is the first column in the table.

As for the FOR ALL ENTRIES are you using the correct construct, like this:

if i_objects[] is not initial.

SELECT *

FROM (tabname)

INTO CORRESPONDING FIELDS OF TABLE <it>

FOR ALL ENTRIES IN i_objects

WHERE objid EQ i_objects-objid.

endif.

Hope it helps some.

Read only

0 Likes
3,300

Ok thanks.

but for the "FOR ALL ENTRIES"

I have exact the same code as you have..

Read only

0 Likes
3,300

If you moving the select statement out side of the loop. then we have an issue of get an compliation error in the line


  LOOP AT <it> ASSIGNING <temp> where objid EQ i_objects-objid.

then probably you need to change code this way.


field-symbols : <fs> type any.
LOOP AT i_objects.
  LOOP AT <it> ASSIGNING <temp> 
" if your OBJID is always comes in 1 postion then or find the position
    ASSIGN COMPONENT 1 oF STRUCTURE <temp> TO <fs>. 
    if <fs> = i_objects-objid.
    LOOP AT datafields WHERE infotype = tabname.
          ASSIGN COMPONENT datafields-field_name OF 
                    STRUCTURE <temp> TO <wa>.
           MOVE <wa> TO output_tab_pd-data+datafields-field_start.
        ENDLOOP.
         output_tab_pd-infotype = tabname.
        APPEND output_tab_pd.
      ENDLOOP.
    endif.
    ENDLOOP.

Read only

0 Likes
3,300

Set a breakpoint at the select for all entries statement. Check the data in table i_objects-objid. I would expect the select to only return records where objid matched. Try clearing the results table <it> before the select????

clear: <it>.

if i_objects[] is not initial.

SELECT *

FROM (tabname)

INTO CORRESPONDING FIELDS OF TABLE <it>

FOR ALL ENTRIES IN i_objects

WHERE objid EQ i_objects-objid.

endif.

Read only

0 Likes
3,300

Still the same..

I check the objects table, contains 1 opbjectID.

<it> is cleared before the select.

after select, all records of the table are in <it>..

Cant understand a thing of what's happening..

but thanks for your help!

Read only

0 Likes
3,300

Taking another look at your code the SELECT FOR ALL ENTRIES is not a very good idea (sorry) as based on OBJID the structure of the result table <IT> will be different! Therefore trying to select data for all OBJID in one go will not work as <IT> can only cope with data from one type of OBJID at any one time.

Looks like you will have to restore the original select statement and look at other performance improvements.

Read only

0 Likes
3,300

lol ok.. Any other ideas?

Read only

0 Likes
3,300

Explain again why you cannot run this in the background and display a result list to the user? That sounds like the best option. You mentioned you were getting memory problems, these will need to be addressed whether running in foreground or background. Perhaps provide a selection screen to allow users to restrict the data processed in each run?

Read only

0 Likes
3,300

Yes running in background seems like a good solution to me..

I just don't know how I can continue after the run(in background) is finished..

Read only

0 Likes
3,300

hi ,

background report after selecting data may send

e-mail to your boss,

this e-mail will be executable and express, then

they obtain popup window and

after that from office folder they may start

(execute function) a second report (transaction etc)....

(below code sample which must insert to first report)

best regards,darek

data:
  w_doc_data like sodocchgi1,
  object_para  like soparai1 occurs 0 with header line,
  t_contents   like solisti1 occurs 0 with header line,
  t_receivers  like somlreci1 occurs 0 with header line,
  w_sent_all(1) type c.

  refresh: t_contents, t_receivers, object_para.


     t_receivers-receiver   = ‘USER_NAME’.
     t_receivers-rec_type   = ''.
     t_receivers-com_type   = ''.
     t_receivers-notif_del  = 'X'.
     t_receivers-notif_ndel = 'X'.
     t_receivers-express    = 'X'.
     append t_receivers.

     t_contents = 'mail content'.
     append t_contents.

     clear w_doc_data.

     w_doc_data-obj_langu = sy-langu.
     w_doc_data-obj_descr = 'mail title'.
     w_doc_data-sensitivty = 'F'.
     w_doc_data-no_change  = 'X'.
     w_doc_data-proc_type = 'T'.
     w_doc_data-proc_name = 'SA38'.
     w_doc_data-doc_size  = 1000.


     object_para-name = 'RID'.
     object_para-low = 'zreport_name'.
     append object_para.

       call function 'so_new_document_send_api1'
        exporting
            document_data              = w_doc_data
            put_in_outbox              = 'X'
       importing
           sent_to_all                = w_sent_all
       tables
            object_content             = t_contents
            object_para                = object_para
            receivers                  = t_receivers
       exceptions
            too_many_receivers         = 1
            document_not_sent          = 2
            document_type_not_exist    = 3
            operation_no_authorization = 4
            parameter_error            = 5
            x_error                    = 6
            enqueue_error              = 7.

Edited by: dariusz sobczak on Apr 14, 2008 2:39 PM

Edited by: dariusz sobczak on Apr 14, 2008 2:41 PM