09-01-2008 12:17 PM
Hello all,
The following are the things i have implemented
1. i have attached the search help to a feild in a DB table and same i have created an input feild on the selection screen with same name (using DDIC).
2. I have given a search help exit function also to remove the duplicate enteries in the hit list.
Now when the user presses nothing on the dialog box which appears for value restriction i am getting some enteries which i dont want.
I want to manually write a select query in the search help exit to do that.
Kindly let me know how to do it.
I am new to programming in ABAP and a well commented code would be helpful.
09-02-2008 5:37 AM
hi Uwe,
Thanks a lot.. but i have figured out that i instead of writing the code completely i want to modify the standard selection a bit.
I have written this code to remove duplicates in my search exit function.
IF callcontrol-step = 'DISP'.
SORT record_tab.
DELETE ADJACENT DUPLICATES FROM record_tab.
EXIT.
ENDIF.
However there are some more not exactly duplicates but i still want to remove them to do so i tried using the below statement
DELETE ADJACENT DUPLICATES FROM record_tab comparing <MY_DB_KEYELEMENT>.
however it dint work as the record_tab was not populated by then.
Kindly, let me know where can i give this statement in the standard selection process so that the deletion takes place based on the key element i have specified.
Thanks,
Naveen
09-01-2008 12:48 PM
Hi,
actually the search help generate a function module.
so we can copy the function module ' F4IF_SHLP_EXIT_EXAMPLE'.
this is the template for the function module which is generated.
now change the function module as per requirement.
thanks
malya
09-02-2008 4:22 AM
Hi,
As i told before i am already using the search help exit to delete the duplicate enteries. What i want to know is where in that function module should we write the code to do the manual selection and how to do it.
09-02-2008 4:33 AM
Hello Naveen
On ERP 6.0 there are many search help exits available, one of which is F4IF_SHLP_EXIT_ROLES. Below you find the crucial parts of the coding for selecting your own F4 entries:
FUNCTION F4IF_SHLP_EXIT_ROLES.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" TABLES
*" SHLP_TAB TYPE SHLP_DESCR_TAB_T
*" RECORD_TAB STRUCTURE SEAHLPRES
*" CHANGING
*" VALUE(SHLP) TYPE SHLP_DESCR_T
*" VALUE(CALLCONTROL) LIKE DDSHF4CTRL
*" STRUCTURE DDSHF4CTRL
*"----------------------------------------------------------------------
" NOTE: This interface is the same for all search help exits.
...
*"----------------------------------------------------------------------
* STEP SELECT (Select values)
*"----------------------------------------------------------------------
* This step may be used to overtake the data selection completely.
* To skip the standard seletion, you should return 'DISP' as following
* step in CALLCONTROL-STEP.
* Normally RECORD_TAB should be filled after this step.
* Standard function module F4UT_RESULTS_MAP may be very helpfull in this
* step.
IF CALLCONTROL-STEP = 'SELECT'.
PERFORM roles_select TABLES
RECORD_TAB
SHLP_TAB
CHANGING
SHLP
CALLCONTROL
RC.
IF RC = 0.
CALLCONTROL-STEP = 'DISP'.
ELSE.
CALLCONTROL-STEP = 'EXIT'.
ENDIF.
EXIT. "Don't process STEP DISP additionally in this call.
ENDIF.
*&---------------------------------------------------------------------*
*& Form roles_select
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_RECORD_TAB text
* -->P_SHLP_TAB text
* <--P_SHLP text
* <--P_CALLCONTROL text
* <--P_RC text
*----------------------------------------------------------------------*
FORM roles_select TABLES record_tab STRUCTURE seahlpres
shlp_tab TYPE shlp_descr_tab_t
CHANGING shlp TYPE shlp_descr_t
callcontrol STRUCTURE ddshf4ctrl
rc LIKE sy-subrc.
DATA:
lt_tb003 LIKE tb003 OCCURS 0 WITH HEADER LINE.
DATA: BEGIN OF lt_result OCCURS 0,
rltyp LIKE tb003-role,
rltitl LIKE tb003t-rltitl,
END OF lt_result.
*------ Initialisierung ----------------------------------------------
CLEAR:
lt_result.
REFRESH:
lt_result,
lt_tb003.
*------ Datenbeschaffung ----------------------------------------------
CALL FUNCTION 'BUP_TB003_SELECT_ALL'
EXPORTING
i_xmemory = ' '
TABLES
t_tb003 = lt_tb003
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
ENDIF.
*------ Nur fortschreibungsrelevante und nicht augeblendete GP- -------
*------ Rollen anzeigen -------
DELETE lt_tb003 WHERE rolecategory IS INITIAL
OR NOT xsuppress IS INITIAL.
*------ Für die GP-Rollen Texte nachlesen ------------------------------
LOOP AT lt_tb003.
CALL FUNCTION 'BUP_TB003T_SELECT_SINGLE'
EXPORTING
i_role = lt_tb003-role
i_xmemory = ' '
IMPORTING
e_tb003t = gs_tb003t
EXCEPTIONS
not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
CLEAR gs_tb003t.
ELSE.
*------ Aufbau der Ausgabetabelle --------------------------------------
lt_result-rltyp = lt_tb003-role.
lt_result-rltitl = gs_tb003t-rltitl.
APPEND lt_result.
ENDIF.
ENDLOOP.
*------ Ausgabepopup---------------------------------------------------
*------ Ausgabetabelle füllen ------------------------------------------
CALL FUNCTION 'F4UT_RESULTS_MAP'
* EXPORTING
* SOURCE_STRUCTURE =
* APPLY_RESTRICTIONS = ' '
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
source_tab = lt_result
CHANGING
shlp = shlp
callcontrol = callcontrol
EXCEPTIONS
illegal_structure = 1
OTHERS = 2
.
IF sy-subrc <> 0.
rc = 4.
ENDIF.
ENDFORM. " roles_select
The fm F4UT_RESULTS_MAP is used to map the results itab to the search help itab.
Regards
Uwe
09-02-2008 5:37 AM
hi Uwe,
Thanks a lot.. but i have figured out that i instead of writing the code completely i want to modify the standard selection a bit.
I have written this code to remove duplicates in my search exit function.
IF callcontrol-step = 'DISP'.
SORT record_tab.
DELETE ADJACENT DUPLICATES FROM record_tab.
EXIT.
ENDIF.
However there are some more not exactly duplicates but i still want to remove them to do so i tried using the below statement
DELETE ADJACENT DUPLICATES FROM record_tab comparing <MY_DB_KEYELEMENT>.
however it dint work as the record_tab was not populated by then.
Kindly, let me know where can i give this statement in the standard selection process so that the deletion takes place based on the key element i have specified.
Thanks,
Naveen
09-02-2008 10:39 PM
Hello Naveen
The search help record values are stored in an unstructured string (SEAHLPRES-STRING). Thus, to figure out the records you want to delete you need to implement some logic, e.g.:
" Define a structure according to the definition of the search help parameters.
TYPES: BEGIN OF ty_s_record.
TYPES: ...
TYPES: END OF ty_s_record.
DATA: ls_record TYPE ty_s _record.
DATA: ls_line LIKE LINE OF RECORD_TAB.
LOOP AT record_tab INTO ls_line.
CLEAR: ls_record.
CALL METHOD cl_abap_container_utilities=>read_container_c
EXPORTING
im_container = ls_line-string
IMPORTING
ex_value = ls_record
EXCEPTIONS
illegal_parameter_type = 1
OTHERS = 2.
IF ( ls_record-... = ... ).
DELETE record_tab[] INDEX syst-tabix.
ENDIF.
ENDLOOP.
Regards
Uwe
09-04-2008 5:03 AM
Hello Uwe,
I had heard a lot about this site( I am a new joinee) and the experts who post answers for our queries put up. I am truly glad that i realized its 100% true..
Thanks a lot dude. Ur suggestion was what i was looking for. It solved my problem. I am really grateful to you.
Have a Nice Day.....
Thanks & Rgds,
Naveen M