Skip to Content
author's profile photo Former Member
Former Member

how to do that code for better performance

hi

i do that code and i wont to now if i can do that in other way for better performence

Regards

CLEAR: a_index.

DESCRIBE TABLE intab_a132 LINES a_index.

IF a_index > 1.

DO a_index TIMES.

LOOP AT zempkostlprice_rec INTO wa_zem.

READ TABLE intab_a132 INTO wa_intab_a132 INDEX a_index.

IF wa_intab_a132-datab LE wa_zem-date.

IF wa_zem-kbetr IS INITIAL AND wa_zem-konwa IS INITIAL AND wa_zem-kostl IS INITIAL.

MOVE: wa_intab_a132-kostl TO wa_zem-kostl,

wa_intab_a132-kbetr TO wa_zem-kbetr,

wa_intab_a132-konwa TO wa_zem-konwa.

MODIFY zempkostlprice_rec FROM wa_zem TRANSPORTING kbetr konwa kostl.

CLEAR:wa_zem,wa_intab_a132.

ENDIF.

ENDIF.

ENDLOOP.

a_index = a_index - 1.

ENDDO.

ENDIF.

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Aug 29, 2007 at 08:45 AM

    Hi,

    Try this code

    FIELD-SYMBOLS: <wa_zem> LIKE LINE OF zempkostlprice_rec. "use field symbol for modifying.
    CLEAR: a_index.
    DESCRIBE TABLE intab_a132 LINES a_index.
    IF a_index > 1.
    DO a_index TIMES.
    READ TABLE intab_a132 INTO wa_intab_a132 INDEX a_index. "This read need not be in the LOOP.
    LOOP AT zempkostlprice_rec ASSIGNING  <wa_zem>.
    
    IF wa_intab_a132-datab LE <wa_zem>-date.
    IF <wa_zem>-kbetr IS INITIAL AND <wa_zem>-konwa IS INITIAL AND <wa_zem>-kostl IS INITIAL.
    <wa_zem>-kostl = wa_intab_a132-kostl. "Using field symbol will not require MOVE and MODIFY.
    <wa_zem>-kbetr = wa_intab_a132-kbetr.
    <wa_zem>-konwa = wa_intab_a132-konwa.
    
    CLEAR:wa_intab_a132.
    UNASSIGN <wa_zem>.
    ENDIF.
    ENDIF.
    ENDLOOP.
    a_index = a_index - 1.
    ENDDO.
    ENDIF. 
    

    Regards,

    Sesh

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Aug 29, 2007 at 09:13 AM

    I would consider your coding a highly dangerous, because you implicitly assume that the the 2 tables zempkostlprice_rec and intab_a132 have directly corresponding entries and intab_a132 is sorted in reversed order compared to

    zempkostlprice_rec.

    LOOP AT zempkostlprice_rec INTO wa_zem.

    READ TABLE intab_a132 INTO wa_intab_a132 INDEX a_index.

    IF wa_intab_a132-datab LE wa_zem-date.

    IF wa_zem-kbetr IS INITIAL AND wa_zem-konwa IS INITIAL AND wa_zem-kostl IS INITIAL.

    MOVE: wa_intab_a132-kostl TO wa_zem-kostl,

    wa_intab_a132-kbetr TO wa_zem-kbetr,

    wa_intab_a132-konwa TO wa_zem-konwa.

    MODIFY zempkostlprice_rec FROM wa_zem TRANSPORTING kbetr konwa kostl.

    CLEAR:wa_zem,wa_intab_a132.

    ENDIF.

    ENDIF.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.