05-07-2015 12:52 PM
Hello,
in German we say: "I am on the hose!"
I need your help.
In the CoQC Templates are different count of characteristics.
For Example - CoQC Profile for material XYZ has 10 characteristics and the profile for material ABC has 5 characteristics.
I want to read the characteristics, but not line by line, but by columns.
For example:
In ABAP I have define an structure:
Then each column for the characteristic needs to be added to this structure exactly.
For Example:
I've read that there are field symbols, but I do not understand how you then inserts these fields to the structure.
My definition:
<f> has the correct value. How do I get this value to the structure OUTPUT_CHAR?
Can anyone help me?
I hope you can understand me and my problem. ..
Best Regards,
Ulrike
05-07-2015 1:06 PM
05-07-2015 1:06 PM
05-07-2015 2:07 PM
Hey Ulrike,
see the code below:
REPORT ZTEST.
DATA: go_struct TYPE REF TO cl_abap_structdescr,
go_table TYPE REF TO cl_abap_tabledescr,
gd_dyn TYPE REF TO data,
gt_comp TYPE cl_abap_structdescr=>component_table,
gs_comp TYPE cl_abap_structdescr=>component.
FIELD-SYMBOLS: <gs_dyn> TYPE ANY,
<gt_dyn> TYPE STANDARD TABLE.
* Character field
gs_comp-name = 'F1'.
gs_comp-type = cl_abap_elemdescr=>get_c( 10 ).
APPEND gs_comp TO gt_comp. CLEAR gs_comp.
* Packed field
gs_comp-name = 'F2'.
gs_comp-type = cl_abap_elemdescr=>get_p( p_length = 10 p_decimals = 2 ).
APPEND gs_comp TO gt_comp. CLEAR gs_comp.
* String field
gs_comp-name = 'F3'.
gs_comp-type = cl_abap_elemdescr=>get_string( ).
APPEND gs_comp TO gt_comp. CLEAR gs_comp.
TRY.
* Create the dynamic structure
go_struct = cl_abap_structdescr=>create( gt_comp ).
CREATE DATA gd_dyn TYPE HANDLE go_struct. "Create dyn. data ref.
ASSIGN gd_dyn->* TO <gs_dyn>. "Dereference the data ref.
CLEAR gd_dyn.
* Create the dyn. table
go_table = cl_abap_tabledescr=>create( go_struct ).
CREATE DATA gd_dyn TYPE HANDLE go_table. "Create dyn. data ref.
ASSIGN gd_dyn->* TO <gt_dyn>. "Dereference the data ref.
CATCH cx_sy_struct_creation .
CATCH cx_sy_table_creation .
ENDTRY.
BREAK-POINT.
05-12-2015 9:39 AM