Remark: Customer pickup locations usually have got a numeric ID, which the end users not tend to memorize. In HANA DB based TM systems the system automatically does a multi column fuzzy search and hence would also find numeric locations while typing the customer name. But hit list could still be 10+. In a non-HANA DB based TM system using belows concept you could also switch the search criteria from location ID to customer name or city name, but usually it is already sufficient to add the Shipper/Consignee as an additional serach criteria.
...
* assuming this piece of code is only executed from UI and not in batch mode...
DATA lo_fpm TYPE REF TO if_fpm.
lo_fpm = cl_fpm_factory=>get_instance( ).
DATA lo_fbi TYPE REF TO /bofu/if_fbi_controller_new.
lo_fbi ?= /bofu/cl_fbi_controller_new=>get_instance( ).
DATA ls_fpm_runtime_info TYPE fpm_s_runtime_info.
ls_fpm_runtime_info = lo_fpm->get_runtime_info( ).
* ... depending from which UI the location search is triggered:
IF ls_fpm_runtime_info-config_id = '/SCMTMS/FWD_ORDER_OCEAN'.
* get the current instance
lt_root_key = lo_fbi->mo_connector->mo_source_entity->get_self_keys( ).
READ TABLE lt_root_key INTO ls_root_key INDEX 1.
CHECK sy-subrc = 0.
* read data of current instance directly from buffer or via retrieve via BOBF transaction manager
READ TABLE lo_fbi->mt_node_buffer ASSIGNING FIELD-SYMBOL(<ls_node_buffer>)
WITH KEY bo_key = /scmtms/if_trq_c=>sc_bo_key
node_key = /scmtms/if_trq_c=>sc_node-root.
IF sy-subrc EQ 0.
ASSIGN <ls_node_buffer>-t_data->* TO <lt_any_node_data>.
* here we know - it's a TRQ instance (as we know from which UI it is called)
lt_trq_data = <lt_any_node_data>.
READ TABLE lt_trq_data ASSIGNING <ls_trq_root_data> WITH KEY key = ls_root_key-key.
IF sy-subrc EQ 0.
...
DATA:
ls_root_key TYPE /bobf/s_frw_key,
lt_root_key TYPE /bobf/t_frw_key,
lt_trq_data type /scmtms/t_trq_root_k.
FIELD-SYMBOLS:
<ls_trq_root_data> TYPE /scmtms/s_trq_root_k,
<lt_any_node_data> TYPE INDEX TABLE,
<ls_selopt> TYPE ddshselopt,
<ls_interface> TYPE ddshiface.
IF callcontrol-step = 'PRESEL'.
* add selection criteria only for type ahead search, not for regular F4 help popup
CHECK cl_web_dynpro=>valuehelpinfo-valuesuggest = abap_true.
READ TABLE shlp-interface ASSIGNING <ls_interface>
WITH KEY shlpfield = 'LOCNO'.
CHECK sy-subrc = 0.
* ABAP WD field, for which the type ahed search runs: <ls_interface>-VALFIELD
IF <ls_interface>-valfield IS INITIAL.
* ABAP WD bug; I put the valfield into memory in the collective search help exit.
IMPORT <ls_interface>-valfield from memory ID 'ZSTFLOCF4-FIELD'.
ENDIF.
* assuming this piece of code is only executed from UI and not in batch mode...
DATA lo_fpm TYPE REF TO if_fpm.
lo_fpm = cl_fpm_factory=>get_instance( ).
DATA lo_fbi TYPE REF TO /bofu/if_fbi_controller_new.
lo_fbi ?= /bofu/cl_fbi_controller_new=>get_instance( ).
DATA ls_fpm_runtime_info TYPE fpm_s_runtime_info.
ls_fpm_runtime_info = lo_fpm->get_runtime_info( ).
* ... depending from which UI the location search is triggered:
IF ls_fpm_runtime_info-config_id = '/SCMTMS/FWD_ORDER_OCEAN'.
* get the current instance
lt_root_key = lo_fbi->mo_connector->mo_source_entity->get_self_keys( ).
READ TABLE lt_root_key INTO ls_root_key INDEX 1.
CHECK sy-subrc = 0.
* read data of current instance directly from buffer or via retrieve via BOBF transaction manager
READ TABLE lo_fbi->mt_node_buffer ASSIGNING FIELD-SYMBOL(<ls_node_buffer>)
WITH KEY bo_key = /scmtms/if_trq_c=>sc_bo_key
node_key = /scmtms/if_trq_c=>sc_node-root.
IF sy-subrc EQ 0.
ASSIGN <ls_node_buffer>-t_data->* TO <lt_any_node_data>.
* here we know - it's a TRQ instance (as we know from which UI it is called)
lt_trq_data = <lt_any_node_data>.
READ TABLE lt_trq_data ASSIGNING <ls_trq_root_data> WITH KEY key = ls_root_key-key.
IF sy-subrc EQ 0.
* pre-fill the BP selection criteria for the location search
* ... depending on whether it's the pick-up or the delivery location
IF <ls_interface>-valfield = 'SRC_LOC_ID'.
IF NOT <ls_trq_root_data>-shipper_key IS INITIAL.
INSERT INITIAL LINE INTO TABLE shlp-selopt ASSIGNING <ls_selopt>.
<ls_selopt>-shlpname = 'ZSTF_TM_LOCADR'.
<ls_selopt>-shlpfield = 'PARTNER_GUID'.
<ls_selopt>-sign = 'I'.
<ls_selopt>-option = 'EQ'.
<ls_selopt>-low = <ls_trq_root_data>-shipper_key.
ENDIF.
ELSEIF <ls_interface>-valfield = 'DES_LOC_ID'.
IF NOT <ls_trq_root_data>-consignee_key IS INITIAL.
INSERT INITIAL LINE INTO TABLE shlp-selopt ASSIGNING <ls_selopt>.
<ls_selopt>-shlpname = 'ZSTF_TM_LOCADR'.
<ls_selopt>-shlpfield = 'PARTNER_GUID'.
<ls_selopt>-sign = 'I'.
<ls_selopt>-option = 'EQ'.
<ls_selopt>-low = <ls_trq_root_data>-consignee_key.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
* set the allowed LOCTYPEs
INSERT INITIAL LINE INTO TABLE shlp-selopt ASSIGNING FIELD-SYMBOL(<ls_selopt_loctype>).
<ls_selopt_loctype>-shlpname = 'ZSTF_TM_LOCADR'.
<ls_selopt_loctype>-shlpfield = 'LOCTYPE'.
<ls_selopt_loctype>-sign = 'I'.
<ls_selopt_loctype>-option = 'EQ'.
<ls_selopt_loctype>-low = '1010'.
ENDIF.
ENDIF.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
6 | |
4 | |
3 | |
2 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 |