10-11-2022 3:07 PM
Dear all,
the value changes when I read via field symbol. Are there any suggestions how I can solve this?
There is also a Screenshot of the Debugger in the attachement.
Kind Regards
Torbjörn Saretz
REPORT ztest_json_korr_produktname.
DATA ls_json_data TYPE zst_json_tardet.
DATA lv_filename LIKE rlgrap-filename.
DATA lt_tab1 TYPE kcde_intern.
DATA lt_tab2 LIKE TABLE OF alsmex_tabline WITH HEADER LINE.
DATA lv_test TYPE char50.
TYPES: BEGIN OF ls_auslese_typ,
object TYPE ze_json_object,
object_key TYPE integer,
produktname TYPE string,
END OF ls_auslese_typ.
DATA ls_auslese TYPE ls_auslese_typ.
DATA lt_auslese TYPE TABLE OF ls_auslese_typ.
DATA lt_all TYPE TABLE OF ztu_json.
DATA ls_all TYPE ztu_json.
DATA lt_inter TYPE TABLE OF ztu_json.
lv_filename = 'C:\Users\PR910009\Documents\Entwicklung\XLXS_lesen\Test_Mappe1.xlsx'.
CALL FUNCTION 'KCD_EXCEL_OLE_TO_INT_CONVERT'
EXPORTING
filename = lv_filename
i_begin_col = 1
i_begin_row = 1
i_end_col = 3
i_end_row = 999
TABLES
intern = lt_tab1.
* EXCEPTIONS
* INCONSISTENT_PARAMETERS = 1
* UPLOAD_OLE = 2
* OTHERS = 3
CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'
EXPORTING
filename = lv_filename
i_begin_col = '1'
i_begin_row = '1'
i_end_col = '250'
i_end_row = '1000'
TABLES
intern = lt_tab2
EXCEPTIONS
inconsistent_parameters = 1
upload_ole = 2
OTHERS = 3.
IF sy-subrc EQ 0.
LOOP AT lt_tab2 ASSIGNING FIELD-SYMBOL(<fs_tab>) .
AT NEW row.
CLEAR ls_auslese.
ENDAT.
* Kopfzeile überspringen
IF <fs_tab>-row = '0001'.
CONTINUE.
ENDIF.
CASE <fs_tab>-col.
WHEN 1.
ls_auslese-object = <fs_tab>-value.
WHEN 2.
ls_auslese-object_key = <fs_tab>-value.
WHEN 3.
ls_auslese-produktname = <fs_tab>-value.
ENDCASE.
AT END OF row.
APPEND ls_auslese TO lt_auslese.
ENDAT.
ENDLOOP.
ENDIF.
LOOP AT lt_auslese INTO ls_auslese.
SELECT object, object_key, object_version, value FROM ztu_json INTO CORRESPONDING FIELDS OF TABLE @lt_inter
WHERE ztu_json~object_key = @ls_auslese-object_key.
IF sy-subrc EQ 0.
* APPEND lt_inter TO lt_all.
ENDIF.
ENDLOOP.
10-11-2022 3:52 PM
Hello shad0wk1d
The value change you see is due to rounding. LS_AUSLESE-OBJECT_KEY is of integer type. <FS_TAB>-VALUE is 104.873. When you move that value to LS_AUSLESE-OBJECT_KEY, the value gets rounded to the nearest integer, which is 105.
Best regards
Dominik Tylczynski
10-11-2022 3:52 PM
Hello shad0wk1d
The value change you see is due to rounding. LS_AUSLESE-OBJECT_KEY is of integer type. <FS_TAB>-VALUE is 104.873. When you move that value to LS_AUSLESE-OBJECT_KEY, the value gets rounded to the nearest integer, which is 105.
Best regards
Dominik Tylczynski
10-11-2022 5:44 PM
Please show the images instead of hyperlinks, especially when there are several ones, it avoids the pain to open and close each of them separately and repeatedly.
+ better resize it so that to make it big