09-09-2009 7:30 AM
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
09-09-2009 7: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
09-09-2009 7: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
09-09-2009 7:37 AM
Hi, Selk,
Please check for your other WHERE Conditions are they true for 22 as well ?
Regards,
Faisal
09-09-2009 7: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
09-09-2009 7: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
09-09-2009 7: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
09-09-2009 12:11 PM
Hi,
Thank you all for the Quick reply.
My issue is solved.
Regards.
Selina.