‎2009 Jan 29 6:30 AM
Hi,
This is my code
read table ALL_NVALS_TAB with KEY VAL = nvals_tab-val ID <> nvals_tab-id.
if sy-subrc = 0.
message i005 with node_val.
exit.
endif.
This is giving a syntax error on " = expected after ID"
on replacing the code with =
read table ALL_NVALS_TAB with KEY VAL = nvals_tab-val ID = nvals_tab-id.
if sy-subrc = 0.
message i005 with node_val.
exit.
endif.
this is giving no error and can be activated.But it is not solving my purpose . Can only ' = ' is used as a operator on read table with key.
Is there any other way in which I can do it ( preferable with READ statement)
‎2009 Jan 29 6:32 AM
Hi,
I think that you missed the equal to sign after the ID field....
read table ALL_NVALS_TAB
with KEY VAL = nvals_tab-val
ID = nvals_tab-id.
if sy-subrc = 0.
message i005 with node_val.
exit.
endif.
Regards.
‎2009 Jan 29 6:34 AM
Hi,
With read you can use only Equalto '=' operator. If you want to use other operators the use
Loop AT <itab> Where <Condt>.
ENDLOOP>
‎2009 Jan 29 6:35 AM
Hi,
There is nothing wrong in your coding using =.
Whats is your exact problem ?
‎2009 Jan 29 6:35 AM
You have missed the ' = ' sign.
try this
read table ALL_NVALS_TAB with KEY VAL = nvals_tab-val
ID = nvals_tab-id.
‎2009 Jan 29 6:37 AM
Hello Priya,
read table ALL_NVALS_TAB with KEY VAL = nvals_tab-val ID = nvals_tab-id.
if sy-subrc = 0.
message i005 with node_val.
exit.
endif.
this is giving no error and can be activated.But it is not solving my purpose . Can only ' = ' is used as a operator on read table with key.
READ TABLE is used to get a single, unique record from the internal table so '=' is the only operator allowed.
Debug your code and check if the table ALL_NVALS_TAB has entries with VAL = nvals_tab-val & ID = nvals_tab-id. If not then the sy-subrc <> 0.
Plz revert back with your observations.
BR,
Suhas
‎2009 Jan 29 6:46 AM
Hi
Check out the syntax at[ Read|http://help.sap.com/abapdocu/en/ABAPREAD_TABLE.htm]
Also there is an [example|http://help.sap.com/abapdocu/en/ABENREAD_ITAB_USING_KEY_ABEXA.htm] you can check out.
Hope this helps
Regards,
Jayanthi.K
‎2009 Jan 29 7:06 AM
Hi,
I think you have missed '=' operator after ID
read table ALL_NVALS_TAB with KEY VAL = nvals_tab-val
ID = nvals_tab-id.
if sy-subrc = 0.
message i005 with node_val.
exit.
endif.
Now it will work fine.
With Read table we can use only '=' operator . if you want to use other than '=' operator then use
Loop at ALL_NVALS_TAB where 'you can use the operator u want'