Skip to Content
author's profile photo Former Member
Former Member

Line item display problem from table

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.

.

.

..

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2009 at 08:16 AM

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

    hkont = '000500100' OR koart = 'D'

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2009 at 08:22 AM

    hi,

    Check this

    Or instead of AND

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

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 27, 2009 at 09:25 AM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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.

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.