SAP TM: BP type ahead search with extended field length
Relevance / Motivation
This is mainly intended for Freight Forwarders. When using the type ahead search for Business Partners (BP), end users could feel uncomfortable with the limited space of 10 characters of the BP ID field. This blog post explains how to enhance SAP TM in order to provide relief to the end users by extending the field length of BP fields on the UI.
In SAP TM when typing any value into a BP ID field the relevant search help is executed on the fly and up to 10 applicable entries are auto-proposed in a drop down. While you type the search help is executed again and again and hence refines the hit list as you type. This feature is called type ahead search. In TM systems based on HANA DB this is a fuzzy search against all available fields of the search help. In a non HANA DB system the search is against the ID only unless you followed the proposed configuration of the blog post Businesspartner-and-orgunit-search-in-sap-tm-uis/
Unfortunately the UI field for a BP ID is a char 10 field just like in the backend and hence end users can only type up to 10 characters to find the BP of concern. This could be quite limited if you want to type parts of the BP name, the country and parts of the city. ABAP WebDynpro does not allow to define a deviating output length or a scrollable field like in SAP GUI.
As in TM the frontend layer and the backend layer are well separated you could extend the field length of the UI fields of the BP IDs. As a result end users could type as many search terms and as long as you define it – and still only the finally selected or entered char 10 BP ID is parsed into the backend field.
Details of the enhancement
The following steps are required:
- Identify the relevant UI DDIC structure(s), the field(s) and data element(s)
- Copy the domain(s) and data element(s) and extend the field length to what ever you like
- Assign your own alpha conversion routine to the domain(s)
- Modify the standard DDIC structures – put your data element instead of the standard one
- Check whether still note 2418053 needs to be applied
ad 1) Identify the relevant UI DDIC structure(s), the field(s) and data element(s)
The UI structure for the BP tab is: /SCMTMS/S_UI_CMN_BP and its field of concern is PARTY_ID.
The UI structure for the fast order entry screen for ocean is: /SCMTMS/S_UI_TRQ_FST_GEN_SEA and its fields of concern are SHIPPER_ID, CONSIGNEE_ID, ORDER_PARTY_ID
Here is how you find that out by yourself:
Use the right mouse button options to navigate to the technical details of the UI field, open the UI Component Configuration, copy the name of the FBI view from the feeder class parameters and look up the UI structure in that view… 😉 OK, here come the relevant screenshots:
Ad 2) Copy the domain(s) and data element(s) and extend the field length to what ever you like
That is pretty straight forward. Do that in your own namespace or as Z* objects.
Ad 3) Assign your own alpha conversion routine to the domain(s)
In some cases it is required to assign an own alpha conversion routine in order to ensure display format is without leading zeros and internal format is char 10 with leading zeros. As there is no harm for cases, where it’s not needed, I don’t describe those cases, but recommend to always do that step too. Follow the screenshots below. Name your conversion routine as you like, but pay attention to the naming convention of the associated conversion exits (functions). You may want to copy the alpha functions (CONVERSION_EXIT_ALPHA_INPUT, CONVERSION_EXIT_ALPHA_OUTPUT) and then put your code instead.
* Special ALPHA conversion for the special case: * - char 30 field for input in frontend in order to use type ahead search * - char 10 field in backend * - only 10 char input is allowed and expected DATA: lv_bp_id TYPE /scmtms/bupa_internal_id, lv_bp_id_zeros TYPE /scmtms/bupa_internal_id VALUE '0000000000'. IF input CO ' 0123456789'. lv_bp_id = input. "assumption: input is always left justified and max. 10 char long SHIFT lv_bp_id RIGHT DELETING TRAILING ' '. OVERLAY lv_bp_id WITH lv_bp_id_zeros. output = lv_bp_id. ELSE. output = input. ENDIF.
* Special ALPHA conversion for the special case: * - char 30 field for input in frontend in order to use type ahead search * - char 10 field in backend DATA: lv_bp_id TYPE /scmtms/bupa_internal_id. IF input CO ' 0123456789'. lv_bp_id = input. SHIFT lv_bp_id LEFT DELETING LEADING '0'. output = lv_bp_id. ELSE. output = input. ENDIF.
Ad 4) Modify the standard DDIC structures – put your data element instead of the standard one
Yes, indeed – a modification is required here. Get the relevant key to modify the UI structure of concern. If the BP ID field is part of an include structure, then first remove the include from the structure and insert all the fields (of the include) individually. Then exchange the standard data element with yours. Activate it, reload the FWO UI and you can test the type ahead search with an extended field length right away.
Ad 5) Check whether still note 2418053 needs to be applied.
SNOTE tells you whether the note is still required or your SP level is good already.