Created
September 10, 2019 14:42
-
-
Save alezhu/e7b34587fcb9d5831d37b8582fc221a4 to your computer and use it in GitHub Desktop.
F4 on F4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FUNCTION zf4if_brand_sample_exit. | |
*"---------------------------------------------------------------------- | |
*"*"Локальный интерфейс: | |
*" TABLES | |
*" SHLP_TAB TYPE SHLP_DESCR_TAB_T | |
*" RECORD_TAB STRUCTURE SEAHLPRES | |
*" CHANGING | |
*" VALUE(SHLP) TYPE SHLP_DESCR_T | |
*" REFERENCE(CALLCONTROL) TYPE DDSHF4CTRL | |
*"---------------------------------------------------------------------- | |
TYPES: | |
BEGIN OF ts_dir_brand, | |
direction TYPE ze_direction, | |
brand TYPE ze_brand, | |
END OF ts_dir_brand, | |
tt_dir_brand TYPE STANDARD TABLE OF ts_dir_brand WITH DEFAULT KEY. | |
DATA lr_direction TYPE RANGE OF ze_direction. | |
DATA lt_dir_brand TYPE tt_dir_brand. | |
DATA lr_brand TYPE RANGE OF ze_brand. | |
DATA lv_h_mcx TYPE cntl_handle. | |
DATA lt_dialogpage TYPE STANDARD TABLE OF mctbc_dp WITH DEFAULT KEY. | |
DATA ls_help_descr TYPE shlp_descr_t. | |
DATA lv_maxrecords TYPE i. | |
DATA lv_rc LIKE sy-subrc. | |
CASE callcontrol-step. | |
WHEN 'PRESEL1'. | |
IMPORT h_mcx TO lv_h_mcx FROM MEMORY ID 'SHLP_CON'. | |
IMPORT dialogpage TO lt_dialogpage FROM MEMORY ID 'MATCHCODE_OCX_DLGPAGES'. | |
READ TABLE lt_dialogpage REFERENCE INTO DATA(lps_dialog_page) WITH KEY | |
shlp_name = 'ZSH_MAT_SAMPLE' | |
. | |
IF sy-subrc = 0. | |
PERFORM get_sel_opts IN PROGRAM saplwdtm IF FOUND | |
USING | |
lv_h_mcx lps_dialog_page->tabctrl lps_dialog_page->dialognr | |
CHANGING | |
ls_help_descr lv_maxrecords lv_rc. | |
LOOP AT ls_help_descr-selopt REFERENCE INTO DATA(lps_selopt). | |
CASE lps_selopt->shlpfield. | |
WHEN 'ZDIRECTION'. | |
APPEND VALUE #( | |
BASE CORRESPONDING #( lps_selopt->* ) | |
shlpfield = 'DIRECTION' | |
) TO shlp-selopt. | |
WHEN OTHERS. | |
ENDCASE. | |
ENDLOOP. | |
ENDIF. | |
WHEN 'SELECT'. | |
LOOP AT shlp-selopt REFERENCE INTO lps_selopt. | |
CASE lps_selopt->shlpfield. | |
WHEN 'BRAND'. | |
APPEND CORRESPONDING #( lps_selopt->* ) TO lr_brand. | |
DELETE shlp-selopt. | |
WHEN 'DIRECTION'. | |
APPEND CORRESPONDING #( lps_selopt->* ) TO lr_direction. | |
DELETE shlp-selopt. | |
WHEN OTHERS. | |
ENDCASE. | |
ENDLOOP. | |
IF 'R' IN lr_direction. | |
APPEND LINES OF VALUE tt_dir_brand( direction = 'R' | |
( brand = '010' ) | |
( brand = '020' ) | |
( brand = '090' ) | |
) TO lt_dir_brand. | |
ENDIF. | |
IF 'O' IN lr_direction. | |
APPEND LINES OF VALUE tt_dir_brand( direction = 'O' | |
( brand = '230' ) | |
( brand = '540' ) | |
( brand = '090' ) | |
) TO lt_dir_brand. | |
ENDIF. | |
DELETE lt_dir_brand WHERE brand NOT IN lr_brand. | |
FREE record_tab. | |
IF lt_dir_brand[] IS NOT INITIAL. | |
CALL FUNCTION 'F4UT_RESULTS_MAP' | |
* EXPORTING | |
* source_structure = source_structure " DDIC structure that SOURCE_TAB describes | |
* apply_restrictions = apply_restrictions " Take only entries that fulfill the selection requirements | |
TABLES | |
shlp_tab = shlp_tab " Table of Elementary Search Helps | |
record_tab = record_tab " Hit list | |
source_tab = lt_dir_brand | |
CHANGING | |
shlp = shlp " Single (Current) Search Help | |
callcontrol = callcontrol " Control of the F4 process | |
EXCEPTIONS | |
illegal_structure = 1 | |
OTHERS = 2. | |
ENDIF. | |
callcontrol-step = 'DISP'. | |
WHEN OTHERS. | |
ENDCASE. | |
ENDFUNCTION. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment