Tuesday, April 9, 2013

What is SLIS in ALV

SLIS is the type library for ALV grid.

If you'll use the ALV you have to add TYPE-POOLS : SLIS. command at the beginning of your code.
   
Consider these :
slis_t_fieldcat_alv is containing "_t_"
It means that it is an internal table and slis_fieldcat_alv is header line of that.
   
Here is a practical example for alv grid :
Just think that you have an internal table named 'ITAB' to show.
   
Step1  :  First add these lines to your code :

TYPE-POOLS : SLIS.
  
DATA ALV_PROG_NAME LIKE SY-REPID.
ALV_PROG_NAME = SY-REPID.
  
DATA : ALV_ITAB_NAME(30),
L_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV.
ALV_ITAB_NAME = 'ITAB'.  "!!Write here the name of your internal table
   
Step 2 : Add these two function :
The first function is filling the fieldcat L_FIELDCAT that you described, second is showing it on the screen.
   
CALL FUNCTION 'REUSE_ALV_FIELDCATALOG_MERGE'
  EXPORTING
  I_PROGRAM_NAME = ALV_PROG_NAME
  I_INTERNAL_TABNAME = ALV_ITAB_NAME
  * I_STRUCTURE_NAME =
  * I_CLIENT_NEVER_DISPLAY = 'X'
  I_INCLNAME = ALV_PROG_NAME
  * I_BYPASSING_BUFFER =
  * I_BUFFER_ACTIVE =
  CHANGING
  CT_FIELDCAT = L_FIELDCAT
  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.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
  EXPORTING
  * I_INTERFACE_CHECK = ' '
  * I_BYPASSING_BUFFER =
  * I_BUFFER_ACTIVE = ' '
  I_CALLBACK_PROGRAM = ALV_PROG_NAME
  * 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 =
  * I_BACKGROUND_ID = ' '
  * I_GRID_TITLE =
  * I_GRID_SETTINGS =
  * IS_LAYOUT =
  IT_FIELDCAT = L_FIELDCAT
  * IT_EXCLUDING =
  * IT_SPECIAL_GROUPS =
  * IT_SORT =
  * IT_FILTER =
  * IS_SEL_HIDE =
  * I_DEFAULT = 'X'
  * I_SAVE = ' '
  * 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
  * IT_ALV_GRAPHICS =
  * IT_ADD_FIELDCAT =
  * IT_HYPERLINK =
  * I_HTML_HEIGHT_TOP =
  * I_HTML_HEIGHT_END =
  * IT_EXCEPT_QINFO =
  * IMPORTING
  * E_EXIT_CAUSED_BY_CALLER =
  * ES_EXIT_CAUSED_BY_USER =
  TABLES
  T_OUTTAB = ITAB[]   "Write here the name of your internal table + []
  * 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.                               

No comments:

Post a Comment