Let us say I have the following code:
iob_typedescr ?= cl_abap_typedescr=>describe_by_name( 'HOUSES' ).
iob_structdescr_table ?= iob_typedescr.
it_ddic_all = iob_structdescr_table->get_ddic_field_list( ).
LOOP AT it_ddic_all INTO is_ddic WHERE keyflag EQ 'X'.
APPEND is_ddic TO it_keyfields.
ENDLOOP.
So basically, in the above code I know all of the key fields in the table HOUSES and they are in the table it_keyfields. Now if I had an internal table which had the same structure as HOUSES and wanted to select data from it how would I be able to do this dynamically? If I knew I had only one key then I could do a READ TABLE as follows:
READ TABLE it_internal_table WITH KEY (key_name) = provided_value TRANSPORTING NO FIELDS.
But in this case I may have more than one key in it_keyfields so I am not sure how I could write the READ TABLE statement for this.
WITH KEY { comp1 = operand1 comp2 = operand2 ... [BINARY SEARCH] }with comp1/comp2 being{ comp_name[-sub_comp][{+off(len)}|{->attr}] } | { (name) }.