on 11-21-2007 1:22 PM
Hi All,
i need to retrive the data from a table. intially i am retriving the data select query with the following selection screen feilds.
Select KEKO~KLVAR
KEKO~MATNR
KEKO~WERKS
KEKO~TVERS
KEKO~KADAT
KEKO~STLAN
MARA~MTART
from KEKO inner join MARA on
KEKO-MATNR eq MARA-MATNR
INTO CORRESPONDING FIELDS OF TABLE IT_DATA
where KEKO~KLVAR eq P_KLVAR
KEKO~MATNR in S_MATNR
KEKO~WERKS in S_WERKS
KEKO~TVERS eq P_TVERS
KEKO~KADAT in S_KADAT
KEKO~STLAN eq P_STLAN
MARA~MTART in S_MTART.
Now i need to write the forall entries with another custom table ZABC.
the ZABC table structure is:
PLANT
PERIO
GJAHR
MATNR
TYPPS
KOSTL
LSTAR
MENGE
KSTAR
LPREIS
LPEINH
in this the key feild are plant(werks), Material (Matnr) and fiscal year (GJAHR). But i am unable to write the select query.
if not IT_DATA[] is initial.
select PLANT
PERIO
GJAHR
MATNR
TYPPS
KOSTL
LSTAR
MENGE
KSTAR
LPREIS
LPEINH from table ZABC for all entries in table IT_DATA
where matnr eq IT_DATA-matnr and
werks eq IT_DATA-werks and
<b> gjahr eq ?????.</b>
endif.
so finally i have problem with fiscal year.. so please help me in this to go ahead..
i will reward you if i got a clue from you people.
regards
raghu
Hi
write the select for Z table without GJAHR in where condition
and after that validate this GJAHR with the date field year and delete the data from Itab.
if not IT_DATA[] is initial.
select PLANT
PERIO
GJAHR
MATNR
TYPPS
KOSTL
LSTAR
MENGE
KSTAR
LPREIS
LPEINH from table ZABC into table ITAB
for all entries in table IT_DATA
where matnr eq IT_DATA-matnr and
werks eq IT_DATA-werks
endif.
loop at itab.
l_tabix = sy-tabix.
read table it_data with key matnr = itab-matnr werks = itab-werks.
<b> if sy-subrc = 0.
if itab-gjahr <> it_data-kadat+0(4).
delete itab index l_tabix.</b>
endif.
endif.
endloop.
Regards
anji
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
108 | |
12 | |
11 | |
6 | |
5 | |
4 | |
3 | |
3 | |
3 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.