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

LDB - KDF

Former Member
0 Likes
614

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

5 REPLIES 5
Read only

Sijin_Chandran
Active Contributor
0 Likes
558

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.


Read only

0 Likes
558

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

Read only

0 Likes
558

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.

Read only

0 Likes
558

No. I'm still getting all the values.

Read only

0 Likes
558

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.