Biraz dandik bir yöntem ama basit ve kullanışlı…
DATA: BEGIN OF LS_LOG,
METIN(255),
END OF LS_LOG,
LT_LOG LIKE TABLE OF LS_LOG.
…
IF LT_LOG[] IS NOT INITIAL.
PERFORM LT_LOG_GOSTER TABLES LT_LOG.
ENDIF.
*&---------------------------------------------------------------------*
*& Form LT_LOG_GOSTER
*&---------------------------------------------------------------------*
FORM LT_LOG_GOSTER TABLES P_LT_LOG STRUCTURE TY_LOG.
DATA: LS_FIELDCAT TYPE SLIS_FIELDCAT_ALV,
LT_FIELDCAT TYPE SLIS_T_FIELDCAT_ALV,
LS_FIELDCATLOG TYPE SLIS_FIELDCAT_ALV,
LT_FIELDCATLOG TYPE SLIS_T_FIELDCAT_ALV,
LT_LAYOUT TYPE SLIS_LAYOUT_ALV.
CLEAR LS_FIELDCATLOG.
LS_FIELDCATLOG-ROW_POS = '1'.
LS_FIELDCATLOG-COL_POS = '1'.
LS_FIELDCATLOG-FIELDNAME = 'METIN'.
LS_FIELDCATLOG-TABNAME = 'P_LT_LOG'.
LS_FIELDCATLOG-SELTEXT_M = 'Log'.
APPEND LS_FIELDCATLOG TO LT_FIELDCATLOG.
LT_LAYOUT-ZEBRA = 'X'.
LT_LAYOUT-COLWIDTH_OPTIMIZE = 'X'.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = SY-REPID
I_GRID_TITLE = 'Log'
IS_LAYOUT = LT_LAYOUT
IT_FIELDCAT = LT_FIELDCATLOG
I_SCREEN_START_COLUMN = 10
I_SCREEN_START_LINE = 20
I_SCREEN_END_COLUMN = 100
I_SCREEN_END_LINE = 40
TABLES
T_OUTTAB = P_LT_LOG
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. " LT_LOG_GOSTER
Hiç yorum yok:
Yorum Gönder