I have written ABAP program by SAP Press book ABAP Basics listing 5.1 .
Everything is working fine except I am not able to display any icon for execute/delete operation which I added using slvc_fullscreen
from reuse_alv_grid_display
. I am not able to see even back button on the screen when I delete function. Any suggestions?
REPORT ZPTB00_HOTEL_RESERVATION_COOL.
TYPE-POOLS slis.
* main menu as selection screen
SELECTION-SCREEN BEGIN OF SCREEN 110.
SELECTION-SCREEN BEGIN OF BLOCK b110 WITH FRAME TITLE TEXT-001.
PARAMETERS:
p_add TYPE c RADIOBUTTON GROUP grp1 DEFAULT 'X',
p_delete TYPE c RADIOBUTTON GROUP grp1,
p_show TYPE c RADIOBUTTON GROUP grp1.
SELECTION-SCREEN END OF BLOCK b110.
SELECTION-SCREEN END OF SCREEN 110.
* input new reservation
SELECTION-SCREEN BEGIN OF SCREEN 120.
SELECTION-SCREEN BEGIN OF BLOCK b120 WITH FRAME TITLE TEXT-002.
PARAMETERS:
p_room TYPE zptb00_room_number VALUE CHECK,
p_chkin TYPE zptb00_check_in,
p_chkout TYPE zptb00_check_out,
p_name TYPE zptb00_customer_name.
SELECTION-SCREEN END OF BLOCK b120.
SELECTION-SCREEN END OF SCREEN 120.
DO.
CALL SELECTION-SCREEN 110.
IF sy-subrc <> 0.
EXIT.
ELSEIF p_add = 'X'.
PERFORM zptb00_hrc_add.
ELSEIF p_delete = 'X'.
PERFORM zptb00_hrc_delete.
ELSEIF p_show = 'X'.
PERFORM zptb00_hrc_show.
ENDIF.
ENDDO.
FORM zptb00_hrc_add.
DATA: l_str_reservation TYPE zptb00_hreservat,
l_tab_reservation TYPE STANDARD TABLE OF zptb00_hreservat.
* call input dailog
CALL SELECTION-SCREEN 120 STARTING AT 5 5.
IF sy-subrc = 0.
SELECT * FROM zptb00_hreservat INTO TABLE l_tab_reservation
WHERE ( room_number = p_room ) AND ( ( checkin BETWEEN p_chkin AND p_chkout ) OR ( checkout BETWEEN p_chkin AND p_chkout ) ).
IF sy-dbcnt > 0.
MESSAGE s000(zptb00_messages_alv).
ELSE.
CALL FUNCTION 'GUID_CREATE'
IMPORTING
ev_guid_32 = l_str_reservation-id.
l_str_reservation-room_number = p_room.
l_str_reservation-checkin = p_chkin.
l_str_reservation-checkout = p_chkout.
l_str_reservation-customername = p_name.
INSERT zptb00_hreservat FROM l_str_reservation.
MESSAGE s001(zptb00_messages_alv).
ENDIF.
ENDIF.
ENDFORM.
FORM zptb00_hrc_delete.
TYPES:
BEGIN OF t_mark,
mark TYPE c,
END OF t_mark,
BEGIN OF t_str_reservationx.
INCLUDE STRUCTURE zptb00_hreservat.
INCLUDE TYPE t_mark.
TYPES:
END OF t_str_reservationx.
DATA:
l_dis TYPE disvariant,
l_str_layout TYPE slis_layout_alv,
l_str_exit_by_user TYPE slis_exit_by_user,
l_tab_reservationx TYPE STANDARD TABLE OF t_str_reservationx,
l_str_reservationx TYPE t_str_reservationx,
l_tab_reservation TYPE STANDARD TABLE OF zptb00_hreservat,
l_count TYPE i.
FIELD-SYMBOLS:
<l_str_reservation> TYPE zptb00_hreservat,
<l_str_reservationx> TYPE t_str_reservationx.
SELECT * FROM zptb00_hreservat INTO TABLE l_tab_reservation.
LOOP AT l_tab_reservation ASSIGNING <l_str_reservation>.
MOVE-CORRESPONDING <l_str_reservation> TO l_str_reservationx.
APPEND l_str_reservationx TO l_tab_reservationx.
ENDLOOP.
l_str_layout-colwidth_optimize = 'X'.
l_str_layout-window_titlebar = TEXT-003.
l_str_layout-box_fieldname = 'MARK'.
l_dis-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = l_dis-report
i_callback_pf_status_set = 'CB_ALV_PF_SET_STATUS'
i_callback_user_command = 'CB_ALV_USER_COMMAND'
i_structure_name = 'ZPTB00_HRESERVAT'
is_layout = l_str_layout
i_default = 'X'
i_save = 'A'
is_variant = l_dis
IMPORTING
es_exit_caused_by_user = l_str_exit_by_user
TABLES
t_outtab = l_tab_reservationx
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.
CASE 'X'.
WHEN l_str_exit_by_user-exit.
LEAVE PROGRAM.
WHEN l_str_exit_by_user-back OR l_str_exit_by_user-cancel.
RETURN.
ENDCASE.
l_count = 0.
LOOP AT l_tab_reservationx ASSIGNING <l_str_reservationx>.
IF <l_str_reservationx>-mark = 'X'.
DELETE FROM zptb00_hreservat WHERE id = <l_str_reservationx>-id.
ENDIF.
ENDLOOP.
MESSAGE s002(zptb00_messages_alv) WITH l_count.
ENDFORM. " zptb00_hrc_delete
FORM zptb00_hrc_show.
DATA: l_dis TYPE disvariant,
l_rda_table TYPE REF TO data,
l_str_layout TYPE slis_layout_alv,
l_tab_reservation TYPE STANDARD TABLE OF zptb00_hreservat.
SELECT * FROM zptb00_hreservat INTO TABLE l_tab_reservation.
l_str_layout-colwidth_optimize = 'X'.
l_str_layout-window_titlebar = TEXT-004.
l_dis-report = sy-repid.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_structure_name = 'zptb00_hreservat'
is_layout = l_str_layout
i_save = 'A'
is_variant = l_dis
TABLES
t_outtab = l_tab_reservation
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.
FORM cb_alv_user_command USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
IF r_ucomm = 'EXECUTE'.
rs_selfield-exit = 'X'.
ENDIF.
ENDFORM.
FORM cb_alv_pf_status USING rt_extab TYPE slis_t_extab.
SET PF-STATUS 'STANDARD_FULLSCREEN' EXCLUDING rt_extab.
ENDFORM.
I don't know if I'm right but in the ' zptb00_hrc_delete ' form in the ' REUSE_ALV_GRID_DISPLAY ' function you set:
I_CALLBACK_PF_STATUS_SET = 'CB_ALV_PF_SET_STATUS'
However the ' CB_ALV_PF_SET_STATUS ' form doesn't exist. I think you misspelled the name of the form because there's a form called ' CB_ALV_PF_STATUS ' that seems to fit:
FORM cb_alv_pf_status USING rt_extab TYPE slis_t_extab.
SET pf-status 'STANDARD_FULLSCREEN' EXCLUDING rt_extab.
ENDFORM.
Let's try changing that in the ' REUSE_ALV_GRID_DISPLAY ' call like this:
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
I_CALLBACK_PROGRAM = l_dis-report
I_CALLBACK_PF_STATUS_SET = 'CB_ALV_PF_STATUS' " ---> 'CB_ALV_PF_SET_STATUS' replaced by 'CB_ALV_PF_STATUS'
I_CALLBACK_USER_COMMAND = 'CB_ALV_USER_COMMAND'
I_STRUCTURE_NAME = 'ZPTB00_HRESERVAT'
IS_LAYOUT = l_str_layout
I_DEFAULT = 'X'
I_SAVE = 'A'
IS_VARIANT = l_dis
IMPORTING
ES_EXIT_CAUSED_BY_USER = l_str_exit_by_user
TABLES
T_OUTTAB = l_tab_reservationx
EXCEPTIONS
PROGRAM_ERROR = 1
OTHERS = 2.
I'm assuming that ' STANDARD_FULLSCREEN ' GUI status exists. Check that please.
Another observation is that in the form ' zptb00_hrc_show ' you are you using lowercase in the ' i_structure_name ' parameter in function ' REUSE_ALV_GRID_DISPLAY ' but it should be uppercase.
Instead of:
i_structure_name = 'zptb00_hreservat'
It should be:
i_structure_name = 'ZPTB00_HRESERVAT'
Hope it helps
In your line 161 you set:
SET pf-status 'STANDARD_FULLSCREEN' EXCLUDING rt_extab.
nmiranda assume that 'STANDARD_FULLSCREEN' GUI status exists. I assume it does not exist.
Can you open your report with SE38, display the code ad make a double click on STANDARD_FULLSCREEN
. If you get a warning, that the status does not exist you identified the problem.
If the status exist: Did you define a button for delete?
If no -> define one. If you don't know how to do it, please post a comment. I will check if I can make a screenshot (sorry, actual I have no SAP available).
If you defined a button, please check i debugger the content of table rt_extab
. If it contains the user command of your delete-action, then the button is suppressed. (I found nothing in your code, that fills the table, just to be sure).
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.