From 55d85d50b713bbd3fc844cefddf3cb568ab6c1eb Mon Sep 17 00:00:00 2001 From: Lars Hvam Date: Sun, 7 Jan 2024 14:29:50 +0100 Subject: [PATCH] assigning --- src/kernel/kernel_create_data_handle.clas.abap | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/kernel/kernel_create_data_handle.clas.abap b/src/kernel/kernel_create_data_handle.clas.abap index 4a007a35..e256140a 100644 --- a/src/kernel/kernel_create_data_handle.clas.abap +++ b/src/kernel/kernel_create_data_handle.clas.abap @@ -75,20 +75,23 @@ CLASS kernel_create_data_handle IMPLEMENTATION. METHOD struct. DATA lo_struct TYPE REF TO cl_abap_structdescr. DATA lt_components TYPE cl_abap_structdescr=>component_table. - DATA ls_component LIKE LINE OF lt_components. DATA field TYPE REF TO data. + DATA lv_name TYPE string. + + FIELD-SYMBOLS LIKE LINE OF lt_components. lo_struct ?= handle. lt_components = lo_struct->get_components( ). WRITE '@KERNEL let obj = {};'. - LOOP AT lt_components INTO ls_component. + LOOP AT lt_components ASSIGNING . * WRITE '@KERNEL console.dir(ls_component.get().name);'. call( EXPORTING - handle = lo_struct->get_component_type( ls_component-name ) + handle = lo_struct->get_component_type( -name ) CHANGING dref = field ). - WRITE '@KERNEL obj[ls_component.get().name.get().toLowerCase()] = field.getPointer();'. + lv_name = to_lower( -name ). + WRITE '@KERNEL obj[lv_name.get()] = field.getPointer();'. ENDLOOP. WRITE '@KERNEL dref.assign(new abap.types.Structure(obj));'. ENDMETHOD.