Skip to Content
0
Dec 19, 2006 at 10:50 AM

Why this dump(2)?

29 Views

Execute this report and try to sum "menge" column...goes it in dump? Why?

REPORT zanalisi_oda .

TYPE-POOLS slis.

  • tipo record da visualizzare

TYPES: BEGIN OF t_record,

aedat LIKE ekpo-aedat,

ebeln LIKE ekpo-ebeln,

ebelp LIKE ekpo-ebelp,

matnr LIKE ekpo-matnr,

txz01 LIKE ekpo-txz01,

werks LIKE ekpo-werks,

knttp LIKE ekpo-knttp,

menge LIKE ekpo-menge,

meins LIKE ekpo-meins,

END OF t_record.

  • tabelle in questione

TABLES: ekpo.

  • tabelle interne

DATA: wa_record TYPE t_record,

it_record TYPE STANDARD TABLE OF t_record.

*ALV data declarations

DATA: it_fieldcatalog TYPE slis_t_fieldcat_alv,

wa_fieldcatalog LIKE LINE OF it_fieldcatalog,

gd_layout TYPE slis_layout_alv,

gd_repid LIKE sy-repid.

  • selezioni dell'utente

SELECT-OPTIONS: s_aedat FOR ekpo-aedat,

s_ebeln FOR ekpo-ebeln,

s_matnr FOR ekpo-matnr,

s_werks FOR ekpo-werks.

PARAMETERS: c_elikz AS CHECKBOX DEFAULT 'X'.

************************************************************************

  • START OF SELECTION *

************************************************************************

START-OF-SELECTION.

  • carico i dati richiesti

PERFORM load_report.

  • stampo i dati

PERFORM build_fieldcatalog.

PERFORM build_layout.

PERFORM display_alv_report.

&----


*& Form load_report

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


FORM load_report .

CLEAR it_record.

*ciclo nella tabella EKPO

SELECT *

FROM ekpo

WHERE aedat IN s_aedat AND

ebeln IN s_ebeln AND

matnr IN s_matnr AND

werks IN s_werks AND

elikz EQ c_elikz AND

loekz NE 'X'

ORDER BY ebeln ebelp.

CLEAR wa_record.

wa_record-aedat = ekpo-aedat.

wa_record-ebeln = ekpo-ebeln.

wa_record-ebelp = ekpo-ebelp.

wa_record-matnr = ekpo-matnr.

wa_record-txz01 = ekpo-txz01.

wa_record-werks = ekpo-werks.

wa_record-knttp = ekpo-knttp.

wa_record-menge = ekpo-menge.

wa_record-meins = ekpo-meins.

APPEND wa_record TO it_record.

ENDSELECT.

ENDFORM. " load_report

&----


*& Form build_fieldcatalog

&----


  • Routine per la generazione dei campi della ALV GRID

----


  • No parameters

----


FORM build_fieldcatalog .

wa_fieldcatalog-fieldname = 'AEDAT'.

wa_fieldcatalog-seltext_m = 'Data ODA'.

wa_fieldcatalog-col_pos = 0.

APPEND wa_fieldcatalog TO it_fieldcatalog.

CLEAR wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'EBELN'.

wa_fieldcatalog-seltext_m = 'Numero ODA'.

wa_fieldcatalog-col_pos = 1.

wa_fieldcatalog-key = 'X'.

APPEND wa_fieldcatalog TO it_fieldcatalog.

CLEAR wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'EBELP'.

wa_fieldcatalog-seltext_m = 'Pos.ODA'.

wa_fieldcatalog-col_pos = 2.

wa_fieldcatalog-key = 'X'.

APPEND wa_fieldcatalog TO it_fieldcatalog.

CLEAR wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'MATNR'.

wa_fieldcatalog-seltext_m = 'Materiale'.

wa_fieldcatalog-col_pos = 3.

wa_fieldcatalog-emphasize = 'X'.

APPEND wa_fieldcatalog TO it_fieldcatalog.

CLEAR wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'TXZ01'.

wa_fieldcatalog-seltext_m = 'Descrizione'.

wa_fieldcatalog-col_pos = 4.

APPEND wa_fieldcatalog TO it_fieldcatalog.

CLEAR wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'WERKS'.

wa_fieldcatalog-seltext_m = 'Mag.'.

wa_fieldcatalog-col_pos = 5.

APPEND wa_fieldcatalog TO it_fieldcatalog.

CLEAR wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'KNTTP'.

wa_fieldcatalog-seltext_m = 'Tipo contab.'.

wa_fieldcatalog-col_pos = 6.

APPEND wa_fieldcatalog TO it_fieldcatalog.

CLEAR wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'KOSTL'.

wa_fieldcatalog-seltext_m = 'CdC'.

wa_fieldcatalog-col_pos = 7.

APPEND wa_fieldcatalog TO it_fieldcatalog.

CLEAR wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'EIND'.

wa_fieldcatalog-seltext_m = 'Data cons.prev.'.

wa_fieldcatalog-col_pos = 8.

APPEND wa_fieldcatalog TO it_fieldcatalog.

CLEAR wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'MENGE'.

wa_fieldcatalog-seltext_m = 'Qta ord.'.

wa_fieldcatalog-col_pos = 9.

APPEND wa_fieldcatalog TO it_fieldcatalog.

CLEAR wa_fieldcatalog.

wa_fieldcatalog-fieldname = 'MEINS'.

wa_fieldcatalog-seltext_m = 'UdM'.

wa_fieldcatalog-col_pos = 10.

APPEND wa_fieldcatalog TO it_fieldcatalog.

CLEAR wa_fieldcatalog.

ENDFORM. " fill_fieldcatalog

&----


*& Form build_layout

&----


  • Routine per il settaggio del layout della ALV GRID

----


  • No parameters

----


FORM build_layout .

gd_layout-no_input = 'X'.

gd_layout-colwidth_optimize = 'X'.

  • gd_layout-totals_text = 'Totals'(201).

  • gd_layout-totals_only = 'X'.

  • gd_layout-f2code = 'DISP'. "Sets fcode for when double

  • "click(press f2)

  • gd_layout-zebra = 'X'.

  • gd_layout-group_change_edit = 'X'.

  • gd_layout-header_text = ''.

ENDFORM. " build_layout

&----


*& Form DISPLAY_ALV_REPORT

&----


  • Routine per la visualizzazione della ALV GRID

----


  • No parameters

----


FORM display_alv_report .

gd_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

i_callback_program = gd_repid

  • I_CALLBACK_TOP_OF_PAGE = 'TOP-OF-PAGE' "see FORM

  • i_callback_user_command = 'USER_COMMAND'

  • i_grid_title = outtext

is_layout = gd_layout

it_fieldcat = it_fieldcatalog[]

  • it_special_groups = gd_tabgroup

  • IT_EVENTS = GT_XEVENTS

i_save = 'X'

  • is_variant = z_template

TABLES

t_outtab = it_record

EXCEPTIONS

program_error = 1

OTHERS = 2.

IF sy-subrc <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

ENDFORM. " DISPLAY_ALV_REPORT