08-21-2007 3:29 PM
Hi Gurus,
I have a condition :
I need to go to knvh and collect planning group from knvh-kunnr where knvh-hityp = "D" and knvh-hkunnr = cid, after that go to knvh and collect sold to party from knvh-kunnr where knvh-hityp = "D" and knvh-hkunnr = planning group
so far I have written this thing
select kunnr into table it_knvh
from knvh
for all entries in it_header
where hkunnr = it_header-cid
and hityp = 'D'.
Can you please twll me what should be the further process to accomplish the desired result.
Thanks
Rajeev Gupta
08-22-2007 1:51 PM
Hi Rajeev,
the code below will solve your problem,
data: begin of it_knvh_temp occurs 0,
kunnr like knvh-kunnr,
hkunnr like knvh-hkunnr,
end of it_knvh_temp.
data: begin of it_knvh occurs 0,
kunnr like knvh-kunnr,
hkunnr like knvh-hkunnr,
end of it_knvh.
select kunnr
hkunnr
from knvh
into table it_knvh_temp
where hityp = 'D'
and hkunnr = 'cid'.
if sy-subrc <> 0.
throw error message
endif.
if it_knvh_temp[] is not initial.
select kunnr
from knvh
into table it_knvh
for all entries in it_knvh_temp
where hityp = 'D'
and hkunnr = it_knvh_temp-hkunnr.
if sy-subrc <> 0.
throw error message
endif.
Endif.
Thanks,
Samantak.
<b>Rewards points for useful answers.</b>
08-22-2007 3:36 PM
First u will get the details with the condition where knvh-hityp = "D" and knvh-hkunnr = cid..Store this in internal table..
Then u can use the for all entries concept and combine a database table with a internal table...with the second condtion
REWARD IF USEFUL