‎2008 Jul 16 3:05 PM
I have a internal table with various fields... like
SO SO line item Matnr Date Diff Result
1452261 10 NXP1010 2 Yes
1452261 10 NXP1010 2 Yes
1452261 10 NXP1010 3 Yes
1452261 10 NXP1010 1 No
1452261 10 NXP1010 0 No
Now i want to find the no of records only with result 'YES'. and also i want to find the total no of records.
<removed_by_moderator> <= read [the rules|https://www.sdn.sap.com/irj/sdn/wiki?path=/display/home/rulesofEngagement] here!
Edited by: Julius Bussche on Jul 16, 2008 2:57 PM
Points removed from everyone who answered
‎2008 Jul 16 3:06 PM
loop through. if result equals yes, then add 1 to counter. get total number of lines using lines( ).
matt
‎2008 Jul 16 3:06 PM
loop through. if result equals yes, then add 1 to counter. get total number of lines using lines( ).
matt
‎2008 Jul 16 3:08 PM
hi,
You can find Total No of Records using
DESCRIBE <table> lines <line-var>.
That will Give You Total No of lines ie No of Records.
Regards
Sumit Agarwal
‎2008 Jul 16 3:09 PM
Hi ,
data: counter type i value 0.
Looat at table.
if table-result eq 'Yes'.
counter = counter + 1.
endif.
endloop.
Hope it helps.
Thanks & Regards,
Nagaraj Kalbavi
‎2008 Jul 16 3:10 PM
Copy the intenale table 1(original) to internal table 2.
Describe the 1nd internal table to find the total no of records.
delete the records which has NO.
and Describe the 2nd internal table to find the no of records only with result 'YES'.
Regards,
Rajasekhar Reddy.
‎2008 Jul 16 3:11 PM
Hi,
For finding total number of records use the following logic.
DATA: N1 TYPE I,
N2 type i.
DESCRIBE TABLE ITAB LINES N1.
*N contains the total number of records.
*for finding number of records with Yes try this way
itab1 = itab. * Itab1 same structure of itab.
delete itab1 where result = 'YES'.
DESCRIBE TABLE ITAB1 LINES N2.
*number of records with result = Yes is N1 - N2.
I think this will be performance efficient(without loop) for your case of just knowing number of records
//Kothand
‎2008 Jul 16 3:11 PM
Hi
Use the fields that you want in the below select statement
TABLES xxxx.
SELECT * FROM xxxx
WHERE
Diff Result = 'YES' .
WRITE: / Diff Result.
ENDSELECT.
Regards
Divya