*&---------------------------------------------------------------------*
*& Report Z_ALV_REPORT
*&
*&---------------------------------------------------------------------*
*&Author tech sap29@gmail.com
*&
*&---------------------------------------------------------------------*
REPORT Z_ALV_REPORT.
TYPE-POOLS SLIS.
TYPES : BEGIN OF TY_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
LAEDA TYPE MARA-LAEDA,
AENAM TYPE MARA-AENAM,
VPSTA TYPE MARA-VPSTA,
PSTAT TYPE MARA-PSTAT,
LVORM TYPE MARA-LVORM,
MTART TYPE MARA-MTART,
MBRSH TYPE MARA-MBRSH,
END OF TY_MARA.
DATA : IT_MARA TYPE TABLE OF TY_MARA,
WA_MARA TYPE TY_MARA.
DATA : IT_FIELDCAT TYPE slis_t_fieldcat_alv,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA :IT_EVENT TYPE SLIS_T_EVENT ,
WA_EVENT TYPE SLIS_ALV_EVENT .
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS S_MATNR FOR WA_MARA-MATNR .
SELECTION-SCREEN END OF BLOCK B1 .
PERFORM GET_DATA .
PERFORM FILL_EVENT.
PERFORM FILL_FIELDCAT.
PERFORM DISPLAY_DATA .
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
FORM GET_DATA .
SELECT MATNR
ERSDA
ERNAM
LAEDA
AENAM
VPSTA
PSTAT
LVORM
MTART
MBRSH INTO TABLE IT_MARA FROM MARA WHERE MATNR IN S_MATNR.
ENDFORM. " GET_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY_DATA
*&---------------------------------------------------------------------*
FORM DISPLAY_DATA .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-CPROG
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME = 'MARA'
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
IT_FIELDCAT = IT_FIELDCAT
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
IT_EVENTS = IT_EVENT
* 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 = IT_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. " DISPLAY_DATA
*&---------------------------------------------------------------------*
*& Form FILL_FIELDCAT
*&---------------------------------------------------------------------*
FORM FILL_FIELDCAT .
CLEAR WA_FIELDCAT.
WA_FIELDCAT-col_pos = 0.
WA_FIELDCAT-fieldname = 'MATNR'.
WA_FIELDCAT-outputlen = 10.
WA_FIELDCAT-seltext_m = 'Material Number'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 1.
WA_FIELDCAT-fieldname = 'ERSDA'.
WA_FIELDCAT-outputlen = 8.
WA_FIELDCAT-seltext_m = 'Created On'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 2.
WA_FIELDCAT-fieldname = 'ERNAM'.
WA_FIELDCAT-outputlen = 12.
WA_FIELDCAT-seltext_m = 'Name of Person who Created'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 3.
WA_FIELDCAT-fieldname = 'LAEDA'.
WA_FIELDCAT-outputlen = 8.
WA_FIELDCAT-seltext_m = 'Date of Last Change'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 4.
WA_FIELDCAT-fieldname = 'AENAM'.
WA_FIELDCAT-outputlen = 12.
WA_FIELDCAT-seltext_m = 'Name of Person Who Changed'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 5.
WA_FIELDCAT-fieldname = 'VPSTA'.
WA_FIELDCAT-outputlen = 15.
WA_FIELDCAT-seltext_m = 'Maintenance status of complete material'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 6.
WA_FIELDCAT-fieldname = 'PSTAT'.
WA_FIELDCAT-outputlen = 15.
WA_FIELDCAT-seltext_m = 'Maintenance status '.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 7.
WA_FIELDCAT-fieldname = 'LVORM'.
WA_FIELDCAT-outputlen = 1.
WA_FIELDCAT-seltext_m = 'Deletion at Client Level'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 8.
WA_FIELDCAT-fieldname = 'MTART'.
WA_FIELDCAT-outputlen = 4.
WA_FIELDCAT-seltext_m = 'Material Type'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 9.
WA_FIELDCAT-fieldname = 'MBRSH'.
WA_FIELDCAT-outputlen = 1.
WA_FIELDCAT-seltext_m = 'Industry sector'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
ENDFORM. " FILL_FIELDCAT
*&---------------------------------------------------------------------*
*& Form FILL_EVENT
*&---------------------------------------------------------------------*
FORM FILL_EVENT .
WA_EVENT-NAME = 'TOP_OF_PAGE'.
WA_EVENT-FORM = 'PRINT_HEADING'.
APPEND WA_EVENT TO IT_EVENT .
WA_EVENT-NAME = 'ÉND_OF_PAGE'.
WA_EVENT-FORM = 'END_OF_PAGE'.
APPEND WA_EVENT TO IT_EVENT .
ENDFORM. " FILL_EVENT
FORM PRINT_HEADING.
DATA :IT_HEADING TYPE SLIS_T_LISTHEADER,
WA_HEADING LIKE LINE OF IT_HEADING .
WA_HEADING-TYP = 'H'.
WA_HEADING-INFO = 'LIST OF MATERIAL DESCRIPTION '.
APPEND WA_HEADING TO IT_HEADING .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_HEADING
* I_LOGO =
* I_END_OF_LIST_GRID = IT_FOOTER
* I_ALV_FORM =
.
ENDFORM .
FORM END_OF_PAGE .
DATA : IT_FOOTER TYPE SLIS_T_LISTHEADER,
WA_FOOTER LIKE LINE OF IT_FOOTER.
WA_FOOTER-TYP = 'S'.
WA_FOOTER-INFO = 'SBR Softtech Pvt Ltd' .
APPEND WA_FOOTER TO IT_FOOTER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_FOOTER
* I_LOGO =
* I_END_OF_LIST_GRID = IT_FOOTER
* I_ALV_FORM =
.
ENDFORM.
*& Report Z_ALV_REPORT
*&
*&---------------------------------------------------------------------*
*&Author tech sap29@gmail.com
*&
*&---------------------------------------------------------------------*
REPORT Z_ALV_REPORT.
TYPE-POOLS SLIS.
TYPES : BEGIN OF TY_MARA,
MATNR TYPE MARA-MATNR,
ERSDA TYPE MARA-ERSDA,
ERNAM TYPE MARA-ERNAM,
LAEDA TYPE MARA-LAEDA,
AENAM TYPE MARA-AENAM,
VPSTA TYPE MARA-VPSTA,
PSTAT TYPE MARA-PSTAT,
LVORM TYPE MARA-LVORM,
MTART TYPE MARA-MTART,
MBRSH TYPE MARA-MBRSH,
END OF TY_MARA.
DATA : IT_MARA TYPE TABLE OF TY_MARA,
WA_MARA TYPE TY_MARA.
DATA : IT_FIELDCAT TYPE slis_t_fieldcat_alv,
WA_FIELDCAT TYPE SLIS_FIELDCAT_ALV.
DATA :IT_EVENT TYPE SLIS_T_EVENT ,
WA_EVENT TYPE SLIS_ALV_EVENT .
SELECTION-SCREEN BEGIN OF BLOCK B1 WITH FRAME TITLE TEXT-001.
SELECT-OPTIONS S_MATNR FOR WA_MARA-MATNR .
SELECTION-SCREEN END OF BLOCK B1 .
PERFORM GET_DATA .
PERFORM FILL_EVENT.
PERFORM FILL_FIELDCAT.
PERFORM DISPLAY_DATA .
*&---------------------------------------------------------------------*
*& Form GET_DATA
*&---------------------------------------------------------------------*
FORM GET_DATA .
SELECT MATNR
ERSDA
ERNAM
LAEDA
AENAM
VPSTA
PSTAT
LVORM
MTART
MBRSH INTO TABLE IT_MARA FROM MARA WHERE MATNR IN S_MATNR.
ENDFORM. " GET_DATA
*&---------------------------------------------------------------------*
*& Form DISPLAY_DATA
*&---------------------------------------------------------------------*
FORM DISPLAY_DATA .
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SY-CPROG
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_CALLBACK_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME = 'MARA'
* I_BACKGROUND_ID = ' '
* I_GRID_TITLE =
* I_GRID_SETTINGS =
* IS_LAYOUT =
IT_FIELDCAT = IT_FIELDCAT
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
* I_SAVE = ' '
* IS_VARIANT =
IT_EVENTS = IT_EVENT
* 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 = IT_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. " DISPLAY_DATA
*&---------------------------------------------------------------------*
*& Form FILL_FIELDCAT
*&---------------------------------------------------------------------*
FORM FILL_FIELDCAT .
CLEAR WA_FIELDCAT.
WA_FIELDCAT-col_pos = 0.
WA_FIELDCAT-fieldname = 'MATNR'.
WA_FIELDCAT-outputlen = 10.
WA_FIELDCAT-seltext_m = 'Material Number'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 1.
WA_FIELDCAT-fieldname = 'ERSDA'.
WA_FIELDCAT-outputlen = 8.
WA_FIELDCAT-seltext_m = 'Created On'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 2.
WA_FIELDCAT-fieldname = 'ERNAM'.
WA_FIELDCAT-outputlen = 12.
WA_FIELDCAT-seltext_m = 'Name of Person who Created'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 3.
WA_FIELDCAT-fieldname = 'LAEDA'.
WA_FIELDCAT-outputlen = 8.
WA_FIELDCAT-seltext_m = 'Date of Last Change'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 4.
WA_FIELDCAT-fieldname = 'AENAM'.
WA_FIELDCAT-outputlen = 12.
WA_FIELDCAT-seltext_m = 'Name of Person Who Changed'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 5.
WA_FIELDCAT-fieldname = 'VPSTA'.
WA_FIELDCAT-outputlen = 15.
WA_FIELDCAT-seltext_m = 'Maintenance status of complete material'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 6.
WA_FIELDCAT-fieldname = 'PSTAT'.
WA_FIELDCAT-outputlen = 15.
WA_FIELDCAT-seltext_m = 'Maintenance status '.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 7.
WA_FIELDCAT-fieldname = 'LVORM'.
WA_FIELDCAT-outputlen = 1.
WA_FIELDCAT-seltext_m = 'Deletion at Client Level'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 8.
WA_FIELDCAT-fieldname = 'MTART'.
WA_FIELDCAT-outputlen = 4.
WA_FIELDCAT-seltext_m = 'Material Type'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
WA_FIELDCAT-col_pos = 9.
WA_FIELDCAT-fieldname = 'MBRSH'.
WA_FIELDCAT-outputlen = 1.
WA_FIELDCAT-seltext_m = 'Industry sector'.
APPEND WA_FIELDCAT TO IT_FIELDCAT .
ENDFORM. " FILL_FIELDCAT
*&---------------------------------------------------------------------*
*& Form FILL_EVENT
*&---------------------------------------------------------------------*
FORM FILL_EVENT .
WA_EVENT-NAME = 'TOP_OF_PAGE'.
WA_EVENT-FORM = 'PRINT_HEADING'.
APPEND WA_EVENT TO IT_EVENT .
WA_EVENT-NAME = 'ÉND_OF_PAGE'.
WA_EVENT-FORM = 'END_OF_PAGE'.
APPEND WA_EVENT TO IT_EVENT .
ENDFORM. " FILL_EVENT
FORM PRINT_HEADING.
DATA :IT_HEADING TYPE SLIS_T_LISTHEADER,
WA_HEADING LIKE LINE OF IT_HEADING .
WA_HEADING-TYP = 'H'.
WA_HEADING-INFO = 'LIST OF MATERIAL DESCRIPTION '.
APPEND WA_HEADING TO IT_HEADING .
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_HEADING
* I_LOGO =
* I_END_OF_LIST_GRID = IT_FOOTER
* I_ALV_FORM =
.
ENDFORM .
FORM END_OF_PAGE .
DATA : IT_FOOTER TYPE SLIS_T_LISTHEADER,
WA_FOOTER LIKE LINE OF IT_FOOTER.
WA_FOOTER-TYP = 'S'.
WA_FOOTER-INFO = 'SBR Softtech Pvt Ltd' .
APPEND WA_FOOTER TO IT_FOOTER.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
IT_LIST_COMMENTARY = IT_FOOTER
* I_LOGO =
* I_END_OF_LIST_GRID = IT_FOOTER
* I_ALV_FORM =
.
ENDFORM.
No comments:
Post a Comment