‎2006 Jan 25 8:57 PM
Hi friends...
here is a problem....this is in an interface... i'll download the data from SAP to a flat file...
i have the code like this...it is not working properly..
data: begin of i_md occurs 0,
matnr like mara-matnr,
component like stpo-idnrk,
mguide like stpo-idnrk,
...................
end of i_md.
data: begin of i_md2 occurs 0,
idnrk like stpo-idnrk,
end of i_md2.
data: str1(2) type c value 'O',
str1(2) type c value 'OP',
str1(2) type c value 'M',
str1(2) type c value 'MP'.
.......................................
....................................
perform get_component.
................................
..............................
form get_component.
if not i_md[] is initial.
select d~idnrk into i_md2-idnrk
from stpo as d
inner join stko as c
on dstlnr = cstlnr
inner join mast as b
on cstlnr = bstlnr
inner join mara as a
on bmatnr = amatnr
for all entries IN i_md
where a~matnr = i_mdata-matnr
and ( a~matkl = 'OST' or
a~matkl = 'OSP' )
and ( a~mtart = 'FERT' or
a~mtart = 'HAWA' )
and c~stktx = 'UNRESTRICTED'.
endselect.
endif.
if ( i_md2-idnrk cs str1 ) or ( i_md2-idnrk cs str2 ).
write i_md2-idnrk to i_md-component
no-zero left-justified.
elseif ( i_md2-idnrk cs str3 ) or ( i_md2 cs str4 ).
write i_md2-idnrk to i_md-mguide
no-zero left-justified.
endif.
endform. "get_component
...................................
......................................
transfer i_md to file1.
........................
.....................
my question is: when i debug the program for the form <b>"get_component"</b>, i could able to see the material numbers, but there is nothing coming up for the fields :
i_md-component and i_md-mguide.
could you plz tell me wt is the problem.?
thanks,
‎2006 Jan 25 9:05 PM
‎2006 Jan 25 9:42 PM
rich,
i want to get multiple values .....the thing is i have to use the material number of the I_MD internal table only for retrieving the components.
plz let me know if anything's not clear...
thnx
‎2006 Jan 25 9:48 PM
Hi,
Try this.
select stpo~idnrk
into table i_md2
from stpo
inner join stko
on stpostlnr = stkostlnr
*inner join mast
*on stpostlnr = maststlnr
inner join mara
on stpoidnrk = maramatnr
for all entries IN i_md
where mara~matnr = i_md-matnr
and mara~matkl in ('OST', 'OSP')
and mara~mtart in ('FERT', 'HAWA')
and stko~stktx = 'UNRESTRICTED'.
‎2006 Jan 25 9:56 PM
Hi Sey,
The select atatement attached by me (earlier) is working fine for me. It is populating multiple entries in I_MD2 table.
Please make sure that the <u>materials</u> in internal table I_MD <u>contains BOM</u>. Means Entries in STKO and STPO.
select d~idnrk
into table i_md2
from stpo as d
inner join stko as c
on dstlnr = cstlnr
inner join mast as b
on cstlnr = bstlnr
inner join mara as a
on bmatnr = amatnr
for all entries IN i_md
where a~matnr = i_md-matnr
and ( a~matkl = 'OST' or
a~matkl = 'OSP' )
and ( a~mtart = 'FERT' or
a~mtart = 'HAWA' )
and c~stktx = 'UNRESTRICTED'.
Lanka
‎2006 Jan 25 10:05 PM
hi phani,
its still coming like that only...
is the select statement wrong?
‎2006 Jan 25 11:33 PM
Hi Sey,
The select atatement attached by me (earlier) is working fine for me. It is populating multiple entries in I_MD2 table.
Please make sure that the materials in internal table I_MD contains BOM. Means Entries in STKO and STPO.
select d~idnrk
into table i_md2
from stpo as d
inner join stko as c
on dstlnr = cstlnr
inner join mast as b
on cstlnr = bstlnr
inner join mara as a
on bmatnr = amatnr
for all entries IN i_md
where a~matnr = i_md-matnr
and ( a~matkl = 'OST' or
a~matkl = 'OSP' )
and ( a~mtart = 'FERT' or
a~mtart = 'HAWA' )
and c~stktx = 'UNRESTRICTED'.
Lanka
‎2006 Jan 25 9:06 PM
Hi,
When you are using for all entries for table i_md
then your where condition should have that table field..
change as
<b>for all entries IN i_md
where a~matnr = i_md-matnr</b>
OR change your select as..
select stpo~idnrk
into i_md2-idnrk
from stpo
inner join stko
on stpostlnr = stkostlnr
inner join mast
on stkostlnr = maststlnr
inner join mara
on mastmatnr = maramatnr
for all entries IN i_md
where mara~matnr = i_md-matnr
and mara~matkl in ('OST', 'OSP')
and mara~mtart in ('FERT', 'HAWA')
and stko~stktx = 'UNRESTRICTED'.
endselect.
Message was edited by: Phani Kiran Nudurupati
‎2006 Jan 25 9:18 PM
Hi Phani..
thnx...
actually it is <b>"for all entries IN i_md
where a!matnr = i_md-matnr"</b>...
sorry i have written wrongly in the mail...
plz tell me...even if it is like that also..it is not coming....
thnx
‎2006 Jan 25 9:27 PM
Hi,
Change the select like below...
select stpo~idnrk
into i_md2-idnrk
from stpo
inner join stko
on stpostlnr = stkostlnr
inner join mast
on stpostlnr = maststlnr
inner join mara
on stpoidnrk = maramatnr
for all entries IN i_md
where mara~matnr = i_md-matnr
and mara~matkl in ('OST', 'OSP')
and mara~mtart in ('FERT', 'HAWA')
and stko~stktx = 'UNRESTRICTED'.
endselect.
‎2006 Jan 25 9:33 PM
Hi Sey,
As Rich mentioned What you need a single record or all records.
Try this :
select d~idnrk
into table i_md2
from stpo as d
inner join stko as c
on dstlnr = cstlnr
inner join mast as b
on cstlnr = bstlnr
inner join mara as a
on bmatnr = amatnr
for all entries IN i_md
where a~matnr = i_md-matnr
and ( a~matkl = 'OST' or
a~matkl = 'OSP' )
and ( a~mtart = 'FERT' or
a~mtart = 'HAWA' )
and c~stktx = 'UNRESTRICTED'.
The above code fill internal table i_md2.
Lanka
‎2006 Jan 25 9:40 PM
Hi,
still it is not showing up anything for those 2 fields...
plz tell me is ther anything other wrong?
Rich,
I have to get multiple values....
thnx