2012 Nov 29 8:32 AM
Hi all,
I have a query where the invoice amount from the field 'bsch' must be displayed only if it is an outstanding, i.e. " bsch = '31' ".
I tried the if loop:
get lfa1.
get lfb1.
get bsik.
perform xyz.
form xyz.
if bsik-bschl = '31'.
write:/ lfa1-lifnr,
lfa1-name1,
lfb1-bukrs,
bsik-gjahr,
bsik-belnr.
if bsik-bschl = '31'.
write: at 80 bsik-dmbtr.
else.
write: '-'.
endif.
But it returns all the data and does not filter it. Any suggestions would be much appreciated!!!
Thanks!!!
Regards,
Deepak.M
2012 Nov 29 8:57 AM
Hi Deepak ,
Its working perfectly alright .
form xyz.
if bsik-bschl = '31'.
write😕 lfa1-lifnr,
lfa1-name1,
lfb1-bukrs,
bsik-gjahr,
bsik-belnr.
if bsik-bschl = '31'.
write: at 80 bsik-dmbtr.
else.
write: '-'.
endif.
endif. " you haven't mentioned this endif in your code above
Check your cases again and debug it.
2012 Nov 29 10:37 AM
Hi Sijin,
I tried that but to no vain.
My complete program is:
REPORT YAPXX13_4.
nodes: lfa1, lfb1, bsik.
data: amt type bsik-dmbtr,
ttl type p decimals 2,
tl type p decimals 2.
get lfa1.
get lfb1.
get bsik.
perform xyz.
form xyz.
write:/ lfa1-lifnr,
lfa1-name1,
lfb1-bukrs,
bsik-gjahr,
bsik-belnr.
select dmbtr from bsik into amt where bschl = '31' and lifnr = lfa1-lifnr and bukrs = lfb1-bukrs.
write: at 80 amt.
endselect.
select sum( dmbtr ) from bsik into ttl where bschl = '31' and lifnr = lfa1-lifnr.
if ttl > '0' and bsik-bschl = '31'.
write: at 100 ttl.
endif.
select sum( dmbtr ) from bsik into tl where bschl = '31' and lifnr = lfa1-lifnr and bukrs = lfb1-bukrs.
if tl > '0'.
write: at 120 tl.
endif.
endform.
Regards,
Deepak.M
2012 Nov 29 11:17 AM
Hi Deepak ,
You just code like this.
form xyz.
if bsik-bschl = '31'.
write:/ lfa1-lifnr,
lfa1-name1,
lfb1-bukrs,
bsik-gjahr,
bsik-belnr.
select dmbtr from bsik into amt where bschl = '31' and lifnr = lfa1-lifnr and bukrs = lfb1-bukrs.
write: at 80 amt.
endselect.
select sum( dmbtr ) from bsik into ttl where bschl = '31' and lifnr = lfa1-lifnr.
if ttl > '0' and bsik-bschl = '31'.
write: at 100 ttl.
endif.
select sum( dmbtr ) from bsik into tl where bschl = '31' and lifnr = lfa1-lifnr and bukrs =lfb1-bukrs.
if tl > '0'.
write: at 120 tl.
endif.
endif.
endform.
2012 Nov 29 11:31 AM
2012 Nov 29 11:37 AM
Its working perfectly alright .
form xyz.
if bsik-bschl = '31'.
write😕 lfa1-lifnr,
lfa1-name1,
lfb1-bukrs,
bsik-gjahr,
bsik-belnr.
bsil-ebeln.
if bsik-bschl = '31'.
write: at 80 bsik-dmbtr.
else.
write: '-'.
endif.
endif. " you haven't mentioned this endif in your code above
Check your cases again and debug it.