REPORT ZTEST01.TYPES: BEGIN OF STR_MAT, WERKS TYPE WERKS_D, MATNR TYPE MATNR, MAKTX TYPE MAKTX, END OF STR_MAT.data: com_tab type cl_abap_structdescr=>component_table, com like line of com_tab, lo_tab type ref to cl_abap_tabledescr, lo_str type ref to cl_abap_structdescr, lo_data type ref to data.FIELD-SYMBOLS:<FS_WA> TYPE ANY, "which is used to be as working area <FS_TABLE> TYPE any table. "which is used to be as an internal tablelo_str ?= cl_abap_structdescr=>describe_by_name( 'str_mat' ). "get structure description via 'describe_by_name'com_tab = lo_str->get_components( ). " call this method to get the component listlo_str = cl_abap_structdescr=>create( com_tab ). "create the structure object via component table as importing parameterlo_tab = cl_abap_tabledescr=>create( lo_str ). "crate the table object via structure objectcreate data lo_data type handle lo_str. "generic type data referenceassign lo_data->* to <fs_wa> casting type handle lo_str.
create data lo_data type handle lo_tab.assign lo_data->* to <fs_table> casting type handle lo_tab.SELECT MARC~WERKS MARC~MATNR MAKT~MAKTX up to 10 rows INTO table <FS_TABLE> FROM MARC INNER JOIN MAKT ON MARC~MATNR = MAKT~MATNR WHERE MAKT~SPRAS = 'E'. loop at <fs_table> assigning <fs_wa>. write:/ <fs_wa>. endloop.
*-----------------------------------------------------------------------------------------*
Below is the output list.
1000000000000000000011SS HALB1000000000000000000017test - generic material1200000000000000000020Repair by subash DE