2010 Oct 14 4:45 AM
Hi All,
I need to select onlyl those MBLNR from MKPF
Which MBLNR are not in BKPF.
I have write code like below:
DATA : BEGIN OF T_BKPF OCCURS 0,
BELNR LIKE BKPF-BELNR,
END OF T_BKPF.
DATA: BEGIN OF T_MKPF OCCURS 0,
MBLNR LIKE MKPF-MBLNR,
END OF T_MKPF.
SELECT BELNR INTO CORRESPONDING FIELDS OF TABLE T_BKPF.
SELECT MBLNR INTO CORRESPOMDING FIELDS OF TABLE T_MKPF
WHERE MBLNR NOT IN T_BKPF.
But its not correct. Please tell me how can I get the data.
with thanks,
Moshior
2010 Oct 14 5:36 AM
this might not be very efficient but you could use a sub-query in the select:
data t type table of mkpf.
select * from mkpf
into table t
where not exists
( select * from bkpf
where belnr = mkpf~mblnr )
Hi All,
I need to select onlyl those MBLNR from MKPF
Which MBLNR are not in BKPF.
I have write code like below:
DATA : BEGIN OF T_BKPF OCCURS 0,
BELNR LIKE BKPF-BELNR,
END OF T_BKPF.
DATA: BEGIN OF T_MKPF OCCURS 0,
MBLNR LIKE MKPF-MBLNR,
END OF T_MKPF.
SELECT BELNR INTO CORRESPONDING FIELDS OF TABLE T_BKPF.
SELECT MBLNR INTO CORRESPOMDING FIELDS OF TABLE T_MKPF
WHERE MBLNR NOT IN T_BKPF.
But its not correct. Please tell me how can I get the data.
with thanks,
Moshior
2010 Oct 14 4:56 AM
hi
range : r_xblnr for bkpf-xblnr.
SELECT XBLNR from bkpf and populate into range r_xblnr.
SELECT MBLNR INTO CORRESPOMDING FIELDS OF TABLE T_MKPF
WHERE MBLNR NOT IN r_xblnr.
Edited by: Sachin Patil on Oct 14, 2010 9:30 AM
2010 Oct 14 5:36 AM
this might not be very efficient but you could use a sub-query in the select:
data t type table of mkpf.
select * from mkpf
into table t
where not exists
( select * from bkpf
where belnr = mkpf~mblnr )
2010 Oct 14 5:50 AM
2010 Oct 14 5:55 AM
Hi,
I'm not sure that your data selection makes sense. Normally MKPF-MBLNR and BKPF-BELNR are completely different document types.
But if it is true, then please verify, whether you have to check for the year MKPF-MJAHR vs. BKPF-GJAHR, too.
Those document numbers in both tables are not unique by there numbers!
Regards,
Klaus
2010 Oct 14 8:19 AM