05-12-2011 2:31 PM
Hello
I'm using REUSE_ALV_GRID_DISPLAY. The internal table-filed X = 1000. The same field on ALV list is showed as 1000 000.
The field is :
SORTAMOUNT CURR 12 decimal 5
Following the code (i not used particular option):
REFRESH lt_fieldcat.
CLEAR lt_fieldcat.
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
EXPORTING
i_program_name = 'ZFI_FLASH_FILES'
i_internal_tabname = 'ZFI_FLASH_FILES'
i_inclname = sy-repid
i_inclname = 'ZFI_FLASH_FILES'
i_structure_name = 'ZFI_FLASH_FILES'
CHANGING
ct_fieldcat = lt_fieldcat
EXCEPTIONS
OTHERS = 1.
IF sy-subrc NE 0.
REFRESH lt_fieldcat.
CLEAR lt_fieldcat.
ENDIF.
LOOP AT lt_fieldcat INTO ls_slis_fieldcat.
CASE ls_slis_fieldcat-fieldname.
WHEN 'UNITCODE'.
MOVE 'Code IC' TO ls_slis_fieldcat-seltext_s.
WHEN 'ACCCODE'.
MOVE 'Code Account' TO ls_slis_fieldcat-seltext_s.
WHEN 'DIM1CODE'.
MOVE 'Brand-code' TO ls_slis_fieldcat-seltext_s.
WHEN 'DIM2CODE'.
MOVE 'Product-type-code' TO ls_slis_fieldcat-seltext_s.
WHEN 'DIM3CODE'.
MOVE 'Pays FH' TO ls_slis_fieldcat-seltext_s.
WHEN 'CURRCCODE'.
MOVE 'Devise' TO ls_slis_fieldcat-seltext_s.
WHEN 'SORTAMOUNT'.
MOVE 'Cumul' TO ls_slis_fieldcat-seltext_s.
MOVE '5' TO ls_slis_fieldcat-decimals_out. "@6I
ENDCASE.
MODIFY lt_fieldcat FROM ls_slis_fieldcat.
ENDLOOP.
alv_layout-colwidth_optimize = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
EXPORTING
i_callback_program = 'ZFI_FLASH_FILES'
i_grid_title = 'Fichier Flash'
i_structure_name = 'ZFI_FLASH_FILES'
is_layout = alv_layout
i_callback_user_command = 'USER_COMM'
it_fieldcat = lt_fieldcat
i_default = 'X'
i_save = 'A'
it_sort = i_sort
i_save = 'A'
is_variant = ls_variant
it_events = event_tb
is_print = alv_print
TABLES
t_outtab = t_datatab
EXCEPTIONS
program_error = 1
OTHERS = 2.
Any idea ?
05-12-2011 3:36 PM
You don't need to pass fieldcatalog and structure at same time. If your output table matched the DD structure format, you can just pass on the structure directly. If not, use field catalog to create a type. Also, I_DEFAULT = 'X' and I_SAVE = 'A' are for layout, should be used in together.
05-12-2011 4:25 PM
Make sure to have same data type for internal table and Structure/Feild catalog.
No wonder, the field type is Curr and with decimal places, so you will see the output with Decimals.
06-08-2011 2:33 PM
Solved by refreshing with sync transaction.
Thank you
regards
Roberto