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

Regarding count the records in internal table

Hi All,

I have DEPT DOCTORNAME NATINALITY ADMISSION DISCARGES ALIVE DEAD

SEVEN FIELDS andi am getting records in itab and finaaly appending to itab1

in the loop and endloop .the problem is if i found the condition below i need to count the record , but my count is coming always 1 , pls suggest the best way.

if wa_final-bewty eq '1'.

lv_count = 0.

lv_count = lv_count + 1.

add lv_count to t_final-count.

ENDIF.

APPEND T_FINAL TO T_FINAL1.

endloop.

regards

subbara

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2010 at 05:20 AM

    but my count is coming always 1

    That's because you are initializing it to Zero at every loop and then incrementing by 1.

    I suggest you debug the code to get a better picture of what you are trying to do.

    pk

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2010 at 05:23 AM

    Hi Subbara,

    In you code are you using the statement clear t_final within loop endloop. That can be the reason why it returns value as 1.

    Regards,

    Arun

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Oct 13, 2010 at 05:24 AM

    why are you intializing it to 0 when condition is satisfied you can intialize lv_count outside loop and in loop you increment

    its value if condtion is satisfied.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Oct 13, 2010 at 05:27 AM

    Hi,

    I agree with Kishan P.

    you initializing count in the loop.

    what you can do is clear the vairable once before the loop.

    clear count.

    loop at itab.

    code.

    endloop.

    please debug before posting. It helps to give you better understanding of the flow of your code and you catch the errors faster.

    Regards,

    Sakshi

    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.