‎2009 Apr 13 11:45 AM
Please use a more informative subject in future
Hi,
PR.No PR.DATE PO.No
(banfn) (ebeln)
0022475 07.10.2008 4500050140
0022477 07.10.2008 4500050189
0022476 07.10.2008 4500050322
0022476 07.10.2008 4500050322
0022478 07.10.2008 4500050844
This is my output.i want to count the PR number and PO number but repeated number should not be counted.
for eg:in the above output i should get
PR.No = 4
PO.No = 4
can you help me on this issue.
Edited by: Matt on Apr 13, 2009 12:57 PM
‎2009 Apr 13 11:58 AM
‎2009 Apr 13 11:48 AM
hi,
Use the delete adjacent duplicates from itab comparing f1 f2
and describe the table.
Regards,
R K.
‎2009 Apr 13 11:49 AM
hi,
use DELETE adjacent duplicates from it_tab comparing field1 field2.
describe table it_tab lines v_count.
thanks
‎2009 Apr 13 11:50 AM
you can use
delete adjacent duplicates from itab into itab1 comparing ebeln(field for PO no.)
describe table itab1 length len.
len will have no. of non-repeated PO no.
Similarly for PR no.
delete adjacent duplicates from itab into itab2 comparing ebeln1(field for PR no.)
describe table itab2 length len1.
len1 will have no. of non-repeated PR no.
‎2009 Apr 13 11:51 AM
Hi
Loop at it_output into wa_output.
Read table it_output into wa_output1 with key wa_output1-banfn = wa_output-banfn.
If sy-subrc = 0.
count_banfn = count_banfn + 1.
else
continue.
endif.
endloop.
Same logic can be applied for PO number.
Hope it will help you.
Regards
Natasha Garg
‎2009 Apr 13 11:52 AM
Hi,
Take two internal table of same type of the table which holds the data..
If you have one PO.NO to each PR.No use the below logic
SORT ITAB BY PR.NO PO.NO
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING PR.NO.
DESCRIBE TABLE ITAB LINES L_PRCOUNT.
If you have mutiple PO for the One Pr then use the Below logic
ITAB1[] = ITAB[].
SORT ITAB1 BY PR.NO.
DELETE ADJACENT DUPLICATES FROM ITAB1 COMPARING PR.NO.
DESCRIBE TABLE ITAB1 LINES L_PRCOUNT.
REFRESH ITAB1.
ITAB1[] = ITAB[].
SORT ITAB1 BY PO.NO.
DELETE ADJACENT DUPLICATES FROM ITAB1 COMPARING PO.NO.
DESCRIBE TABLE ITAB1 LINES L_POCOUNT.
‎2009 Apr 13 11:57 AM
hi,
i have taken only onr internal table.
for PR No i got the output,but for PO.No i didnt get.
the following code i used for PR.No
{SORT ITAB BY BANFN.
LOOP AT ITAB.
AT END OF BANFN.
COUNT = COUNT + 1.
ENDAT.
SORT ITAB BY EBELN.
ENDLOOP.}
‎2009 Apr 13 11:54 AM
hi,
copy ur internal table in to another internal table
itab2[] = itab1[].
for prno.
sort itab1 by prno.
Delete adjacent dupliactes from internal table( itab1 ) comparing prno.
count = lines(itab1).
for pono.
sort itab2 by pono
Delete adjacent dupliactes from internal table( iatb2 ) comparing pono.
count = lines(itab2).
Rgds
siva
Edited by: siva prasad on Apr 13, 2009 12:56 PM
‎2009 Apr 13 11:58 AM
‎2009 Apr 13 11:59 AM
‎2009 Apr 13 12:15 PM
what you meant by more informative
[informative|http://dictionary.reference.com/browse/informative]
pk
‎2009 Apr 13 12:55 PM
Mr...
Did I asked u the meaning of informative to u? please do reply to techinical questions......
i have already replied .if u dont know the answer for the technical queries,please dont reply for non-technical question.........for ur non-techinical information I have given u 10 points..take it
Edited by: Sharmila Somasundaram on Apr 13, 2009 5:26 PM
‎2009 Apr 13 1:00 PM
Ive given the most appropriate answer to your last question. Im glad you benefitted with the answer.
pk
‎2009 Apr 13 1:06 PM
But u answered a question which I never asked u......but 4 my actual question I did'nt get the answer(technical queries)...
‎2009 Apr 13 12:06 PM
Hi Sharmila,
lets say all the records are in the internal table itab.
1. sort the internal table itab with fields PR.No and PO.No.
2. Use the 'Delete adjacent duplicates from table itab comparing PR.No PO.No.
3. loop at itab.
if itab-PR.No ne ' '.
PR_count = PR_count + 1.
elseif itab-PO.No ne ' '.
PO_count = PO_count + 1.
endif.
endloop.
4. Now PR_count has the number of records in the PR_No. and PO_count has the number of records in the PO_No.
‎2009 Apr 13 12:10 PM
Hi,
SORT ACCORDING TO PR.NO IN your itab. Then TAKE a LOOP ON IT AND in loop use at end of pr.no.
For eg.
Sort itab by prno.
Loop at itab.
at end of pr.no.
cnt = cnt + 1.
endat.
endloop.
Regards,
Himanshu
‎2009 Apr 13 1:13 PM
I did not answer your technical query, because it was an easily searchable one. All you needed to do was search in the forums and you would have got hundreds of result, thereby saving your own resolution time and not clog the SCN servers with repeated questions and answers.
SCN is SAP's way of providing free online support. SCN's main idea is to make it an indispensable database for every kind of question. As you can imagine, you are not the first person to have gotten such a requirement. And if you had searched the forums, you could have resolved your issue in a matter of minutes, instead of wasting the whole day and in the meantime listening to comments like these from me.
By not asking basic questions, you can help make SCN a database of Useful Information, rather than a dumpyard of redundant information and link-farms which point to nothing.
pk