Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

can you create mesh associations dynamically?

Former Member
0 Likes
605
I have a dynamically created table to be filled later, and wish to create a mesh with associations from an endpoint eg'NODE_ID' to all of the source points eg: 'src_x'.

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.

I have a dynamically created table to be filled later, and wish to create a mesh with associations from an endpoint eg'NODE_ID' to all of the source points eg: 'src_x'.

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.

1 REPLY 1
Read only

DoanManhQuynh
Active Contributor
0 Likes
470

The association condtion are explicit so I guess the answer is no.