2009 Feb 25 1:00 AM
Hi,
I m trying to write a program which can log data from any table into a Trace Z table.
I have used
FIELD-SYMBOLS: <line>.
to get the line of that table. But now I want to dynamically know what are the field names of this line structure and the data in it. And then write it as a string to the trace Z table
form log_table_data tables rt_any_table
using rv_statement type string.
data: v_line type string,
v_char_line type char255.
FIELD-SYMBOLS: <line>.
loop at rt_table ASSIGNING <LINE>.
v_char_line = <LINE>. - Terminating at this statement
ASSIGN <LINE> to v_line casting type string.
endloop.
endform.
Thanks for reading
2009 Feb 25 1:41 AM
Hi,
if you are interested in generic programming in ABAP then this [presentation|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae] is full of information. There is a class CL_ABAP_STRUCTDESCR with method GET_COMPONENTS. This method returns a list of components of table or structure. So you will be able to loop over every field in the table and convert each field into string.
Cheers
Hi,
I m trying to write a program which can log data from any table into a Trace Z table.
I have used
FIELD-SYMBOLS: <line>.
to get the line of that table. But now I want to dynamically know what are the field names of this line structure and the data in it. And then write it as a string to the trace Z table
form log_table_data tables rt_any_table
using rv_statement type string.
data: v_line type string,
v_char_line type char255.
FIELD-SYMBOLS: <line>.
loop at rt_table ASSIGNING <LINE>.
v_char_line = <LINE>. - Terminating at this statement
ASSIGN <LINE> to v_line casting type string.
endloop.
endform.
Thanks for reading
2009 Feb 25 1:41 AM
Hi,
if you are interested in generic programming in ABAP then this [presentation|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/b332e090-0201-0010-bdbd-b735e96fe0ae] is full of information. There is a class CL_ABAP_STRUCTDESCR with method GET_COMPONENTS. This method returns a list of components of table or structure. So you will be able to loop over every field in the table and convert each field into string.
Cheers
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |