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

Not geting right result when i execute multiple selection

Former Member
0 Likes
501

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

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

2 REPLIES 2
Read only

OttoGold
Active Contributor
0 Likes
459

Why don´t you use the markups to make the code readable for the people?

...

-> Displays the line as programming code

If i could read the post, I would probably try to help.

Regards Otto

Read only

Former Member
0 Likes
459

getting answer