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

Data from BSEG table

Hi all,

I have written a select query to pull data from BSEG table for BSCHL (Posting key) values 31 or 22.

But currently its pulling only for 31 value and not for 22, if i am specifying only 22 in where condition then also I am facing the same problem.

How can I modify the below select query to pull data from bseg table for b oth the values of BSCHL field?

SELECT BUKRS BELNR GJAHR AUGDT BSCHL WRBTR WMWST LIFNR

APPENDING CORRESPONDING FIELDS OF TABLE I_BSEG PACKAGE SIZE 5000

FROM BSEG

WHERE BUKRS IN S_BUKRS

AND AUGDT IN S_AUGDT

AND BSCHL IN ('31','22')

AND KOART = 'K'

AND SHKZG = 'H'

AND LIFNR IN S_LIFNR.

Endselect.

Thanks in advance.

Selina

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    Posted on Sep 09, 2009 at 06:46 AM

    Hi, Selk

    Just comment out the following where condition.

    "AND shkzg = 'H'

    Same on my system there is no value in the table where SHKZG = 'H' and BSCHL = '22'.

    Hope will help you to understand you problem,

    Best Regards,

    Faisal

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 09, 2009 at 06:34 AM

    Hello Selina,

    First step will be to check in SE16 if you have data in BSEG for the given combination of selection params.

    Please check & revert back.

    BR,

    Suhas

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Sep 09, 2009 at 06:37 AM

    Hi, Selk,

    Please check for your other WHERE Conditions are they true for 22 as well ?

    Regards,

    Faisal

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 09, 2009 at 06:39 AM

    Hi,

    SELECT bukrs belnr gjahr augdt bschl wrbtr wmwst lifnr

    APPENDING CORRESPONDING FIELDS OF TABLE i_bseg PACKAGE SIZE 100

    FROM bseg

    WHERE bukrs IN s_bukrs

    AND augdt IN s_augdt

    AND ( bschl ='31'

    OR bschl = '22' )

    AND koart = 'K'

    AND shkzg = 'H'

    AND lifnr IN s_lifnr.

    ENDSELECT.

    This should work.. Only this what you need to keep in mind is there should be entries in BSEG for bschl 22 koart K and shkzg H.

    Regards

    Ansari

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Sep 09, 2009 at 06:45 AM

    Hi,

    I think with posting key 22 (Reverse invoice) you can not have SHKZG( Debit credit indicator ) as 'H' it will always be 'D' so you have to remove the where condition on SHKZG and that should resolve the issue.

    Regards,

    Himanshu

    Add a comment
    10|10000 characters needed characters exceeded

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.