Skip to Content
0
Former Member
May 20, 2008 at 11:08 AM

ALV reports

21 Views

Hi all,

This program is goin for shot dump.

could anybody please help me out with this?

&----


*& Report Z_INTERACTIVE_CUSTOM_CHAI

*&

&----


*&

*&

&----


REPORT Z_INTERACTIVE_CUSTOM_CHAI.

type-pools: slis.

tables: mara,

marc,

mard.

types: begin of ty_mara,

matnr type matnr,

mtart type mtart,

mbrsh type mbrsh,

matkl type matkl,

meins type meins,

end of ty_mara.

types: begin of ty_marc,

matnr type matnr,

werks type werks_d,

PSTAT type PSTAT_D,

DISPR type DISPR,

end of ty_marc.

types: begin of ty_mard,

matnr type matnr,

werks type werks_d,

lgort type lgort_d,

LABST type labst,

end of ty_mard.

data: t_mara type standard table of ty_mara,

w_mara type ty_mara,

t_marc type standard table of ty_marc,

w_marc type ty_marc,

t_mard type standard table of ty_mard,

w_mard type ty_mard.

data: i_repid like sy-repid,

i_fieldcat TYPE SLIS_t_FIELDCAT_ALV,

WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV,

v_events type slis_t_event,

w_events type SLIS_ALV_EVENT,

v_events_1 type slis_t_event,

w_events_1 type SLIS_ALV_EVENT,

t_listheader type SLIS_T_LISTHEADER,

t_listheader_1 type SLIS_T_LISTHEADER,

t_mara_title type lvc_title value 'first list displayed',

t_marc_title type lvc_title value 'second list displayed',

t_mard_title type lvc_title value 'third list displayed'.

DATA: I_VARIANT TYPE DISVARIANT,

I_VARIANT1 TYPE DISVARIANT,

I_SAVE(1) TYPE C.

initialization.

I_repid = sy-repid.

perform build_fieldcatalog_mara.

perform event_call_mara.

perform populate_events_mara.

selection-screen begin of block b1 .

select-options: s_matnr for mara-matnr.

selection-screen end of block b1.

start-of-selection.

perform data_retrieval_mara.

perform build_listheader_mara using t_listheader.

perform alv_grid_display_mara.

&----


*& Form build_fieldcatalog_mara

&----


  • text

----


form build_fieldcatalog_mara.

WA_FIELDCAT-fieldname = 'matnr'.

WA_FIELDCAT-seltext_m = 'Material no'.

append WA_FIELDCAT to i_fieldcat.

clear WA_FIELDCAT.

WA_FIELDCAT-fieldname = 'mtart'.

WA_FIELDCAT-seltext_m = 'Material type'.

append WA_FIELDCAT to i_fieldcat.

clear WA_FIELDCAT.

WA_FIELDCAT-fieldname = 'mbrsh'.

WA_FIELDCAT-seltext_m = 'Industry sector'.

append WA_FIELDCAT to i_fieldcat.

clear WA_FIELDCAT.

WA_FIELDCAT-fieldname = 'matkl'.

WA_FIELDCAT-seltext_m = 'Material group'.

append WA_FIELDCAT to i_fieldcat.

clear WA_FIELDCAT.

WA_FIELDCAT-fieldname = 'meins'.

WA_FIELDCAT-seltext_m = 'Units'.

append WA_FIELDCAT to i_fieldcat.

clear WA_FIELDCAT.

endform. "build_fieldcatalog_mara

&----


*& Form event_call_mara

&----


  • text

----


form event_call_mara.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = v_events

EXCEPTIONS

LIST_TYPE_WRONG = 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. "build_fieldcatalog_mara

&----


*& Form populate_events_mara

&----


  • text

----


form populate_events_mara.

read table v_events into w_events with key name = 'TOP_OF_PAGE'.

if sy-subrc = 0.

w_events-form = 'TOP_OF_PAGE'.

modify v_events from w_events transporting form where name = w_events-form.

clear w_events.

endif.

read table v_events into w_events with key name = 'USER_COMMAND'.

if sy-subrc = 0.

w_events-form = 'USER_COMMAND'.

modify v_events from w_events transporting form where name = w_events-form.

endif.

endform. "populate_events_mara

&----


*& Form data_retrieval_mara

&----


  • text

----


form data_retrieval_mara.

select matnr

mbrsh

mtart

matkl

meins

from mara into corresponding fields of table t_mara

where matnr in s_maTNR.

endform. "populate_events_mara

&----


*& Form build_listheader_mara

&----


  • text

----


  • -->T_LISTHEADER text

----


form build_listheader_mara using t_listheader type SLIS_T_LISTHEADER.

DATA HLINE TYPE SLIS_LISTHEADER.

HLINE-INFO = 'FIRST LIST'.

HLINE-TYP = 'H'.

APPEND HLINE TO T_LISTHEADER.

ENDFORM. "populate_events_mara

&----


*& Form alv_grid_display_mara

&----


  • text

----


form alv_grid_display_mara.

i_repid = sy-repid.

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = i_repid

  • I_CALLBACK_PF_STATUS_SET = ' '

I_CALLBACK_USER_COMMAND = 'USER_COMMAND'

I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

I_GRID_TITLE = t_mara_title

  • I_GRID_SETTINGS =

  • IS_LAYOUT =

IT_FIELDCAT = I_FIELDCAT[]

  • IT_EXCLUDING =

  • IT_SPECIAL_GROUPS =

  • IT_SORT =

  • IT_FILTER =

  • IS_SEL_HIDE =

  • I_DEFAULT = 'X'

I_SAVE = 'A'

IS_VARIANT = i_variant

IT_EVENTS = v_events

  • IT_EVENT_EXIT =

  • IS_PRINT =

  • IS_REPREP_ID =

  • I_SCREEN_START_COLUMN = 0

  • I_SCREEN_START_LINE = 0

  • I_SCREEN_END_COLUMN = 0

  • I_SCREEN_END_LINE = 0

  • I_HTML_HEIGHT_TOP = 0

  • I_HTML_HEIGHT_END = 0

  • IT_ALV_GRAPHICS =

  • IT_HYPERLINK =

  • IT_ADD_FIELDCAT =

  • IT_EXCEPT_QINFO =

  • IR_SALV_FULLSCREEN_ADAPTER =

  • IMPORTING

  • E_EXIT_CAUSED_BY_CALLER =

  • ES_EXIT_CAUSED_BY_USER =

TABLES

T_OUTTAB = t_mara

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. "alv_grid_display_mara

&----


*& Form TOP_OF_PAGE_MARA

&----


  • text

----


form TOP_OF_PAGE.

CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

EXPORTING

IT_LIST_COMMENTARY = t_listheader

  • I_LOGO =

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

.

endform. "TOP_OF_PAGE_MARA

&----


*& Form USER_COMMAND

&----


  • text

----


  • -->R_UCOMM text

  • -->RS_SELFIELD text

----


form USER_COMMAND using r_ucomm like sy-ucomm

RS_SELFIELD TYPE SLIS_SELFIELD.

case r_ucomm.

when '&IC1'.

  • clear t_listheader.

perform build_fieldcatalog_marc.

perform event_call_marc.

perform populate_events_marc.

perform data_retrieval_marc.

perform build_listheader_marc using t_listheader_1.

perform alv_grid_display_marc.

endcase.

endform. "USER_COMMAND

&----


*& Form build_fieldcatalog_marc

&----


  • text

----


form build_fieldcatalog_marc.

WA_FIELDCAT-fieldname = 'matnr'.

WA_FIELDCAT-seltext_m = 'Material no'.

append WA_FIELDCAT to i_fieldcat.

clear WA_FIELDCAT.

WA_FIELDCAT-fieldname = 'werks'.

WA_FIELDCAT-seltext_m = 'Plant'.

append WA_FIELDCAT to i_fieldcat.

clear WA_FIELDCAT.

WA_FIELDCAT-fieldname = 'pstat'.

WA_FIELDCAT-seltext_m = 'Maintenance status'.

append WA_FIELDCAT to i_fieldcat.

clear WA_FIELDCAT.

WA_FIELDCAT-fieldname = 'dispr'.

WA_FIELDCAT-seltext_m = 'MRP Profile'.

append WA_FIELDCAT to i_fieldcat.

clear WA_FIELDCAT.

endform. "build_fieldcatalog_marc

&----


*& Form event_call_marc

&----


  • text

----


form event_call_marc.

CALL FUNCTION 'REUSE_ALV_EVENTS_GET'

EXPORTING

I_LIST_TYPE = 0

IMPORTING

ET_EVENTS = v_events_1

EXCEPTIONS

LIST_TYPE_WRONG = 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. "event_call_marc

&----


*& Form populate_events_marc

&----


  • text

----


form populate_events_marc.

read table v_events_1 into w_events_1 with key name = 'TOP_OF_PAGE'.

if sy-subrc = 0.

w_events-form = 'TOP_OF_PAGE'.

modify v_events_1 from w_events_1 transporting form where name = w_events-name.

endif.

endform. "populate_events_marc

&----


*& Form data_retrieval_marc

&----


  • text

----


form data_retrieval_marc.

SELECT MATNR

WERKS

PSTAT

DISPR

FROM MARC INTO CORRESPONDING FIELDS OF TABLE T_MARC

FOR ALL ENTRIES IN T_MARA WHERE MATNR = T_MARA-MATNR.

ENDFORM. "data_retrieval_marc

&----


*& Form build_listheader_marc

&----


  • text

----


  • -->T_LISTHEADER_1 text

----


form build_listheader_marc using t_listheader_1 type slis_t_listheader.

DATA HLINE TYPE SLIS_LISTHEADER.

HLINE-INFO = 'Second List'.

HLINE-TYP = 'H'.

APPEND HLINE TO T_LISTHEADER_1.

ENDFORM. "populate_events_mara

*FORM TOP_OF_PAGE_1.

*CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'

  • EXPORTING

  • IT_LIST_COMMENTARY = T_LISTHEADER_1

  • I_LOGO =

  • I_END_OF_LIST_GRID =

  • I_ALV_FORM =

  • .

  • *ENDFORM.

    form alv_grid_display_marc.

    I_REPID = SY-REPID.

    CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

    EXPORTING

    • I_INTERFACE_CHECK = ' '

    • I_BYPASSING_BUFFER = ' '

    • I_BUFFER_ACTIVE = ' '

    I_CALLBACK_PROGRAM = i_repid

    • I_CALLBACK_PF_STATUS_SET = ' '

    • I_CALLBACK_USER_COMMAND = ' '

    I_CALLBACK_TOP_OF_PAGE = 'TOP_OF_PAGE'

    • I_CALLBACK_HTML_TOP_OF_PAGE = ' '

    • I_CALLBACK_HTML_END_OF_LIST = ' '

    • I_STRUCTURE_NAME =

    • I_BACKGROUND_ID = ' '

    I_GRID_TITLE = t_mara_title

    • I_GRID_SETTINGS =

    • IS_LAYOUT =

    IT_FIELDCAT = I_FIELDCAT[]

    • IT_EXCLUDING =

    • IT_SPECIAL_GROUPS =

    • IT_SORT =

    • IT_FILTER =

    • IS_SEL_HIDE =

    • I_DEFAULT = 'X'

    • I_SAVE = ' '

    • IS_VARIANT =

    IT_EVENTS = V_EVENTS_1

    • IT_EVENT_EXIT =

    • IS_PRINT =

    • IS_REPREP_ID =

    • I_SCREEN_START_COLUMN = 0

    • I_SCREEN_START_LINE = 0

    • I_SCREEN_END_COLUMN = 0

    • I_SCREEN_END_LINE = 0

    • I_HTML_HEIGHT_TOP = 0

    • I_HTML_HEIGHT_END = 0

    • IT_ALV_GRAPHICS =

    • IT_HYPERLINK =

    • IT_ADD_FIELDCAT =

    • IT_EXCEPT_QINFO =

    • IR_SALV_FULLSCREEN_ADAPTER =

    • IMPORTING

    • E_EXIT_CAUSED_BY_CALLER =

    • ES_EXIT_CAUSED_BY_USER =

    TABLES

    T_OUTTAB = T_MARC

    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. "alv_grid_display_marc