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

Dynamic Internal table

Former Member
0 Likes
487

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..

1 ACCEPTED SOLUTION
Read only

athavanraja
Active Contributor
0 Likes
459

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

3 REPLIES 3
Read only

Former Member
0 Likes
459

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.

Read only

athavanraja
Active Contributor
0 Likes
460

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

Read only

0 Likes
459

I've just forgotten this option, i think Raja solution is right.