2018 Sep 19 1:48 PM
my issue is that i can find no documentation or indeed anything to help with this.
is it even possible and if so how?
attached an example creation of the dynamic table structure
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style: italic;
color: #808080;
}
.L0S32 {
color: #3399FF;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
.L0S70 {
color: #808080;
}
PARAMETERS: nodeamo TYPE i, nodconex type i.
data index TYPE i value 0.
"rtts setup data.
DATA: r_type_struct TYPE REF TO cl_abap_structdescr,
r_type_table TYPE REF TO cl_abap_tabledescr,
r_data_tab TYPE REF TO data,
r_data_str TYPE REF TO data.
data gt_comp type abap_component_tab.
data gs_comp like LINE OF gt_comp.
data gt_sources like gt_comp.
"set static colomns (always present)
gs_comp-name = 'NODE_ID'. "NEED TO BE CAPS
gs_comp-type ?= cl_abap_elemdescr=>get_i( ).
APPEND gs_comp TO gt_comp.
gs_comp-name = 'PROC_COST'.
gs_comp-type ?= cl_abap_elemdescr=>get_i( ).
APPEND gs_comp TO gt_comp.
gs_comp-name = 'LOC_X'.
gs_comp-type ?= cl_abap_elemdescr=>get_f( ).
APPEND gs_comp TO gt_comp.
gs_comp-name = 'LOC_Y'.
gs_comp-type ?= cl_abap_elemdescr=>get_f( ).
APPEND gs_comp TO gt_comp.
"/set static columns
"set dynamic columns
do nodconex times.
index = index + 1.
gs_comp-name = 'SRC_' && index .
gs_comp-type ?= cl_abap_elemdescr=>get_i( ). "same as node_id
APPEND gs_comp TO gt_comp.
APPEND GS_COMP TO GT_SOURCES.
enddo.
"/set dynamic columns
try . "create structure from static and dynamic fields
r_type_struct = cl_abap_structdescr=>create( p_components = gt_comp ).
CATCH cx_sy_struct_creation.
ENDTRY. "/create structure from static and dynamic fields
TRY. "create table from structure
r_type_table = cl_abap_tabledescr=>create( r_type_struct ).
CATCH cx_sy_table_creation .
ENDTRY. "/create table from structure
"create data based on static/dynamic hybrid type creation.
CREATE DATA: r_data_tab TYPE HANDLE r_type_table,
r_data_str TYPE HANDLE r_type_struct.
my issue is that i can find no documentation or indeed anything to help with this.
is it even possible and if so how?
attached an example creation of the dynamic table structure
SPAN {
font-family: "Courier New";
font-size: 10pt;
color: #000000;
background: #FFFFFF;
}
.L0S31 {
font-style: italic;
color: #808080;
}
.L0S32 {
color: #3399FF;
}
.L0S33 {
color: #4DA619;
}
.L0S52 {
color: #0000FF;
}
.L0S55 {
color: #800080;
}
.L0S70 {
color: #808080;
}
PARAMETERS: nodeamo TYPE i, nodconex type i.
data index TYPE i value 0.
"rtts setup data.
DATA: r_type_struct TYPE REF TO cl_abap_structdescr,
r_type_table TYPE REF TO cl_abap_tabledescr,
r_data_tab TYPE REF TO data,
r_data_str TYPE REF TO data.
data gt_comp type abap_component_tab.
data gs_comp like LINE OF gt_comp.
data gt_sources like gt_comp.
"set static colomns (always present)
gs_comp-name = 'NODE_ID'. "NEED TO BE CAPS
gs_comp-type ?= cl_abap_elemdescr=>get_i( ).
APPEND gs_comp TO gt_comp.
gs_comp-name = 'PROC_COST'.
gs_comp-type ?= cl_abap_elemdescr=>get_i( ).
APPEND gs_comp TO gt_comp.
gs_comp-name = 'LOC_X'.
gs_comp-type ?= cl_abap_elemdescr=>get_f( ).
APPEND gs_comp TO gt_comp.
gs_comp-name = 'LOC_Y'.
gs_comp-type ?= cl_abap_elemdescr=>get_f( ).
APPEND gs_comp TO gt_comp.
"/set static columns
"set dynamic columns
do nodconex times.
index = index + 1.
gs_comp-name = 'SRC_' && index .
gs_comp-type ?= cl_abap_elemdescr=>get_i( ). "same as node_id
APPEND gs_comp TO gt_comp.
APPEND GS_COMP TO GT_SOURCES.
enddo.
"/set dynamic columns
try . "create structure from static and dynamic fields
r_type_struct = cl_abap_structdescr=>create( p_components = gt_comp ).
CATCH cx_sy_struct_creation.
ENDTRY. "/create structure from static and dynamic fields
TRY. "create table from structure
r_type_table = cl_abap_tabledescr=>create( r_type_struct ).
CATCH cx_sy_table_creation .
ENDTRY. "/create table from structure
"create data based on static/dynamic hybrid type creation.
CREATE DATA: r_data_tab TYPE HANDLE r_type_table,
r_data_str TYPE HANDLE r_type_struct.
2018 Sep 21 7:33 AM
The association condtion are explicit so I guess the answer is no.