Wednesday, February 18, 2009
Thursday, February 12, 2009
Commands & Useful Tips
SHIFT l_dat_enc LEFT DELETING LEADING space.
-------------------------------------------------
READ TABLE p_t_wiqmfe INTO p_wa_wiqmfe INDEX 1.
-------------------------------------------------
DESCRIBE TABLE gt_vpind LINES lv_lines.
-------------------------------------------------
REPLACE ' ' WITH '0' INTO l_kd_rk.
REPLACE ALL OCCURRENCES OF '"' IN v_char WITH space.
CONDENSE v_char.
-------------------------------------------------
set pf-status 'STANDRAD' excluding rt_extab.
-------------------------------------------------
DATA text TYPE string VALUE `I know you know`.
SHIFT text RIGHT DELETING TRAILING 'know'.
output: I know you
------------------------------------------------
modify t2 index idx from st_r
transporting a b c .
FOR EXCLUDING STANDARD BUTTON FROM ALV TOOLBAR
DATA : it_exclude TYPE slis_t_extab,
wa_exclude TYPE slis_extab.
*&---------------------------------------------------------------------*
* FOR EXCLUDING STANDARD BUTTONS FROM ALV TOOLBAR
*&---------------------------------------------------------------------*
wa_exclude-fcode = '&OUP'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&ODN'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&OAD'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&INFO'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
*--similarly append other function codes of the buttons that you want to exclude
*--and pass this internal table to FM REUSE_ALV_GRID_DISPLAY
*&---------------------------------------------------------------------*
* DISPLAY RECORDS IN ALV GRID
*&---------------------------------------------------------------------*
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = rep_id
* i_callback_pf_status_set = 'PF'
i_callback_user_command = 'COMMAND'
i_callback_top_of_page = 'TOP'
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
i_grid_title = wa_title
* I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_field
it_excluding = it_exclude "excule buttons
* IT_SPECIAL_GROUPS =
--------------------------------------------------------------------------------------------
DATA : tab TYPE rstabfield.
ranges : r_vbeln for vbap-vbeln.
tab-tablename = 'VBAP'.
tab-fieldname = 'VBELN'.
CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'
EXPORTING
title = text-002
text = ' '
signed = 'X'
lower_case = 'X'
no_interval_check = 'X'
* just_display = 'X'
* just_incl = 'X'
* excluded_options = 'X'
* description =
* help_field =
* search_help =
tab_and_field = tab
TABLES
range = r_vbeln
EXCEPTIONS
no_range_tab = 1
cancelled = 2
internal_error = 3
invalid_fieldname = 4
OTHERS = 5.
IF sy-subrc EQ 2.
MESSAGE s899 WITH text-003. "no value selected
ELSEIF sy-subrc = 0 AND sy-subrc = 2.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
-------------------------------------------------
READ TABLE p_t_wiqmfe INTO p_wa_wiqmfe INDEX 1.
-------------------------------------------------
DESCRIBE TABLE gt_vpind LINES lv_lines.
-------------------------------------------------
REPLACE ' ' WITH '0' INTO l_kd_rk.
REPLACE ALL OCCURRENCES OF '"' IN v_char WITH space.
CONDENSE v_char.
-------------------------------------------------
set pf-status 'STANDRAD' excluding rt_extab.
-------------------------------------------------
DATA text TYPE string VALUE `I know you know`.
SHIFT text RIGHT DELETING TRAILING 'know'.
output: I know you
------------------------------------------------
modify t2 index idx from st_r
transporting a b c .
FOR EXCLUDING STANDARD BUTTON FROM ALV TOOLBAR
DATA : it_exclude TYPE slis_t_extab,
wa_exclude TYPE slis_extab.
*&---------------------------------------------------------------------*
* FOR EXCLUDING STANDARD BUTTONS FROM ALV TOOLBAR
*&---------------------------------------------------------------------*
wa_exclude-fcode = '&OUP'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&ODN'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&OAD'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
wa_exclude-fcode = '&INFO'.
APPEND wa_exclude TO it_exclude.
CLEAR wa_exclude.
*--similarly append other function codes of the buttons that you want to exclude
*--and pass this internal table to FM REUSE_ALV_GRID_DISPLAY
*&---------------------------------------------------------------------*
* DISPLAY RECORDS IN ALV GRID
*&---------------------------------------------------------------------*
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
* I_INTERFACE_CHECK = ' '
* I_BYPASSING_BUFFER = ' '
* I_BUFFER_ACTIVE = ' '
i_callback_program = rep_id
* i_callback_pf_status_set = 'PF'
i_callback_user_command = 'COMMAND'
i_callback_top_of_page = 'TOP'
* I_CALLBACK_HTML_TOP_OF_PAGE = ' '
* I_CALLBACK_HTML_END_OF_LIST = ' '
* I_STRUCTURE_NAME =
* I_BACKGROUND_ID = ' '
i_grid_title = wa_title
* I_GRID_SETTINGS =
is_layout = wa_layout
it_fieldcat = it_field
it_excluding = it_exclude "excule buttons
* IT_SPECIAL_GROUPS =
--------------------------------------------------------------------------------------------
DATA : tab TYPE rstabfield.
ranges : r_vbeln for vbap-vbeln.
tab-tablename = 'VBAP'.
tab-fieldname = 'VBELN'.
CALL FUNCTION 'COMPLEX_SELECTIONS_DIALOG'
EXPORTING
title = text-002
text = ' '
signed = 'X'
lower_case = 'X'
no_interval_check = 'X'
* just_display = 'X'
* just_incl = 'X'
* excluded_options = 'X'
* description =
* help_field =
* search_help =
tab_and_field = tab
TABLES
range = r_vbeln
EXCEPTIONS
no_range_tab = 1
cancelled = 2
internal_error = 3
invalid_fieldname = 4
OTHERS = 5.
IF sy-subrc EQ 2.
MESSAGE s899 WITH text-003. "no value selected
ELSEIF sy-subrc = 0 AND sy-subrc = 2.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
read a file from directory using cl_gui_frontend_services
DATA: v_rc TYPE i.
DATA: lt_filetab TYPE filetable.
DATA: ls_filetab LIKE LINE OF lt_filetab.
PARAMETERS: p_file TYPE localfile.
AT SELECTION-SCREEN on VALUE-REQUEST FOR p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
CHANGING
file_table = lt_filetab
rc = v_rc
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
READ TABLE lt_filetab INTO ls_filetab INDEX 1.
IF sy-subrc = 0.
p_file = ls_filetab-filename.
ENDIF.
DATA: lt_filetab TYPE filetable.
DATA: ls_filetab LIKE LINE OF lt_filetab.
PARAMETERS: p_file TYPE localfile.
AT SELECTION-SCREEN on VALUE-REQUEST FOR p_file.
CALL METHOD cl_gui_frontend_services=>file_open_dialog
CHANGING
file_table = lt_filetab
rc = v_rc
EXCEPTIONS
file_open_dialog_failed = 1
cntl_error = 2
error_no_gui = 3
not_supported_by_gui = 4
OTHERS = 5.
READ TABLE lt_filetab INTO ls_filetab INDEX 1.
IF sy-subrc = 0.
p_file = ls_filetab-filename.
ENDIF.
Subscribe to:
Posts (Atom)