‎2006 Jul 19 8:21 AM
Hi,
i want to get the values of maktx from makt table but i doesn't find any common field in zmigo-addition and lifnr.So can i take condition form my first (it_mseg)
shall i get my values according to where condition
Tables: mseg,mkpf,lfa1,ekko,ekpo,bseg,bkpf,zmigo_addition.
selection-screen begin of block b1 with frame title text-001.
parameters: p_werks like mseg-werks.
select-options: s_budat for Mkpf-budat.
selection-screen end of block b1.
types:begin of typ_mseg,
p_werks type werks_d, "Plant location
mblnr type mblnr, "Number of Material Document
s_budat type budat, "Posting date in document
mtsnr type mtsnr1, "Number of external material slip
maktx type maktx, "Material description
menge type menge_d, "Quantity
lifnr type lifnr, "Vendor Number
name1 type name1_gp, "Name1
name2 type name2_gp, "Name2
telf1 type telf1, "Telephone number
trnam type ztrnam, "Transporter name
glano type zglano, "GR/LR/AWB No
J_1ICSTNO type J_1ICSTNO, "Central Sales Tax Number
J_1ILSTNO type J_1ILSTNO, "Local Sales Tax Number
J_1IEXRN type J_1IEXRN , "Excise Registration Number
end of typ_mseg.
data: it_mseg type standard table of typ_mseg initial size 0,
it_mseg1 type standard table of typ_mseg initial size 0,
it_mseg2 type standard table of typ_mseg initial size 0,
it_mseg3 type standard table of typ_mseg initial size 0,
wa_mseg like line of it_mseg.
select amblnr amatnr
amenge alifnr
b~budat
into table it_mseg
from mseg as a
join mkpf as b
on amblnr = bmblnr
where werks = p_werks and
budat = s_budat.
if it_mseg[] is not initial.
select lifnr name1 name2 telf1
into table it_mseg1
from lfa1
for all entries in it_mseg
where lifnr = it_mseg-lifnr.
ENDIF.
if it_mseg1[] is not initial.
select trnam glano lifnr
into table it_mseg2
from zmigo_addition
for all entries in it_mseg1
where lifnr = it_mseg1-lifnr.
endif.
if it_mseg2[] is not initial.
select maktx from makt into
table it_mseg3
for all entries in it_mseg2
where<b>( matnr = it_mseg-matnr)</b>
endif.
‎2006 Jul 19 8:26 AM
Hi Amit,
You are useing :
select amblnr amatnr
amenge alifnr
b~budat
into table it_mseg
from mseg as a
join mkpf as b
on amblnr = bmblnr
where werks = p_werks and
budat = s_budat.
if you use
select amblnr amatnr
amenge alifnr
b~budat
into table it_mseg
from mseg as a
join mkpf as b
on amblnr = bmblnr
where werks in p_werks and
budat in s_budat.
and
select maktx from makt into
table it_mseg3
for all entries in it_mseg2
where( matnr in it_mseg-matnr)
endif.
Please try IN in all select it's beauty of it is that it take all the conditions as equal, single, between etc. use it in all of your select IN as I show above.
Regards.
Ankur Garg.
Message was edited by: Ankur Garg
‎2006 Jul 19 8:23 AM
if it_mseg2[] is not initial.
select maktx from makt into
table it_mseg3
for all entries in <b>it_mseg</b>
<b>where matnr = it_mseg-matnr</b>
endif.
‎2006 Jul 19 8:26 AM
Hi Amit,
You are useing :
select amblnr amatnr
amenge alifnr
b~budat
into table it_mseg
from mseg as a
join mkpf as b
on amblnr = bmblnr
where werks = p_werks and
budat = s_budat.
if you use
select amblnr amatnr
amenge alifnr
b~budat
into table it_mseg
from mseg as a
join mkpf as b
on amblnr = bmblnr
where werks in p_werks and
budat in s_budat.
and
select maktx from makt into
table it_mseg3
for all entries in it_mseg2
where( matnr in it_mseg-matnr)
endif.
Please try IN in all select it's beauty of it is that it take all the conditions as equal, single, between etc. use it in all of your select IN as I show above.
Regards.
Ankur Garg.
Message was edited by: Ankur Garg
‎2006 Jul 19 8:27 AM
Hi Amit,
The where clause has to be changed.
Cant give one table in FOR ALL ENTRIES and compare the other.
IF it_mseg2[] IS NOT INITIAL.
SELECT maktx FROM makt INTO
TABLE it_mseg3
FOR ALL ENTRIES IN <b>it_mseg2</b>
where( <b>matnr = it_mseg2-matnr</b>).
ENDIF.
Your Where Cond <b>matnr = it_mseg-matnr</b> will comapre matnr field with data in <b>it_mseg header line</b>
Regards,
Arun S.
‎2006 Jul 19 10:14 AM
hi ,
you are checking For all entries in it_mseg2 but comparing Matnr with it_mseg-matnr... so compare with <b>it_mseg2-matnr</b>
if it_mseg2[] is not initial.
select maktx
from makt
into table it_mseg3
for all entries in <b>it_mseg2</b>
where( matnr = <b>it_mseg2</b>-matnr)
endif.