hi gurus
/h
this is my code, and in migo if i click on check it is checking for all lineitems, it should check for only one line item and display log message should be displayed for one lineitem.
if sy-tcode = 'MIGO' OR sy-tcode = 'MIGO_GR'.
Data : BUKRS LIKE BKPF-BUKRS,
DATE LIKE SY-DATUM,
CURRY LIKE BKPF-GJAHR.
Data : Begin of it_mseg occurs 0,
mblnr like mseg-mblnr,
* bwart like mseg-bwart,
* gjahr like mseg-gjahr,
* lifnr like mseg-lifnr,
END OF it_mseg.
Data : Begin of it_mkpf occurs 0 ,
mblnr like mkpf-mblnr,
xblnr like mkpf-xblnr,
* frbnr like mkpf-frbnr,
* bwart like mseg-bwart,
* gjahr like mseg-gjahr,
* lifnr like mseg-lifnr,
END OF it_mkpf.
Data : Begin of it_mkpf2 occurs 0 ,
mblnr like mkpf-mblnr,
frbnr like mkpf-frbnr,
END OF it_mkpf2.
Data : Begin of it_mkpf3 occurs 0 ,
mblnr like mkpf-mblnr,
frbnr like mkpf-frbnr,
END OF it_mkpf3.
Data : ref type mkpf-xblnr,
bol type mkpf-frbnr.
Data : doc_no type mkpf-mblnr,
inv_no type mkpf-xblnr,
output type string.
read TABLE mkpf.
Bukrs = '8888'.
DATE = mkpf-budat.
CALL FUNCTION 'GET_CURRENT_YEAR'
EXPORTING
BUKRS = Bukrs
DATE = DATE
IMPORTING
* CURRM =
CURRY = CURRY
* PREVM =
* PREVY =
.
if mseg is not INITIAL.
read TABLE mseg .
if mseg-bwart = '101'.
select mblnr from mseg
into table it_mseg
where bwart = mseg-bwart
and lifnr = mseg-lifnr
and gjahr = curry.
if it_mseg[] is not INITIAL.
delete ADJACENT DUPLICATES FROM it_mseg COMPARING mblnr.
select mblnr xblnr from mkpf
into table it_mkpf
FOR ALL ENTRIES IN it_mseg
where mblnr = it_mseg-mblnr
and xblnr = mkpf-xblnr.
*****************************************************
if it_mkpf[] is not initial.
Read table it_mkpf index 1.
clear : doc_no,
inv_no,
output.
doc_no = it_mkpf-mblnr.
inv_no = it_mkpf-xblnr.
Concatenate 'This DC No:' Inv_no 'Available For Doc No : ' doc_no into output
separated by space.
Message output Type 'E'.
endif.
select mblnr frbnr from mkpf
into table it_mkpf2
FOR ALL ENTRIES IN it_mseg
where mblnr = it_mseg-mblnr
and frbnr = mkpf-frbnr.
******************************************************
if it_mkpf2[] is not INITIAL.
Read table it_mkpf2 index 1.
clear : doc_no,
inv_no,
output.
doc_no = it_mkpf2-mblnr.
inv_no = it_mkpf2-frbnr.
Concatenate 'This Invoice No:' inv_no 'Available For Doc No : ' doc_no into output
separated by space.
Message output Type 'E'.
/h
with warm regards
nagaraj