‎2005 Sep 05 11:17 AM
I have create dynamic internal table using method cl_alv_table_create=>create_dynamic_table.
Now when I do a read on this table specificing the WITH KEY CLAUSES... I get error messsage 'The specified type has no structure and therefore no component called "MATNR"' . The read stattement is as follows..
READ TABLE <fs_ztable> INTO <fsl_row>
WITH KEY matnr = wa_mch1-matnr
charg = wa_mch1-charg .
I known that while the time of activing system doesn't know the structure of internal table therefore I am getting this message .
But is there any way so that I can read from this internal table specifying some creteria..
‎2005 Sep 05 11:32 AM
You can do the following.
data: temp_var(30).
temp_var = 'MATNR' .
READ TABLE <fs_ztable> INTO <fsl_row>
WITH KEY (temp_var) = wa_mch1-matnr
charg = wa_mch1-charg .
Regards
Raja
‎2005 Sep 05 11:31 AM
I don't think, I believe you loop all table and check records in your loop.
LOOP AT <fs_ztable> ASSIGNING TO <fsl_row>.
ASSIGN COMPONENT 'MATNR' OF STRUCUTURE <fsl_row>
TO <MAYNR>.
ASSIGN COMPONENT 'CHARG' OF STRUCUTURE <fsl_row>
TO <MAYNR>.
IF <MAYNR> = ... AND <MAYNR> = ...
EXIT.
ENDIF.
ENDLOOP.
‎2005 Sep 05 11:32 AM
You can do the following.
data: temp_var(30).
temp_var = 'MATNR' .
READ TABLE <fs_ztable> INTO <fsl_row>
WITH KEY (temp_var) = wa_mch1-matnr
charg = wa_mch1-charg .
Regards
Raja
‎2005 Sep 05 11:49 AM
I've just forgotten this option, i think Raja solution is right.