Skip to Content
0
Nov 21, 2007 at 11:56 PM

How to implement F4IF_INT_TABLE_VALUE_REQUEST in search help User Exit?

435 Views

Hi,

I need to enhanse search help and add F4 functionality to display list of company codes when cursor is in PBUKR field. I put F4IF_INT_TABLE_VALUE_REQUEST

into the user exit but nothing works.

I get error that PROCESS is not defined. If I remove that line there is no error but nothing works.

Can someone tell me what is wrong in the code below.

Thank you.

FUNCTION z_hr_shlp_wbs_element.

*"----


""Local interface:

*" 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

*"----


TABLES: prps.

DATA: it_prps LIKE prps OCCURS 0 WITH HEADER LINE.

DATA: status_tab LIKE jstat OCCURS 0 WITH HEADER LINE.

DATA: l_posid LIKE prps-posid.

DATA: l_subrc LIKE sy-subrc.

DATA: l_pbukr LIKE prps-pbukr, " Added by vr

value TYPE DDSHIFACE-VALUE.

  • EXIT immediately, if you do not want to handle this step

IF callcontrol-step <> 'SELONE' AND

callcontrol-step <> 'SELECT' AND

" AND SO ON

callcontrol-step <> 'DISP'.

EXIT.

ENDIF.

  • ------------------------------------------------------ added by vr

PROCESS ON VALUE-REQUEST.

FIELD PRPS-PBUKR MODULE PBUKR.

DATA: BEGIN OF VALUE_TAB OCCURS 0,

LPBUKR LIKE PRPS-PBUKR,

LPOSID LIKE PRPS-POSID,

END OF VALUE_TAB.

*

DATA: BEGIN OF RETURN_TAB OCCURS 0.

INCLUDE STRUCTURE DDSHRETVAL.

DATA END OF RETURN_TAB.

*

SELECT PBUKR POSID FROM PRPS UP TO 20 ROWS

INTO TABLE VALUE_TAB WHERE SLWID = 'QLT UDF'.

*

CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST'

EXPORTING

RETFIELD = 'PBUKR'

WINDOW_TITLE = 'Statusselektion'

VALUE_ORG = 'S' "hierdurch kann die Struktur genommen werden

TABLES

VALUE_TAB = VALUE_TAB

RETURN_TAB = RETURN_TAB

EXCEPTIONS

PARAMETER_ERROR = 1

NO_VALUES_FOUND = 2

OTHERS = 3.

*----


end of additions

*"----


  • STEP SELONE (Select one of the elementary searchhelps)

*"----


  • This step is only called for collective searchhelps. It may be used

  • to reduce the amount of elementary searchhelps given in SHLP_TAB.

  • The compound searchhelp is given in SHLP.

  • If you do not change CALLCONTROL-STEP, the next step is the

  • dialog, to select one of the elementary searchhelps.

  • If you want to skip this dialog, you have to return the selected

  • elementary searchhelp in SHLP and to change CALLCONTROL-STEP to

  • either to 'PRESEL' or to 'SELECT'.

IF callcontrol-step = 'SELONE'.

  • PERFORM SELONE .........

EXIT.

ENDIF.

*"----


  • STEP PRESEL (Enter selection conditions)

*"----


  • This step allows you, to influence the selection conditions either

  • before they are displayed or in order to skip the dialog completely.

  • If you want to skip the dialog, you should change CALLCONTROL-STEP

  • to 'SELECT'.

  • Normaly only SHLP-SELOPT should be changed in this step.

IF callcontrol-step = 'PRESEL'.

  • PERFORM PRESEL ..........

EXIT.

ENDIF.

*"----


  • 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'.

  • Maximum records are set to 0 because the counter for Max records keeps

  • running, even if you filter out certain records. This is a similar

  • problem as described in OSS Note 148525.

  • Feb 3, 2004 LS: devk907353

  • (maxrecords = 0 defaults to maxrecords 500)

  • As of release 4.7, it appears that maxrecords is

  • being considered on the read of the view, rather

  • than prior to presenting the selection list.

  • When only 500 records are passed into this exit,

  • the subsequent evaluation yields very few records

  • in the selection list. By setting maxrecords to

  • 8000, the entire contents of the view are passed

  • to this user exit, and therefor the search help

  • yields a reasonable selection list to the user

  • (as was the case in release 4.6b).

  • callcontrol-maxrecords = 0. " devk907353

callcontrol-maxrecords = 8000. " devk907353

  • PERFORM STEP_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.

  • Added by vr, Nov. 2007 ---------------------------

CALL FUNCTION 'F4UT_PARAMETER_VALUE_GET'

EXPORTING

PARAMETER = 'PBUKR' " Reference to search help parameter

IMPORTING

VALUE = value

TABLES

SHLP_TAB = shlp_tab

RECORD_TAB = record_tab

CHANGING

SHLP = shlp

CALLCONTROL = callcontrol.

l_pbukr = value.

  • End of additions by vr ---------------------------

*"----


  • STEP DISP (Display values)

*"----


  • This step is called, before the selected data is displayed.

  • You can e.g. modify or reduce the data in RECORD_TAB

  • according to the users authority.

  • If you want to get the standard display dialog afterwards, you

  • should not change CALLCONTROL-STEP.

  • If you want to overtake the dialog on you own, you must return

  • the following values in CALLCONTROL-STEP:

  • - "RETURN" if one line was selected. The selected line must be

  • the only record left in RECORD_TAB. The corresponding fields of

  • this line are entered into the screen.

  • - "EXIT" if the values request should be aborted

  • - "PRESEL" if you want to return to the selection dialog

  • Standard function modules F4UT_PARAMETER_VALUE_GET and

  • F4UT_PARAMETER_RESULTS_PUT may be very helpfull in this step.

IF callcontrol-step = 'DISP'.

  • DEVK909420 Begin

  • SELECT * FROM prps INTO TABLE it_prps

  • WHERE belkz = 'X'.

  • Changed by vr, Nov. 2007

IF l_pbukr <> ''.

SELECT * FROM prps INTO TABLE it_prps

WHERE belkz = 'X'

AND fkstl <> ''

AND pbukr = l_pbukr.

ELSE.

SELECT * FROM prps INTO TABLE it_prps

WHERE belkz = 'X'

AND fkstl <> ''.

ENDIF.

  • End of changes

  • DEVK909420 End

SORT it_prps BY posid.

LOOP AT record_tab.

l_posid = record_tab+96(24).

READ TABLE it_prps WITH KEY posid = l_posid.

IF sy-subrc = 0.

CALL FUNCTION 'STATUS_READ'

EXPORTING

objnr = it_prps-objnr

only_active = 'X'

TABLES

status = status_tab.

  • DEVK909329 Begin

read table status_tab with key inact = ''

stat = 'E0001'.

if sy-subrc is initial.

read table status_tab with key inact = '' "DEVK909345

stat = 'I0002'. "DEVK909345

endif.

  • DEVK909329 End

ENDIF.

IF sy-subrc NE 0.

DELETE record_tab.

ELSE.

  • IF record_tab+114(1) EQ '.' AND

  • record_tab+115(1) EQ '9'.

  • DELETE record_tab.

  • ELSE.

  • DEVK909420 Begin

  • IF record_tab+102(1) EQ '9'.

  • DELETE record_tab.

  • ELSEIF record_tab+104(1) EQ '9'.

  • DELETE record_tab.

  • ENDIF.

  • DEVK909420 End

  • ENDIF.

ENDIF.

ENDLOOP.

EXIT.

ENDIF.

ENDFUNCTION.