2007 Mar 11 4:54 AM
I'm using PNP LDB in my report and I'd like to display how many records I have so I wrote this code
If i_tab is not initial.
DESCRIBE TABLE i_tab LINES counter.
WRITE counter .
Endif.
but I'm getting wrong result. Can anybody help please.
2007 Mar 11 1:13 PM
Hi Shaheen,
1) counter = lines( i_tab ). "This is up-tp-date use of system function
2) It is not clear where (and even if) you fill this i_tab.
3) Using LDB you will have a GET statement. Place command
ADD 1 to counter directly after the GET.
END-OF-SELECTION is the right moment to check the counter.
Regards,
Clemens
2007 Mar 11 5:04 AM
Does ur Internal table have a Header line. If yes, the IF condition takes into account the header line. Check if this solves ur problem. If no, give more particulars.
Please award points if this was helpful.
2007 Mar 11 5:53 AM
Like what i mean to say is change your code to this if itab has a header line.
If <b>i_tab[]</b> is not initial.
DESCRIBE TABLE i_tab LINES counter.
WRITE counter .
Endif.
2007 Mar 11 5:57 AM
If ur i_tab is with header line , then u have to include square brackets
If not i_tab[] is initial.
DESCRIBE TABLE i_tab LINES counter.
WRITE counter .
Endif.
2007 Mar 11 6:32 AM
2007 Mar 11 12:46 PM
Hi shaheen,
try with system field.
SY-TFILL.
Regards,
Francis .
Reward points .
2007 Mar 11 1:13 PM
Hi Shaheen,
1) counter = lines( i_tab ). "This is up-tp-date use of system function
2) It is not clear where (and even if) you fill this i_tab.
3) Using LDB you will have a GET statement. Place command
ADD 1 to counter directly after the GET.
END-OF-SELECTION is the right moment to check the counter.
Regards,
Clemens
2007 Mar 12 4:15 AM
Yes it is working now I'm geting the correct result ..... thanks alot ..... but when I try to put in the top_of_page event it is not ..... any suggestions please.
2007 Mar 12 4:22 AM
shaheen,
Initialization event will call first TOP-OF PAGE event.That time Count will not available.
Initialization event will triggered only once,that is at first execution of the system.
Pls. reward if useful
2007 Mar 15 11:05 PM
Hi muralikrishna kaipha,
I can't believe this.
TOP-OF PAGE page is triggered before the first line is written to a page. That means TOP-OF PAGE is triggered by first write statement in program. INITIALIZATION is normally not used to write anything.
You must avoid to write more than one page during TOP-OF PAGE event because this will trigger TOP-OF PAGE recursively endless.
Think about it.
Regards,
Clemens
2007 Mar 12 5:41 AM
hi,
in your code you are using like
If i_tab is not initial.
then it will treated as headerline (because table name and header line name are same). so modify your code as follows.
If i_tab[] is not initial.
now it will treated as table.