Application Development 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: 

how to get the Count for no.of.errors

former_member342013
Contributor
0 Kudos
111

HI

BELOW IS MY CODE

LOOP AT I_RETURN INTO WA_RETURN.
  IF WA_RETURN-TYPE ='E'.
    CONCATENATE SOURCE-AUFNR '|' SOURCE-VORNR '|'WA_RETURN-MESSAGE
                                                     INTO TEXT.
    WRITE:/ TEXT.
    COUNTER = COUNTER + 1.
  ENDIF.

IM GETTING BELOW O/P

000090001366 0020 Enter another operation number
000090001366 0020 Error  during processing of BAPI methods
000090001366 0050 Item categories in agreement and requisition incompatible
000090001366 0050 Error  during processing of BAPI methods

NO.Of records In Error          4

My Requirement is if AUFNR and VORNR value is same then the count should be 1 , Like the o/p should be

NO.Of records In Error          2

because AUFNR and VORNR is same for 2 records , can any one tel me the logic to do this,

AUFNR and VORNR value is there in Internal Table

6 REPLIES 6

Former Member
0 Kudos
69

Hi,

Sort the internal table by AUFNR and VORNR and use delete adjacent duplicates on itab comparing AUFNR and VORNR.

Regards,

Srini.

Abhijit74
Active Contributor
0 Kudos
69

Hi,

Your code should look likes below.

SORT I_RETURN BY AUFNR
		 VORNR.

DELETE ADJACENT DUPLICATES FROM i_return COMPARING AUFNR VORNR.  	
	

LOOP AT I_RETURN INTO WA_RETURN.
  IF WA_RETURN-TYPE ='E'.
	
   CONCATENATE SOURCE-AUFNR '|' SOURCE-VORNR '|'WA_RETURN-MESSAGE
   	                                               INTO TEXT.
	 WRITE:/ TEXT.
	 COUNTER = COUNTER + 1.
   	
  ENDIF.

Regards,

Abhijit

0 Kudos
69

Hi All,

Thanks for the replies.

AUFNR and VORNR are in different tables so im putting them in one internal table

loop at itab into wtab.
    wtab-aufnr = wa_methods-objectkey.
    wtab-vornr = wa_operation-activity.
endloop.

now

IF WA_RETURN-TYPE ='E'.

now if aufnr and VORNR is same then i should get error message as said above

can any one tel me the logic

andreas_mann3
Active Contributor
0 Kudos
69

try:

 

SORT I_RETURN BY AUFNR
                 VORNR.


LOOP AT I_RETURN INTO WA_RETURN where TYPE ='E'.

 at new aufnr.
  add 1 to counter.
 endat.

   CONCATENATE SOURCE-AUFNR '|' SOURCE-VORNR '|'WA_RETURN-MESSAGE
                                                   INTO TEXT.
  WRITE:/ TEXT.


endloop.

A.

Former Member
0 Kudos
69

Hi Smitha...

1st short table by AUFNR, VORNR and Type wise.

Then you can incremet counter On change of AUFNR,VORNR and Type wise and you will gt the exact count.

Thanks,

Vidhi

Former Member
0 Kudos
69

1.declare an internal table with three fields

2.pass the the required values into it.

3.append it

4.sort it ascending or descendign whatever way want it.

5.delete adjacent duplicates

4.get the number of entries in internal table using describe.

5.display output using write.