‎2006 Jun 01 8:18 AM
Hi All,
i trying to read data from table with multiple condition but it is giving me error,
my code is :
loop at struct.
ind = sy-tabix.
read table itabMAST with key matnr = struct-matnr and WERKS = company and stlan = '5'.
if sy-subrc = 0.
move itabMAST-stlnr to struct-stlnr.
endif.
modify struct index ind transporting stlnr.
endloop.
and error message is giving is
Unable to interpret "WERKS". Possible causes: incorrect Spelling or Comma error.
Pls Help...
Thanks in Advance,
Yunus
‎2006 Jun 01 8:22 AM
Hi Yunus,
You can not use logical conditions in the READ statement.
Remove the AND conditions from the READ statement and it will work. READ statement by default takes the condition as AND.
<b>Reward points if it helps.</b>
Regards,
Amit Mishra
Message was edited by: Amit Mishra
‎2006 Jun 01 8:22 AM
Hi Yunus,
You can not use logical conditions in the READ statement.
Remove the AND conditions from the READ statement and it will work. READ statement by default takes the condition as AND.
<b>Reward points if it helps.</b>
Regards,
Amit Mishra
Message was edited by: Amit Mishra
‎2006 Jun 01 8:29 AM
hi,
try:
read table itabMAST with key matnr = struct-matnr
WERKS = company
stlan = '5'.Andreas
‎2006 Jun 01 8:22 AM
Hi,
Your problem is the field WERKS is not available in the internal table itabMAST.
Try to bring in the werks in the internal table itabMAST and then use the READ statement.
Also while using read statement there will not be any key word AND used.
Lakshminarayanan.
Please mark helpful answers for points.
‎2006 Jun 01 8:26 AM
but instead od and what can i use...bcoz i want to read table with multiple condition..
regards,
yunus
‎2006 Jun 01 8:28 AM
Hi,
1. Chek your itabMAST table, is there WERKS fields ??
2. Remove "AND" statement from your "Read Table" statement.
Regards,
‎2006 Jun 01 8:33 AM
Hi, here is another example:
IF sy-subrc <> 0.
MOVE it_equz-hequi TO it_equz_dum2-hequi.
READ TABLE it_equz_dum1 WITH KEY equnr = it_equz-equnr
hequi = it_equz-hequi
BINARY SEARCH.
IF sy-subrc = 0.
SELECT SINGLE anlnr
shtxt
FROM itob
INTO (it_itob-anlnr, it_itob-shtxt)
WHERE equnr EQ it_equz_dum1-hequi.
IF sy-subrc = 0.
MOVE it_itob-anlnr TO it_finaltab-asset_dum.
MOVE it_itob-anlnr TO it_finaltab-asset.
MOVE it_itob-shtxt TO it_finaltab-description.
endif.
endif.
endif.
‎2006 Jun 01 8:34 AM
Hi Yunus,
Please have a look at the following programs in SE38.
DEMO_INT_TABLES_READ_ASSIGNING
DEMO_INT_TABLES_READ_COMPARING
DEMO_INT_TABLES_READ_INDEX
DEMO_INT_TABLES_READ_INDEX_BIN
DEMO_INT_TABLES_READ_TRANSPORT
DEMO_INT_TABLES_READ_TRANSP_NO
<b>Reward points if it helps.</b>
Regards,
Amit Mishra
‎2006 Jun 01 8:35 AM
Hi,
First of all i am not sure why you are using the statement <b>ind = sy-tabix</b>.
Your code should look like this:
loop at struct.
ind = sy-tabix.
read table itabMAST with key matnr = struct-matnr
WERKS = company
stlan = '5'.
if sy-subrc = 0.
move itabMAST-stlnr to struct-stlnr.
modify struct index ind transporting stlnr.
endif.
endloop.
Lakshminarayanan