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

Line item display problem from table

Former Member
0 Likes
894

Hi experts......

I am strucked up in my report with a problem ,

document no.(BELNR) for corresponding bkpf has four line item in BSEG table,

BUZEI GJAHR BUZEI KOART DMBTR HKONT

9000000078 2006 1 S 200,600.00 0000500100

9000000078 2006 2 S 24,072.00 0000301500

9000000078 2006 3 S 481.00 0000300450

9000000078 2006 4 D 225,153.00 0000209800

My requiremet is that

========================

when it goes inside the loop

i want to display the belnr where Hkont = '000500100'

and koart = 'D', that will be 001 line item (buzei) and 0004 Buzei in this case.

ie my output should be like

============================

GROSS NET

200,600.00 225,153.00

If i specify and hkont = '000500100'and koart = 'D'. its not getting inside the select itself

if i select without the where condition and hkont = '000500100'and koart = 'D' its going inside...

Can you please help me out....

My codings

elect bukrs belnr gjahr xref1 xref2 kunnr buzei dmbtr hkont koart from bseg into corresponding fields of table it_bseg

for all entries in it_bkpf

where bukrs = it_bkpf-bukrs

and belnr = it_bkpf-belnr

and gjahr = it_bkpf-gjahr

and hkont = '000500100'

and koart = 'D'.

.

.

.

.

.

loop at it_bseg into wa_bseg .

wa_final-kunnr = wa_bseg-kunnr.

wa_final-xref1 = wa_bseg-xref1.

wa_final-xref2 = wa_bseg-xref2.

wa_final-DMbtr = wa_bseg-dmbtr.

.

.

..

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
840

for your case i think you should use 'OR' instead of 'AND'.

hkont = '000500100' OR koart = 'D'

for your case i think you should use 'OR' instead of 'AND'.

hkont = '000500100' OR koart = 'D'

5 REPLIES 5
Read only

Former Member
0 Likes
841

for your case i think you should use 'OR' instead of 'AND'.

hkont = '000500100' OR koart = 'D'

Read only

0 Likes
840

hi thanks for the reply

select bukrs belnr gjahr xref1 xref2 kunnr buzei dmbtr hkont koart from bseg into corresponding fields of table it_bseg

for all entries in it_bkpf

where bukrs = it_bkpf-bukrs

and belnr = it_bkpf-belnr

and gjahr = it_bkpf-gjahr

  • and ( hkont = '000500100' or koart = 'D').

i tried giving this way too ...but its not fetching the value....

and one more problem is the my NETPAY AND GROSS AMT inthe table is stored in same

field name as DMBTR , how can make it to display in net and gross

Read only

Former Member
0 Likes
840

hi,

Check this

Or instead of AND

If i specify and hkont = '000500100' OR koart = 'D'.

Read only

Former Member
0 Likes
840

Again check this query should be work. Otherwise you have one more option, select all the data and use the delete statement

delete fomr it_bseg where hkont ne 'your value'.

second if you have two fields with same name then declare in the internal table as folows.

data: begin of itab occurs 0,

dmbtr like tab1-dmbtr,

gross_pay like tab2-dmbtr,

end of itab.

select dmbter from tab1 into corresponding fields of table itab.

loop at itab.

select dmbtr from tab2 into itab-gross_pay.

modify itab transporting gross_pay.

endloop.

Read only

0 Likes
840

hi ...

thanx a lot fo your reply,....

thats wat i thought and was trying to do so.....

and modified...can you please look in to the code....

but wa_final-gross = wa_amount-dmbtr.

wa_final-net = wa_amount-dmbtr.

value is not getting populated ....i dont know the reason

IF it_bseg[] is not initial.

select bukrs belnr gjahr dmbtr from bseg into corresponding fields of table it_amount

for all entries in it_bseg

where bukrs = it_bseg-bukrs

and belnr = it_bseg-belnr.

endif.

if it_amount[] is not initial.

select kunnr name1 LOCCO from kna1 into corresponding fields of table it_kna1

for all entries in it_bseg

where kunnr = it_bseg-kunnr and

locco = pr_locco.

endif.

;

;

;

;;

sort it_bseg by belnr.

loop at it_bseg into wa_bseg .

wa_final-kunnr = wa_bseg-kunnr.

wa_final-xref1 = wa_bseg-xref1.

wa_final-xref2 = wa_bseg-xref2.

read table it_amount into wa_amount with key belnr = bseg-belnr.

if sy-subrc = 0.

if wa_bseg-hkont = '000500100'.

wa_final-gross = wa_amount-dmbtr.

endif.

if wa_bseg-koart = 'D'.

wa_final-net = wa_amount-dmbtr.

Endif.

at end of belnr.

Endat.

Endif.