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

urgent

dear all,

can anybody tell me the solution for this

INTERNAL TABLE ITAB HAS 100 RECORDS . WRITE LOGIC TO FIND AND

CALCULATE THE SUM OF AN NUMERIC FIELD IN ITAB FOR RECORDS RANGING FROM

POSITIONS 51 TO 57.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Posted on Jan 07, 2008 at 09:42 AM

    check sy-tabix between 51 and 57,

    add itab-wrbtr to sum.

    A.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 07, 2008 at 09:45 AM

    Hi,

    Loop at itab.

    if sy-tabix >= 51 and sy-tabix <= 57.

    sum = sum + itab-num1.

    endif.

    endloop.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 07, 2008 at 09:48 AM

    loop at the internal table....

    count = 51

    if sy-tabix = count and sy-tabix < 58

    sum = sum + itab-netwr.

    endif.

    count = count + 1.

    endloop.

    Try the above code

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 07, 2008 at 09:51 AM

    data: cnt type i value '51',

    total type i value '0'.

    do 7 times.

    read table itab into wa index cnt.

    total = total + wa-fieldnum1.

    cnt = cnt + 1.

    enddo.

    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.