2006 Sep 11 10:05 AM
Hi all,
I have the following problem : I have a method which takes a deep structure as input parameter. Each field of this structure is a table which has field 'Key' as key field. In the method, I assign each table to a field symbol, for which I find out the type dynamically. When I try to read the data in the tables using read statement and giving field 'Key' in the read instruction, I get a syntax error telling me that no field with name 'Key' exists in the table(since its type is dynamically determined). As far as I know, it is not possible to write dynamic statements in for read table TAB with key (key_field_name) = '123'. Does someone have any idea how this problem can be solved?
Kind Regards,
Sükrü
2006 Sep 11 10:16 AM
Hi
Yes it can: see help fpr statament READ.
You can write:
READ TABLE ITAB WITH KEY (KEY1) = <V1>
(KEY2) = <V2>
(KEY3) ....
Max
Hi all,
I have the following problem : I have a method which takes a deep structure as input parameter. Each field of this structure is a table which has field 'Key' as key field. In the method, I assign each table to a field symbol, for which I find out the type dynamically. When I try to read the data in the tables using read statement and giving field 'Key' in the read instruction, I get a syntax error telling me that no field with name 'Key' exists in the table(since its type is dynamically determined). As far as I know, it is not possible to write dynamic statements in for read table TAB with key (key_field_name) = '123'. Does someone have any idea how this problem can be solved?
Kind Regards,
Sükrü
2006 Sep 11 10:12 AM
hi,
try this.
eg;
READ TABLE ITAB
WITH TABLE KEY key = '123'.
all the best.
anver
2006 Sep 11 10:16 AM
Hi
Yes it can: see help fpr statament READ.
You can write:
READ TABLE ITAB WITH KEY (KEY1) = <V1>
(KEY2) = <V2>
(KEY3) ....
Max
2006 Sep 11 10:17 AM
Hi Suekrue,
Try this..
'CATSXT_GET_DDIC_FIELDINFO' function module for getting field names of a structure.
pass ur table name get the fields and pass the fields to the read statement.
-Anu.
2006 Sep 11 10:17 AM
you can do that.
check this code sample.
data: itab type flighttab .
data: itab_wa type sflight .
data: fnam(40) .
fnam = 'CARRID' .
select * from sflight into table itab .
read table itab into itab_wa with key (fnam) = 'PP' .
Regards
Raja
2006 Sep 11 10:18 AM
Hi Anver,
Sorry, my question is not about the syntax of the read statement. It is about reading from an internal table of which type is known at runtime. We only know that there is a field named 'Key' which is key in all tables.
Regards,
Sükrü
2006 Sep 11 10:22 AM
Thanks Max and Raja. It solved the problem. I have overseen this feature of the read statement.
Kind Regards,
Sükrü
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |