Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Check a value in a table...

Former Member
0 Likes
752

Hi

I have this code

IF l_return IS INITIAL.

READ TABLE lt_sval INDEX 1.

IF lt_sval-value IS INITIAL.

CONTINUE.

ELSE.

it_dados-zzpernr = lt_sval-value.

*(RPimenta-14.11.2008 - Validação de executantes por direcão técnica)

READ TABLE zsd_exec_valido WITH KEY zzpernr =

it_dados-zzpernr.

IF sy-subrc <> 0.

MODIFY it_dados TRANSPORTING zzpernr WHERE selec EQ 'X'.

ELSE.

MESSAGE ID 'ZSD' TYPE 'E' NUMBER '075'

WITH lt_sval-value lgnum.

ENDIF.

*<-

ENDIF.

And i need check if the value in it_dados-zzpernr appears in table zsd_exec_valido .

At verify i have this error:

Programa ZRPWM_CONF_OTS

Field "ZZPERNR" is unknown. It is neither in one of the specified

tables nor defined by a "DATA" statement . . . . . . . . . .

The table zsd_exec_valido isn't an internal table, could this be the problem ?

How can I solve this problem ?

Thanks

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
712

use select single instead of read table.

Select single from zsd_exec_valido where zzpernr =

it_dados-zzpernr.

3 REPLIES 3
Read only

Former Member
0 Likes
712

if its not an internal table, how can you read it usign Read Table command?

Read only

Former Member
0 Likes
713

use select single instead of read table.

Select single from zsd_exec_valido where zzpernr =

it_dados-zzpernr.

Read only

DirkAltmann
Active Participant
0 Likes
712

Hello Ricardo,

you worte zsd_exec_valido isn't an internal table, than you can't read a database table with this code line:

READ TABLE zsd_exec_valido WITH KEY zzpernr =

it_dados-zzpernr.

From database you must read with OpenSQL:

Select *

from zsd_exec_valido

into [structure]

where zzpernr = it_dados-zzpernr.

This is very dirty, because you should only select the field you realy need from databae. but this should only a hint for you. I'm not sure but from the naming it_dados could be a internal table. If this so, you must check if the internal table has a header line. in other case you must read the tableline in an workarea before using a field for the select statement.

Regards

Dirk