2023 Aug 08 11:57 AM
Hi,
Is below select query is correct to fetch data from MSEG for MSEG-MATNR = 200000003,
After executing the select statement getting zero records, but for same value when I check at table level records exists.
SELECT *
FROM MSEG
INTO TABLE @DATA(IT_MSEG1)
where WERKS = 'US01'
AND BUDAT_MKPF GE @I_FKDATLOW
AND BUDAT_MKPF LE @I_FKDATHIGH
AND MATNR = '200000003'
AND BWART = '531'
2023 Aug 08 12:08 PM
user conversion exit alpha input to convert matnr from 200000003 to 200000003 preceded with zeroes similar to what you see in se11/se16n. And then you send that data in where condition of select.
2023 Aug 08 12:14 PM
I would suggest to check the exact condition on the Table level. Using "BETWEEN" statement in the condition for the date could also be useful for getting the date for the Date range.
2023 Aug 08 12:26 PM
So, you are recommending the OP to use
AND BUDAT_MKPF BETWEEN @I_FKDATLOW AND @I_FKDATHIGH
instead of
AND BUDAT_MKPF GE @I_FKDATLOW
AND BUDAT_MKPF LE @I_FKDATHIGH
That's good, but that's not answering the question.
2023 Aug 08 12:24 PM
You say "when I check at table level records exists."
You need to understand the concept of Conversion Exit at the DDIC Domain (SE11) level = difference between external (display) and internal (database) value. See the conversion exit in the domain MATNR.
Solution is given by Abhishek ("alpha input to convert matnr from 200000003 ...").
See forum and ABAP documentation for more information about Conversion Exits.