
here: ZSTF_SH_BP_ORG
1a) Add the DB table /SCMB/D_BPTMORG and add the join conditions. See screenshot.
1b) Add the view fields org, org_function, eikto. See screenshot.
here: ZSTF_SH_BUPA_COMMON
Remove the old code and add your code.
DATA:
lo_fpm TYPE REF TO if_fpm,
lo_fbi TYPE REF TO /bofu/if_fbi_controller_new,
ls_fpm_runtime_info TYPE fpm_s_runtime_info,
lt_sh_selopt TYPE ddshselops,
ls_sh_selopt TYPE ddshselopt,
lt_shlp_tab TYPE shlp_desct,
lt_selopt_rcode TYPE /scmtms/t_string_range,
lt_selopt_roles TYPE /scmtms/t_string_range,
ls_selopt_rcode TYPE /scmtms/s_string_range,
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,
lv_sales_org_relevant.
FIELD-SYMBOLS:
<ls_sh_selopt> TYPE ddshselopt,
<ls_selopt_roles> TYPE /scmtms/s_string_range,
<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.
CHECK callcontrol-step = 'PRESEL' AND shlp-shlpname = 'ZSTF_BUPAA_ORG'.
*---------------------------------------------------------------------------*
* enable the combined search customizing for a non HANA based search
lt_shlp_tab[] = shlp_tab[].
/scmb/cl_tya_sh_helper=>set_type_ahead_search_criteria(
CHANGING
ct_shlp_tab = lt_shlp_tab
cs_shlp = shlp
cs_callcontrol = callcontrol ).
shlp_tab[] = lt_shlp_tab[].
*---------------------------------------------------------------------------*
* translate the party role codes as in the standard SH exit
LOOP AT shlp-selopt ASSIGNING <ls_sh_selopt> WHERE shlpfield = 'PARTY_RCO'.
* recognize here which partner ID shall be used as selection criteria
* => table /SCMTMS/V_PA_ROL
CASE <ls_sh_selopt>-low.
WHEN '1' " ordering party- OK
OR 'TM002' " prepaid agreement party- OK
OR '6' " shipper - OK
OR '10' " bill-to - OK
OR 'TM003' . " prepaid bill-to - OK
lv_sales_org_relevant = abap_true.
WHEN OTHERS.
* any other org unit ? - e.g. purchase org for carrier
ENDCASE.
MOVE-CORRESPONDING <ls_sh_selopt> TO ls_selopt_rcode.
INSERT ls_selopt_rcode INTO TABLE lt_selopt_rcode.
DELETE shlp-selopt.
ENDLOOP.
IF sy-subrc NE 0.
* temporary workaround - fast order entry screens do not set the role code
* ==> this elementary SH is currently only called if it is sales org relevant
ls_selopt_rcode-sign = 'I'.
ls_selopt_rcode-option = 'EQ'.
ls_selopt_rcode-low = '1'.
INSERT ls_selopt_rcode INTO TABLE lt_selopt_rcode.
lv_sales_org_relevant = abap_true.
ENDIF.
CALL METHOD /scmtms/cl_bupa_sh_helper=>get_roles_for_party_rco
EXPORTING
it_selopt_rcodes = lt_selopt_rcode
IMPORTING
et_selopt_roles = lt_selopt_roles.
LOOP AT lt_selopt_roles ASSIGNING <ls_selopt_roles>.
ls_sh_selopt-shlpname = 'ZSTF_BUPAA_ORG'.
ls_sh_selopt-shlpfield = 'RLTYP'.
MOVE-CORRESPONDING <ls_selopt_roles> TO ls_sh_selopt.
INSERT ls_sh_selopt INTO TABLE shlp-selopt.
ENDLOOP.
* assuming this piece of code is only executed from UI and not in batch mode...
CHECK sy-batch IS INITIAL.
lo_fpm = cl_fpm_factory=>get_instance( ).
lo_fbi ?= /bofu/cl_fbi_controller_new=>get_instance( ).
ls_fpm_runtime_info = lo_fpm->get_runtime_info( ).
* 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>.
* ... depending from which UI the BP search is triggered:
IF ls_fpm_runtime_info-config_id = '/SCMTMS/FWD_ORDER_OCEAN' AND "just an example
lv_sales_org_relevant = abap_true.
* 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.
* add the Sales Org as selection criteria
IF NOT <ls_trq_root_data>-sales_org_id IS INITIAL.
INSERT INITIAL LINE INTO TABLE shlp-selopt ASSIGNING <ls_selopt>.
<ls_selopt>-shlpname = 'ZSTF_BUPAA_ORG'.
<ls_selopt>-shlpfield = 'ORG'.
<ls_selopt>-sign = 'I'.
<ls_selopt>-option = 'EQ'.
<ls_selopt>-low = <ls_trq_root_data>-sales_org_id.
ENDIF.
ENDIF.
ENDIF.
ENDIF.
here: ZSTF_BUPAA_ORG
3a) Add the org fields - see screenshot
3b) Add your view (step 1) as selection method
3c) Add your function (step 2) as search help exit
3d) Adjust the List-Position (LPos) sequence as required – see my proposal
here: ZSTF_BUPA_APPEND
4a) Include your copied elementary SH (step 4) -> "ZSTF_BUPAA_ORG"
4b) Maintain the assignment of UI fields - see screenshot
DATA:
lo_fpm TYPE REF TO if_fpm,
ls_fpm_runtime_info TYPE fpm_s_runtime_info,
lv_sales_org_relevant.
FIELD-SYMBOLS:
<ls_sh_interface_partner> TYPE ddshiface,
<ls_sh_interface> TYPE ddshiface.
IF sy-uname = 'FOERSTER'.
* for the type ahead search:
* - out of the available elementary SHs of the collective SH pick the address/Org search if required
IF cl_web_dynpro=>valuehelpinfo-valuesuggest = abap_true.
lo_fpm = cl_fpm_factory=>get_instance( ).
ls_fpm_runtime_info = lo_fpm->get_runtime_info( ).
* ... depending from which UI the BP search is triggered:
IF ls_fpm_runtime_info-config_id = '/SCMTMS/FWD_ORDER_OCEAN'. "just an example
* recognize already here whether the party role is relevant for the sales org assignment
* and hence whether at all the special search help shall be used
READ TABLE shlp-interface ASSIGNING <ls_sh_interface>
WITH KEY shlpfield = 'PARTY_RCO'.
IF sy-subrc = 0.
CASE <ls_sh_interface>-value.
WHEN '1' " ordering party- OK
OR 'TM002' " prepaid agreement party- OK
OR '6' " shipper - OK
OR '10' " bill-to - OK
OR 'TM003'. " prepaid bill-to - OK
lv_sales_org_relevant = abap_true.
WHEN OTHERS.
* no reason to use the sales org assignment
ENDCASE.
IF lv_sales_org_relevant = abap_false.
* in the fast order entry screens, the role code is not set... ? => bug
* temporary work around:
READ TABLE shlp-interface ASSIGNING <ls_sh_interface_partner>
WITH KEY shlpfield = 'PARTNER'.
IF sy-subrc = 0.
CASE <ls_sh_interface_partner>-valfield.
WHEN 'ORDER_PARTY_ID' . " ordering party- OK
<ls_sh_interface>-value = '1'.
lv_sales_org_relevant = abap_true.
when 'SHIPPER_ID' . " shipper - OK
<ls_sh_interface>-value = '6'.
lv_sales_org_relevant = abap_true.
WHEN OTHERS.
* no reason to use the sales org assignment
ENDCASE.
ENDIF.
ENDIF.
IF lv_sales_org_relevant = abap_true.
DELETE shlp_tab WHERE shlpname NE 'ZSTF_BUPAA_ORG'.
EXIT. " no other SH shall be used but this one
ENDIF.
ENDIF.
ENDIF.
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 |
---|---|
5 | |
4 | |
4 | |
4 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 |