I want to share my recent experience on search help exit requirement.
Small Introduction – Search help was created to provide F4 to one ALV application long back but it returned back with some bugs. Basically the search help exit was implemented to merge to two tables records.
Two tables – One material specific MRP values table (like T_MATNR) and another one material and plant (Like T_MATNR_PLANT) specific MRP values table. Purpose of search help is when user select f4 help for MRP values system first check in material specific table T_MATNR if MRP values not expired than only check plant specific table T_PLANT than merge the records and show valid MRP values from the both tables.
Our ABAPer had created one search help on T_MATNR table and in search help exit written logic to merge the records from other table T_MATNR_PLANT based on some condition and he was able to merge the records from both table but he was not able to show MRP values because of data type currency.
In runtime MRP values are appearing as ##### in parameter table RECORD_TAB of search help exit function module.
Challenges faced are :
On F4 pressed on Price Lot
In run time MRP Values encoded like #####
I was supposed to change these ####### (14.99) values with some other values(45.00). If I directly replaced these values with some other values I was getting a run time error.
- Because of typical requirement help view creation not fulfilled the requirement
- Interactive ALV developed with REUSE_ALV_GRID_DISPLAY hence F4 help events
- User was not interested in displaying 2 separate search helps tab
Finally I decided to use tit to tat method 🙂 , replace encoded values with another encoded values.
- Declared field symbol type X(hexadecimal)
- Assigned actual required values to field symbol with casting. L_PLANT-YYMRP has plant specific MRP value and field symbol <FS_CUR1> has value in hexadecimal
- Assigned RECORD_TAB values (need to replace) to another field symbol with casting. RECORD_TAB-STRING+65(6) has old value , field symbol <fs_cur> has old value in hexadecimal
- Copied <FS_CUR1> to <FS_CUR> which in turn replaced RECORD_TAB-STRING+65(6).
Runtime – L_PLNAT-YYMRP = 45.00 and RECORD_TAB-STRING+65(6) = ###### (14.99)
After <fs_cur> = <Fs_cur1> ,