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: 

dmbt r Not equal to wrbtr-------------------------belnr

kiran_k8
Active Contributor
0 Kudos

Hi Folks,

I want to fetch all the belnr in a particular fiscal year(gjahr) where Amount in Local currency(dmbtr) is not equal to amount(wrbtr).Can anyone here please guide me with the logic.

tables bseg.

data:begin of ibseg occurs 0,

bukrs like bseg-bukrs,

belnr like bseg-belnr,

gjahr like bseg-gjahr,

dmbtr like bseg-dmbtr,

wrbtr like bseg-wrbtr,

end of ibseg.

selection-screen begin of block b1 with frame title text-001.

parameters p_gjahr like bseg-gjahr.

selection-screen end of block b1.

select bukrs belnr gjahr dmbtr wrbtr from bseg into table ibseg where gjahr = p_gjahr

and bseg-dmbtr ne bseg-wrbtr.

loop at ibseg.

write:/ ibseg-bukrs,

ibseg-belnr,

ibseg-gjahr,

ibseg-dmbtr,

ibseg-wrbtr.

endif.

endloop.

Thanks,

K.Kiran.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Kiran,

select bukrs belnr gjahr dmbtr wrbtr from bseg into table ibseg

where gjahr = p_gjahr.

<b>Remove the other check here.</b>

loop at ibseg.

if ibseg-dmbtr ne ibseg-wrbtr.

write:/ ibseg-bukrs,

ibseg-belnr,

ibseg-gjahr,

ibseg-dmbtr,

ibseg-wrbtr.

endif.

endloop.

This will help u.

Regards,

Sree.

PS: Rewards points if Useful.

5 REPLIES 5

Former Member
0 Kudos

Hi Kiran,

select bukrs belnr gjahr dmbtr wrbtr from bseg into table ibseg

where gjahr = p_gjahr.

<b>Remove the other check here.</b>

loop at ibseg.

if ibseg-dmbtr ne ibseg-wrbtr.

write:/ ibseg-bukrs,

ibseg-belnr,

ibseg-gjahr,

ibseg-dmbtr,

ibseg-wrbtr.

endif.

endloop.

This will help u.

Regards,

Sree.

PS: Rewards points if Useful.

0 Kudos

Sreekanth,

Thanks a ton.

K.Kiran.

Message was edited by:

Kiran K

0 Kudos

Hi Folks,

1.Now I want select bukrs,belnr gjahr dmbtr wrbtr hkont from bseg w.r.t to the waers in bkpf.Can anyone here please help me with that?

tables: bseg,bkpf.

data:begin of ibseg occurs 0,

bukrs like bseg-bukrs,

belnr like bseg-belnr,

gjahr like bseg-gjahr,

dmbtr like bseg-dmbtr,

wrbtr like bseg-wrbtr,

hkont like bseg-hkont,

end of ibseg.

data:begin of ibkpf occurs 0,

BELNR LIKE BKPF-BELNR,

waers like bkpf-waers,

end of ibkpf.

selection-screen begin of block b1 with frame title text-001.

parameters: p_gjahr like bseg-gjahr,

p_bukrs like bseg-bukrs,

P_hkont LIKE BSEG-hkont.

selection-screen end of block b1.

SELECT BUKRS BELNR GJAHR DMBTR WRBTR HKONT FROM BSEG INTO TABLE IBSEG

WHERE GJAHR = P_GJAHR

AND BUKRS = P_BUKRS

AND HKONT = P_HKONT.

IF SY-SUBRC NE 0.

WRITE:/ 'no data'.

else.

loop at ibseg.

if ibseg-dmbtr ne ibseg-wrbtr.

uline (98).

write: /1 sy-vline,

ibseg-bukrs ,

15 sy-vline,

ibseg-belnr hotspot on,

27 sy-vline,

ibseg-gjahr,

42 sy-vline,

ibseg-dmbtr,

60 sy-vline,

ibseg-wrbtr,

80 sy-vline,

ibseg-hkont,

98 sy-vline.

hide ibseg-belnr.

endif.

endloop.

uline (98).

endif.

at line-selection.

IF SY-LSIND = 1.

set parameter id: 'BLN' field ibseg-belnr,

'BUK' field ibseg-bukrs,

'GJR' field ibseg-gjahr.

call transaction 'FB03'.

endif.

top-of-page.

write:/'Date:-',sy-datum.

write:/'Time:-',sy-timlo.

write:/'List:-',sy-lsind.

uline (98).

WRITE:/1 sy-vline, 'Company Code.' color 6,

15 sy-vline, 'Acc.Doc.No.' color 6,

27 sy-vline, 'Fiscal Yr.' color 6,

42 sy-vline, 'Amt in Loc.Curr' color 6,

60 sy-vline, 'Amt in Doc.Curr' color 6,

80 sy-vline, 'Gen.Led.Acc.' color 6,

98 sy-vline.

K.Kiran.

Former Member
0 Kudos

Hi,

in this situation DMBTR is amount in local currency, and WRBTR is in ducument currency..

so pick up only those values which are not in INR currency..

regards,

shardul shah

kiran_k8
Active Contributor
0 Kudos

Problem solved,thanks.