TYPE-POOLS: slis.
DATA: x_fieldcat TYPE slis_fieldcat_alv,
it_fieldcat TYPE slis_t_fieldcat_alv,
l_layout TYPE slis_layout_alv,
x_events TYPE slis_alv_event,
it_events TYPE slis_t_event.
DATA: BEGIN OF itab OCCURS 0,
ebeln LIKE ekko-ebeln,
ebelp LIKE ekpo-ebelp,
chk(1),
color(4),
END OF itab.
x_fieldcat-fieldname = 'CHK'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 1.
x_fieldcat-input = 'X'.
x_fieldcat-edit = 'X'.
x_fieldcat-checkbox = 'X'.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'EBELN'.
x_fieldcat-seltext_l = 'EBELN'.
x_fieldcat-hotspot = 'X'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 2.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
x_fieldcat-fieldname = 'EBELP'.
x_fieldcat-seltext_l = 'EBELP'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 3.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.
perform get_data_anddisp.
*-Have a subroutine to get the data and display the daya
form get_data_anddisp.
SELECT ebeln
ebelp
FROM vbap
UP TO 20 ROWS
INTO TABLE itab.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = sy-repid
is_layout = l_layout
i_callback_user_command = 'USER_COMMAND'
it_fieldcat = it_fieldcat
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
endform.
*&---------------------------------------------------------------------*
*& 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 ucomm.
WHEN '&IC1'.
if rs_selfield -fieldname = 'EBELN'.
"change the intenal table decalrations
SET PARAMETER ID 'BES' FIELD rs_selfield-value.
CALL TRANSACTION 'ME22N' AND SKIP FIRST SCREEN.
ENDCASE.
" these are important.
rs_selfield-refresh = 'X'.
rs_selfield-exit = 'X'.
*-now recall the data getting and Redisplaying
perform get_data_anddisp.
endif.
ENDFORM. "USER_COMMAND
ALSO READ;
- ALV Header With Logo.
- Including Line After Subtotal In ALV Display.
- ALV Subtotals In Different Blocks.
- ALV With Page Numbers & Subtotals.
..... Back To Index On ALV List/ Grid Display.
..... Back To MAIN INDEX.
No comments:
Post a Comment