Bsp.png
Hallo zusammen,
mit viel Hilfe des Internets habe ich u.s. Report erstellt.
Wo ich jedoch noch ein "Störgefühl" habe ich, ist das Format der jeweiligen Beträge in den Datumsspalten, siehe Datei "Bsp".
Hier ist der Betrag als "1875.80".
Wie bzw. wo muss ich eingreifen, damit als Ergebnis "1.875,80" herauskommt?
Besten Dank und ein schönes Wochenende!
TYPES: BEGIN OF gfirst_typ,
name_org1 TYPE but000-name_org1,
name_org2 TYPE but000-name_org2,
vkont TYPE vkont_kk,
kofi TYPE TEXT50,
msalm TYPE msalm_kk,
mdrkd TYPE mdrkd_kk,
END OF gfirst_typ.
DATA :
it_zdemo TYPE TABLE OF gfirst_typ,
wa_zdemo LIKE LINE OF it_zdemo,
w_date TYPE d,
vk_1 TYPE vkont_kk,
vk_2 TYPE vkont_kk,
vk_3 TYPE vkont_kk,
wa_zdemo1 LIKE LINE OF it_zdemo,
gv_pos TYPE i,
fname TYPE d,
gw_alv_fieldcat TYPE slis_fieldcat_alv,
gt_alv_fieldcat TYPE slis_t_fieldcat_alv,
lv_pos TYPE i,
lv_datstr TYPE rn1datum-datex,
* Dynamic Table Declarations
gt_dyn_table TYPE REF TO data,
gw_line TYPE REF TO data,
gw_line1 TYPE REF TO data,
gw_dyn_fcat TYPE lvc_s_fcat,
gt_dyn_fcat TYPE lvc_t_fcat,
lv_sum TYPE msalm_kk,
lv_count TYPE i.
* Field Symbols Declarations
FIELD-SYMBOLS: <gfs_line>,
<gfs_line1>,
<fs1>,
<gfs_dyn_table> TYPE STANDARD TABLE.
w_date = sy-datum - 365.
vk_1 = '005591%'.
vk_2 = '007000%'.
vk_3 = '007001%'.
SELECT b~name_org1, b~name_org2, vkp~vkont, te~TEXT50, mako~msalm, mako~mdrkd
FROM but000 AS b
JOIN fkkvkp AS vkp ON vkp~gpart = b~partner
JOIN fkkmako AS mako ON mako~vkont = vkp~vkont
JOIN te097AT as te ON te~kofiz = vkp~KOFIZ_SD
INTO TABLE @it_zdemo
where mako~mdrkd GT @w_date and ( vkp~vkont like @vk_1 or vkp~vkont like @vk_2 or vkp~vkont like @vk_3 )
and mako~XMSTO = ''.
SORT it_zdemo BY mdrkd ASCENDING.
gv_pos = gv_pos + 1.
gw_dyn_fcat-fieldname = 'name_org1'.
gw_dyn_fcat-outputlen = 40.
gw_dyn_fcat-tabname = 'IT_DEMO'.
gw_dyn_fcat-coltext = 'Name 1'.
gw_dyn_fcat-col_pos = gv_pos.
gw_dyn_fcat-key = 'X'.
gw_dyn_fcat-key_sel = 'X'.
APPEND gw_dyn_fcat TO gt_dyn_fcat.
gv_pos = gv_pos + 1.
gw_dyn_fcat-fieldname = 'name_org2'.
gw_dyn_fcat-outputlen = 40.
gw_dyn_fcat-tabname = 'IT_DEMO'.
gw_dyn_fcat-coltext = 'Name 2'.
gw_dyn_fcat-col_pos = gv_pos.
gw_dyn_fcat-key = 'X'.
gw_dyn_fcat-key_sel = 'X'.
APPEND gw_dyn_fcat TO gt_dyn_fcat.
gv_pos = gv_pos + 1.
gw_dyn_fcat-fieldname = 'vkont'.
gw_dyn_fcat-outputlen = 12.
gw_dyn_fcat-tabname = 'IT_DEMO'.
gw_dyn_fcat-coltext = 'Vertragskonto'.
gw_dyn_fcat-col_pos = gv_pos.
gw_dyn_fcat-key = 'X'.
gw_dyn_fcat-key_sel = 'X'.
APPEND gw_dyn_fcat TO gt_dyn_fcat.
gv_pos = gv_pos + 1.
gw_dyn_fcat-fieldname = 'kofi'.
gw_dyn_fcat-outputlen = 38.
gw_dyn_fcat-tabname = 'IT_DEMO'.
gw_dyn_fcat-coltext = 'Text'.
gw_dyn_fcat-col_pos = gv_pos.
gw_dyn_fcat-key = 'X'.
gw_dyn_fcat-key_sel = 'X'.
APPEND gw_dyn_fcat TO gt_dyn_fcat.
gv_pos = gv_pos + 1.
gw_dyn_fcat-fieldname = 'Summe'.
gw_dyn_fcat-outputlen = 12.
gw_dyn_fcat-tabname = 'IT_DEMO'.
gw_dyn_fcat-coltext = 'Gesamtsumme'.
gw_dyn_fcat-col_pos = gv_pos.
gw_dyn_fcat-key = 'X'.
gw_dyn_fcat-key_sel = 'X'.
gw_dyn_fcat-datatype = 'CURR'.
APPEND gw_dyn_fcat TO gt_dyn_fcat.
gv_pos = gv_pos + 1.
gw_dyn_fcat-fieldname = 'Anzahl'.
gw_dyn_fcat-outputlen = 6.
gw_dyn_fcat-tabname = 'IT_DEMO'.
gw_dyn_fcat-coltext = 'Anzahl'.
gw_dyn_fcat-col_pos = gv_pos.
gw_dyn_fcat-key = 'X'.
gw_dyn_fcat-key_sel = 'X'.
gw_dyn_fcat-datatype = 'INT1'.
APPEND gw_dyn_fcat TO gt_dyn_fcat.
BREAK-POINT.
CLEAR gw_dyn_fcat.
* Loop through the internal table creating a column for every distinct mdrkd in the internal table
LOOP AT it_zdemo INTO wa_zdemo.
gv_pos = gv_pos + 1.
READ TABLE gt_dyn_fcat INTO gw_dyn_fcat WITH KEY fieldname = wa_zdemo-mdrkd.
IF sy-subrc NE 0.
gw_dyn_fcat-fieldname = wa_zdemo-mdrkd.
gw_dyn_fcat-tabname = 'IT_DEMO'.
CALL FUNCTION 'FORMAT_DATE_4_OUTPUT'
EXPORTING
datin = wa_zdemo-mdrkd
format = 'DD.MM.YYYY'
IMPORTING
datex = lv_datstr.
gw_dyn_fcat-coltext = lv_datstr.
gw_dyn_fcat-outputlen = 10.
gw_dyn_fcat-col_pos = gv_pos.
APPEND gw_dyn_fcat TO gt_dyn_fcat.
ENDIF.
CLEAR gw_dyn_fcat.
ENDLOOP.
** Create a dynamic internal table with this structure.
CALL METHOD cl_alv_table_create=>create_dynamic_table
EXPORTING
i_style_table = 'X'
it_fieldcatalog = gt_dyn_fcat
IMPORTING
ep_table = gt_dyn_table
EXCEPTIONS
generate_subpool_dir_full = 1
OTHERS = 2.
IF sy-subrc EQ 0.
* Assign the new table to field symbol
ASSIGN gt_dyn_table->* TO <gfs_dyn_table>.
* Create dynamic work area for the dynamic table
CREATE DATA gw_line LIKE LINE OF <gfs_dyn_table>.
CREATE DATA gw_line1 LIKE LINE OF <gfs_dyn_table>.
ASSIGN gw_line->* TO <gfs_line>.
ASSIGN gw_line1->* TO <gfs_line1>.
ENDIF.
* Populate the dynamic table
LOOP AT it_zdemo INTO wa_zdemo.
* Avoid duplicate entries for key field PART.
READ TABLE <gfs_dyn_table> INTO <gfs_line1> WITH KEY ('vkont') = wa_zdemo-vkont.
IF sy-subrc = 0.
CONTINUE.
ENDIF.
ASSIGN COMPONENT 'vkont' OF STRUCTURE <gfs_line> TO <fs1>.
<fs1> = wa_zdemo-vkont.
UNASSIGN <fs1>.
ASSIGN COMPONENT 'name_org1' OF STRUCTURE <gfs_line> TO <fs1>.
<fs1> = wa_zdemo-name_org1.
UNASSIGN <fs1>.
ASSIGN COMPONENT 'name_org2' OF STRUCTURE <gfs_line> TO <fs1>.
<fs1> = wa_zdemo-name_org2.
UNASSIGN <fs1>.
ASSIGN COMPONENT 'kofi' OF STRUCTURE <gfs_line> TO <fs1>.
<fs1> = wa_zdemo-kofi.
UNASSIGN <fs1>.
LOOP AT gt_dyn_fcat INTO gw_dyn_fcat.
READ TABLE it_zdemo WITH KEY vkont = wa_zdemo-vkont
mdrkd = gw_dyn_fcat-fieldname INTO wa_zdemo1.
IF sy-subrc = 0.
ASSIGN COMPONENT gw_dyn_fcat-fieldname OF STRUCTURE <gfs_line> TO <fs1>.
<fs1> = wa_zdemo1-msalm.
lv_sum = lv_sum + wa_zdemo1-msalm.
lv_count = lv_count + 1.
UNASSIGN <fs1>.
ENDIF.
ENDLOOP.
ASSIGN COMPONENT 'Anzahl' OF STRUCTURE <gfs_line> TO <fs1>.
<fs1> = lv_count.
UNASSIGN <fs1>.
ASSIGN COMPONENT 'Summe' OF STRUCTURE <gfs_line> TO <fs1>.
<fs1> = lv_sum.
UNASSIGN <fs1>.
CLEAR : wa_zdemo1 , lv_count, lv_sum.
APPEND <gfs_line> TO <gfs_dyn_table>.
CLEAR: <gfs_line>.
CLEAR: wa_zdemo, wa_zdemo1.
ENDLOOP.
LOOP AT gt_dyn_fcat INTO gw_dyn_fcat.
lv_pos = lv_pos + 1.
gw_alv_fieldcat-fieldname = gw_dyn_fcat-fieldname.
gw_alv_fieldcat-tabname = gw_dyn_fcat-tabname.
gw_alv_fieldcat-seltext_l = gw_dyn_fcat-coltext.
gw_alv_fieldcat-outputlen = gw_dyn_fcat-outputlen.
gw_alv_fieldcat-col_pos = lv_pos.
gw_alv_fieldcat-do_sum = gw_dyn_fcat-do_sum.
gw_alv_fieldcat-emphasize = gw_dyn_fcat-emphasize.
gw_alv_fieldcat-key = gw_dyn_fcat-key.
gw_alv_fieldcat-no_out = gw_dyn_fcat-no_out.
APPEND gw_alv_fieldcat TO gt_alv_fieldcat.
ENDLOOP.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
it_fieldcat = gt_alv_fieldcat
i_default = 'X'
i_save = 'A'
TABLES
t_outtab = <gfs_dyn_table>.
Du hast keine ausreichende Berechtigung, um die Dateianhänge dieses Beitrags anzusehen.