Relationship problem saving selected ittems in subpanel popup

I have a problem with relationships (m:n) and subpanels in custom modul:
The detail view shows the subpanel for the related module.
When I want to add some items, the popup is shown, i can select items and clicking ‘select’.
The selected items will not be saved to the m:n table, the generated sql insert string has an error.
When i look at the insert string, there is a wrong field name, the field prefix is whithout underscore:

  • gnerated field: ‘fim locations_id’
  • correct field name: ‘fim_locations_id’

// from system generated insert string:
INSERT INTO fim_location_projects (id,name,date_entered,date_modified,modified_user_id,created_by,description,deleted,assigned_user_id,fim locations_id,fim_projects_id) VALUES (‘ed5d6084-c39a-363d-43e8-5d4da2a75811’,‘Sample Location Wolfschlucht - Aktionsangebote’,‘2019-08-09 16:41:00’,‘2019-08-09 16:41:00’,‘7be40e7e-1ae7-62f8-d37c-5b93c25d6242’,‘7be40e7e-1ae7-62f8-d37c-5b93c25d6242’,’’,0,‘7be40e7e-1ae7-62f8-d37c-5b93c25d6242’,’’,‘9e230ae6-b487-ddd7-1f1d-5d04c16d91f6’)

// relationship definition in custom/metadata/fim_locations_fim_projectsMetaData.php
$dictionary[“fim_locations_fim_projects”] = array (
‘true_relationship_type’ => ‘many-to-many’,
‘relationships’ =>
array (
‘fim_locations_fim_projects’ =>
array (
‘lhs_module’ => ‘FIM_Locations’,
‘lhs_table’ => ‘fim_locations’,
‘lhs_key’ => ‘id’,
‘rhs_module’ => ‘FIM_Projects’,
‘rhs_table’ => ‘fim_projects’,
‘rhs_key’ => ‘id’,
‘relationship_type’ => ‘many-to-many’,
‘join_table’ => ‘fim_location_projects’,
‘join_key_lhs’ => ‘fim_locations_id’,
‘join_key_rhs’ => ‘fim_projects_id’,
),
),
‘table’ => ‘fim_location_projects’,
‘fields’ => …

// code from /custom/Extension/modules/Fim_Projects/Ext/Vardefs/fim_locations_fim_projects_FIM_Projects.php
$dictionary[“FIM_Projects”][“fields”][“fim_locations_fim_projects”] = array (
‘name’ => ‘fim_locations_fim_projects’,
‘type’ => ‘link’,
‘relationship’ => ‘fim_locations_fim_projects’,
‘source’ => ‘non-db’,
‘module’ => ‘FIM_Locations’,
‘bean_name’ => ‘FIM_Locations’,
‘vname’ => ‘LBL_FIM_LOCATIONS_FIM_PROJECTS_FROM_FIM_LOCATIONS_TITLE’,
);

// subpanel defintiion code from custom/Extension/modules/Fim_Projects/Ext/Vardefs/fim_locations_fim_projects_FIM_Projects.php
$layout_defs[“FIM_Projects”][“subpanel_setup”][‘fim_locations_fim_projects’] = array (
‘order’ => 100,
‘module’ => ‘FIM_Locations’,
‘subpanel_name’ => ‘’,
‘sort_order’ => ‘asc’,
‘sort_by’ => ‘name’,
‘title_key’ => ‘LBL_FIM_LOCATIONS_FIM_PROJECTS_FROM_FIM_LOCATIONS_TITLE’,
‘get_subpanel_data’ => ‘fim_location_projects’,
‘top_buttons’ => array (
0 => array (
‘widget_class’ => ‘SubPanelTopSelectButton’,
‘mode’ => ‘MultiSelect’,
),
1 => array (
‘widget_class’ => ‘SubPanelTopButtonQuickCreate’,
),
),
);

I have no idea how to handle this, for me looks the right done.
The only thing is the generated sql insert code, but how can i prevent this ?

kind regards
Rolf

Found the Problem: i defined a custom module for viewing related items, there was the wrong field definition in vardefs with missing underscore.