Skip to Content
0
Former Member
Mar 23, 2010 at 09:08 AM

Not geting right result when i execute multiple selection

15 Views

Hi all,

here i have problem with multiple selection. I want total inward and outward quantity . this report execute with month wise so we have to give minimum one month. So when i give only one month as a input this time data given perfect and result is ok after compare with MB51 Tcode. But when i give multiple selection means 2,3,4,5........... month this time getting wrong data . my related coding is below . So if you able then please kindly reply me with solution .

LOOP AT itab2.

MOVE-CORRESPONDING itab2 to itab3.

APPEND itab3.

ENDLOOP.

sort itab3 by mont.

delete ADJACENT DUPLICATES FROM itab3 COMPARING mont.

LOOP AT itab3.

  • LOOP AT itab2 where mont = itab3-mont and ( bwart = '101' or bwart = '262' or bwart = '131' or bwart = '202' or bwart = '501' or bwart = '511' or bwart = '561' or bwart = '123' or bwart = '162').

  • s_erfmg = s_erfmg + itab2-erfmg.

  • s_dmbtr = s_dmbtr + itab2-dmbtr.

  • ENDLOOP.

*

  • LOOP AT itab2 where mont = itab3-mont and ( bwart = '102' or bwart = '261' or bwart = '132' or bwart = '201' or bwart = '502' or bwart = '512' or bwart = '562' or bwart = '122' or bwart = '161' ).

  • s_erfmg1 = s_erfmg1 + itab2-erfmg.

  • s_dmbtr1 = s_dmbtr1 + itab2-dmbtr.

  • ENDLOOP.

LOOP AT itab2 where mont = itab3-mont and ( bwart = '101' or bwart = '262' or bwart = '131' or bwart = '202' or bwart = '501' or "bwart = '102' or

bwart = '511' or bwart = '561' or bwart = '123' or bwart = '162' "or bwart = '122'

or bwart = '552' or bwart = '602' or bwart = '531' or bwart = '544' or bwart = '701' or bwart = '105').

s_erfmg = s_erfmg + itab2-erfmg.

s_dmbtr = s_dmbtr + itab2-dmbtr.

ENDLOOP.

loop at itab2 where bwart = '102' or bwart = '122'. "Add by keyur chauhan

s_erfmg = s_erfmg - itab2-erfmg.

s_dmbtr = s_dmbtr - itab2-dmbtr.

endloop.

LOOP AT itab2 where mont = itab3-mont and ( bwart = '261' or bwart = '132' or bwart = '201' or bwart = '502' or

bwart = '512' or bwart = '562' or bwart = '161'

or bwart = '551' or bwart = '601' or bwart = '532' or bwart = '543' or bwart = '702' or bwart = '106' ).

s_erfmg1 = s_erfmg1 + itab2-erfmg.

s_dmbtr1 = s_dmbtr1 + itab2-dmbtr.

ENDLOOP.

LOOP AT itab2 WHERE shkzg = 'S' and ( bwart = '309' or bwart = '301' or bwart = '641') .

s_erfmg = s_erfmg + itab2-erfmg.

s_dmbtr = s_dmbtr + itab2-dmbtr.

ENDLOOP.

LoOP AT itab2 WHERE shkzg = 'H' and ( bwart = '309' or bwart = '301' or bwart = '641').

s_erfmg1 = s_erfmg1 + itab2-erfmg.

s_dmbtr1 = s_dmbtr1 + itab2-dmbtr.

ENDLOOP.

s_erfmg2 = s_erfmg - s_erfmg1.

s_dmbtr2 = s_dmbtr - s_dmbtr1.

itab3-erfmg = s_erfmg.

itab3-dmbtr = s_dmbtr.

itab3-erfmg1 = s_erfmg1.

itab3-dmbtr1 = s_dmbtr1.

itab3-erfmg2 = s_erfmg2.

itab3-dmbtr2 = s_dmbtr2.

modify itab3.

clear s_erfmg.

clear s_dmbtr.

clear s_erfmg1.

clear s_dmbtr1.

clear s_erfmg2.

clear s_dmbtr2.

ENDLOOP.

Thanks

keyur chauhan