Google Search - Blog...........

Showing posts with label function module fm REUSE_ALV_POPUP_TO_SELECT. Show all posts
Showing posts with label function module fm REUSE_ALV_POPUP_TO_SELECT. Show all posts

ABAP - Pop Up Window With Check Box.

REPORT ztest_alv_check MESSAGE-ID zz .

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,
vbeln LIKE vbak-vbeln,
posnr LIKE vbap-posnr,
chk(1),
color(4),
END OF itab.

SELECT vbeln
posnr
FROM vbap
UP TO 20 ROWS
INTO TABLE 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 = 'VBELN'.
x_fieldcat-seltext_l = 'VBELN'.
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 = 'POSNR'.
x_fieldcat-seltext_l = 'POSNR'.
x_fieldcat-tabname = 'ITAB'.
x_fieldcat-col_pos = 3.
APPEND x_fieldcat TO it_fieldcat.
CLEAR x_fieldcat.


DATA selfield TYPE slis_selfield.
CALL FUNCTION 'REUSE_ALV_POPUP_TO_SELECT'
EXPORTING
i_title = 'Select Data'
i_selection = 'X'
i_zebra = 'X'
i_screen_start_column = 5
i_screen_start_line = 5
i_screen_end_column = 50
i_screen_end_line = 10
i_checkbox_fieldname = 'CHK'
i_tabname = 'ITAB'
i_scroll_to_sel_line = 'X'
it_fieldcat = it_fieldcat
i_callback_program = sy-repid
i_callback_user_command = 'USER_COMMAND'
IMPORTING
es_selfield = selfield
TABLES
t_outtab = itab
EXCEPTIONS
program_error = 1.

*&---------------------------------------------------------------------*
*& Form STATUS
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_EXTAB text
*----------------------------------------------------------------------*
FORM status USING p_extab TYPE slis_t_extab.

SET PF-STATUS 'STATUS'.
ENDFORM. " STATUS

*&---------------------------------------------------------------------*
*& Form USER_COMMAND
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->R_UCOMM text
* -->RS_SELFIELD text
*----------------------------------------------------------------------*
FORM user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.

DATA: gd_repid LIKE sy-repid, "Exists
ref_grid TYPE REF TO cl_gui_alv_grid.
IF ref_grid IS INITIAL.
CALL FUNCTION 'GET_GLOBALS_FROM_SLVC_FULLSCR'
IMPORTING
e_grid = ref_grid.
ENDIF.
IF NOT ref_grid IS INITIAL.
CALL METHOD ref_grid->check_changed_data .
ENDIF.

LOOP AT itab WHERE chk = 'X'.
itab-color = 'C300'.
MODIFY itab INDEX sy-tabix TRANSPORTING color.
ENDLOOP.
rs_selfield-refresh = 'X'.
BREAK-POINT.

ENDFORM. "USER_COMMAND


ALSO READ:

- F4 (Value On Request) For Parameter On Selection Screen.

- Updating Value Of Another Field On The Selection Screen.

- Complex Selection Screen (Using Macros).

- Printing Selection Screen Data On The Report Output.

- Creating The Listbox Using Macros.

..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.

ABAP - Display Report Program In Different Formats

report zalv_sample .

tables vbak.

data it_vbak like vbak occurs 0 with header line.

selection-screen begin of block b1 with frame.
parameters: list radiobutton group alv, "REUSE_ALV_LIST_DISPLAY
popup radiobutton group alv, "REUSE_ALV_POPUP_TO_SELECT
grid radiobutton group alv, "REUSE_ALV_GRID_DISPLAY
normal radiobutton group alv. " NORMAL DISPLAY
selection-screen end of block b1.

select * from vbak
into corresponding fields of table it_vbak
up to 10 rows.

if list = 'X'.
perform alv_func1.

elseif popup = 'X'.
perform alv_func2.

elseif grid = 'X'.
perform alv_func3.

elseif normal = 'X'.
perform norm.

endif.

*&---------------------------------------------------------------------*
*& Form ALV_FUNC1
*&---------------------------------------------------------------------*
form alv_func1 .


call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_structure_name = 'VBAK'
tables
t_outtab = it_vbak
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. " ALV_FUNC1



*&---------------------------------------------------------------------*
*& Form ALV_FUNC2
*&---------------------------------------------------------------------*
form alv_func2 .

call function 'REUSE_ALV_POPUP_TO_SELECT'
exporting
i_title = 'SALES ORDER INFO'
i_zebra = 'X'
i_tabname = 1
i_structure_name = 'vbak'
tables
t_outtab = it_vbak
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. " ALV_FUNC2



*&---------------------------------------------------------------------*
*& Form ALV_FUNC3
*&---------------------------------------------------------------------*
form alv_func3 .

call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_structure_name = 'vbak'
i_grid_title = 'SALES ORDER INFO'
tables
t_outtab = it_vbak
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. " ALV_FUNC3

*&---------------------------------------------------------------------*
*& Form NORM
*&---------------------------------------------------------------------*
form norm .
format intensified.
skip 1.
write: /'SALES DOC.',
' Created on ',
' Time',
' Created by',
' Valid from ',
' Sold-to party'.
format intensified off.
skip 2.

loop at it_vbak.

write: / it_vbak-vbeln,' ',
it_vbak-erdat,' ',
it_vbak-erzet,' ',
it_vbak-ernam,' ',
it_vbak-angdt,' ',
it_vbak-kunnr.

endloop.


ALSO READ:

- ALV Pop Up To Select The Options & Display Them.

- Example On Blocking ALV List/Grid Display.

- Change The Layout Of The ALV List/Grid Display.

- Add Color In ALV List/Grid Display.

- Use Of Double Click On ALV Grid/List Display.

..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.

ABAP - ALV Pop Up Screen To Select.

report ztest.

type-pools: slis.

data: begin of i_outtab occurs 0.
include structure sflight.
data: w_chk type c. "For multiple selection
data: end of i_outtab.

data: i_private type slis_data_caller_exit,
i_selfield type slis_selfield,
w_exit(1) type c.

parameters: p_title type sy-title.

start-of-selection.

select * from sflight into table i_outtab.

call function 'REUSE_ALV_POPUP_TO_SELECT'
exporting
i_title = p_title
i_selection = 'X'
i_zebra = 'X'
i_checkbox_fieldname = 'W_CHK'
i_tabname = 'I_OUTTAB'
i_structure_name = 'SFLIGHT'
importing
es_selfield = i_selfield
e_exit = w_exit
tables
t_outtab = i_outtab
exceptions
program_error = 1
others = 2.


loop at i_outtab where w_chk = 'X'.
write: / i_outtab-carrid, i_outtab-price.


ALSO READ:

- ALV Heading At Center & At The End Of Page.

- ALV Blocked In HR ABAP.

- ALV With Some Columns In Bold Letters.

- ALV Data In Different Languages.


..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.



ABAP - ALV Pop Up To Select The Options & Display Them

report zalv_sample .

tables vbak.

data it_vbak like vbak occurs 0 with header line.

selection-screen begin of block b1 with frame.
parameters: alv1 radiobutton group alv, "REUSE_ALV_LIST_DISPLAY
alv2 radiobutton group alv, "REUSE_ALV_POPUP_TO_SELECT
alv3 radiobutton group alv, "REUSE_ALV_GRID_DISPLAY
alv4 radiobutton group alv. " NORMAL DISPLAY
selection-screen end of block b1.

select * from vbak
into corresponding fields of table it_vbak
up to 10 rows.
if alv1 = 'X'. perform alv_func1.
elseif alv2 = 'X'. perform alv_func2.
elseif alv3 = 'X'. perform alv_func3.
elseif alv4 = 'X'. perform norm.
endif.
*&---------------------------------------------------------------------
**& Form ALV_FUNC1
*&---------------------------------------------------------------------
*form alv_func1 .
call function 'REUSE_ALV_LIST_DISPLAY'
exporting
i_structure_name = 'VBAK'
tables
t_outtab = it_vbak
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. " ALV_FUNC1

*&---------------------------------------------------------------------
**& Form ALV_FUNC2
*&---------------------------------------------------------------------
*form alv_func2 .
call function 'REUSE_ALV_POPUP_TO_SELECT'
exporting
i_title = 'SALES ORDER INFO'
i_zebra = 'X'
i_tabname = 1
i_structure_name = 'vbak'
tables
t_outtab = it_vbak
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. " ALV_FUNC2

*&---------------------------------------------------------------------
**& Form ALV_FUNC3
*&---------------------------------------------------------------------
*form alv_func3 .
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_structure_name = 'vbak'
i_grid_title = 'SALES ORDER INFO'
tables
t_outtab = it_vbak
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. " ALV_FUNC3
*&---------------------------------------------------------------------
**& Form NORM
*&---------------------------------------------------------------------
*form norm .
format intensified.
skip 1.
write: /'SALES DOC.',
' Created on ',
' Time',
' Created by',
' Valid from ',
' Sold-to party'.
format intensified off. skip 2.
loop at it_vbak.
write: / it_vbak-vbeln,
it_vbak-erdat,
it_vbak-erzet,
it_vbak-ernam,
it_vbak-angdt,
it_vbak-kunnr.
endloop.

endform. " FORM

ALSO READ:

- Example On Blocking ALV List/Grid Display.

- Change The Layout Of The ALV List/Grid Display.

- Add Color In ALV List/Grid Display.

- Use Of Double Click On ALV Grid/List Display.


..... Back To Index On ALV List/ Grid Display.

..... Back To MAIN INDEX.



Related Topics:

- ALV in a Pop up window and ALV in a dialog box.

- All About FM REUSE_ALV_POPUP_TO_SELECT.