Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Regarding count

Former Member
0 Likes
1,671

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

1 ACCEPTED SOLUTION
Read only

matt
Active Contributor
0 Likes
1,631

Please use a more informative subject in future

16 REPLIES 16
Read only

Former Member
0 Likes
1,631

hi,

Use the delete adjacent duplicates from itab comparing f1 f2

and describe the table.

Regards,

R K.

Read only

Former Member
0 Likes
1,631

hi,

use DELETE adjacent duplicates from it_tab comparing field1 field2.

describe table it_tab lines v_count.

thanks

Read only

Former Member
0 Likes
1,631

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.

Read only

Former Member
0 Likes
1,631

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

Read only

Former Member
0 Likes
1,631

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.

Read only

0 Likes
1,631

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.}

Read only

Former Member
0 Likes
1,631

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

Read only

matt
Active Contributor
0 Likes
1,632

Please use a more informative subject in future

Read only

Former Member
0 Likes
1,631

what you meant by more informative

Read only

Former Member
0 Likes
1,631

what you meant by more informative

[informative|http://dictionary.reference.com/browse/informative]

pk

Read only

Former Member
0 Likes
1,631

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

Read only

Former Member
0 Likes
1,631

Ive given the most appropriate answer to your last question. Im glad you benefitted with the answer.

pk

Read only

Former Member
0 Likes
1,631

But u answered a question which I never asked u......but 4 my actual question I did'nt get the answer(technical queries)...

Read only

Former Member
0 Likes
1,631

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.

Read only

Former Member
0 Likes
1,631

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

Read only

Former Member
0 Likes
1,631

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