AIM: Write a simple ALV list display using Functional module "REUSE_ALV_LIST_DISPLAY" and "REUSE_ALV_FIELDCATALOG_MERGE".
report Zalv_PRO10.
type-pools: SLIS.
types: begin of TP_MARA,
MATNR type MATNR,
ERSDA type ERSDA,
ERNAM type ERNAM,
LAEDA type LAEDA,
end of TP_MARA.
data IT_MARA type table of TP_MARA.
data WA_MARA type TP_MARA.
data IT_FIELDCAT type SLIS_T_FIELDCAT_ALV.
select MATNR
ERSDA
ERNAM
LAEDA
from MARA
into table IT_MARA up to 20 rows.
if IT_MARA is not initial.
perform FIELDCATLOG.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SYST-CPROG "system calling program
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_STRUCTURE_NAME = 'MARA' "table structure name
* IS_LAYOUT =
IT_FIELDCAT = IT_FIELDCAT "Fieldcate internal table name
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
I_SAVE = 'X' "Save option is enabled
* IS_VARIANT =
* IT_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
* IR_SALV_LIST_ADAPTER =
* IT_EXCEPT_QINFO =
* I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
T_OUTTAB = IT_MARA "internal table name
* 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.
endif.
*&---------------------------------------------------------------------*
*& Form FIELDCATLOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form FIELDCATLOG .
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
I_PROGRAM_NAME = SY-REPID "system program name
I_INTERNAL_TABNAME = 'IT_MARA' "internal table name
* I_STRUCTURE_NAME =
* I_CLIENT_NEVER_DISPLAY = 'X' "if you want the display client details ex:800
I_INCLNAME = SY-REPID "system program name
* I_BYPASSING_BUFFER = I_BUFFER_ACTIVE
changing
CT_FIELDCAT = IT_FIELDCAT "Fieldcate internal table name
exceptions
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
others = 3.
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. " FIELDCATLOG
report Zalv_PRO10.
type-pools: SLIS.
types: begin of TP_MARA,
MATNR type MATNR,
ERSDA type ERSDA,
ERNAM type ERNAM,
LAEDA type LAEDA,
end of TP_MARA.
data IT_MARA type table of TP_MARA.
data WA_MARA type TP_MARA.
data IT_FIELDCAT type SLIS_T_FIELDCAT_ALV.
select MATNR
ERSDA
ERNAM
LAEDA
from MARA
into table IT_MARA up to 20 rows.
if IT_MARA is not initial.
perform FIELDCATLOG.
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER =
* I_BUFFER_ACTIVE = ' '
I_CALLBACK_PROGRAM = SYST-CPROG "system calling program
* I_CALLBACK_PF_STATUS_SET = ' '
* I_CALLBACK_USER_COMMAND = ' '
* I_STRUCTURE_NAME = 'MARA' "table structure name
* IS_LAYOUT =
IT_FIELDCAT = IT_FIELDCAT "Fieldcate internal table name
* IT_EXCLUDING =
* IT_SPECIAL_GROUPS =
* IT_SORT =
* IT_FILTER =
* IS_SEL_HIDE =
* I_DEFAULT = 'X'
I_SAVE = 'X' "Save option is enabled
* IS_VARIANT =
* IT_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
* IR_SALV_LIST_ADAPTER =
* IT_EXCEPT_QINFO =
* I_SUPPRESS_EMPTY_DATA = ABAP_FALSE
* IMPORTING
* E_EXIT_CAUSED_BY_CALLER =
* ES_EXIT_CAUSED_BY_USER =
tables
T_OUTTAB = IT_MARA "internal table name
* 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.
endif.
*&---------------------------------------------------------------------*
*& Form FIELDCATLOG
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
form FIELDCATLOG .
call function 'REUSE_ALV_FIELDCATALOG_MERGE'
exporting
I_PROGRAM_NAME = SY-REPID "system program name
I_INTERNAL_TABNAME = 'IT_MARA' "internal table name
* I_STRUCTURE_NAME =
* I_CLIENT_NEVER_DISPLAY = 'X' "if you want the display client details ex:800
I_INCLNAME = SY-REPID "system program name
* I_BYPASSING_BUFFER = I_BUFFER_ACTIVE
changing
CT_FIELDCAT = IT_FIELDCAT "Fieldcate internal table name
exceptions
INCONSISTENT_INTERFACE = 1
PROGRAM_ERROR = 2
others = 3.
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. " FIELDCATLOG
1 comments :
commentswhen excecuted the above program,it is unfortunately terminated. please help.
Reply