Hi Rudra,
thank you for your hint. Coding now looks as follows, but doesn't work correct :-(
FUNCTION z_sd_sexit_delco.
*"----------------------------------------------------------------------
*"*"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
*"----------------------------------------------------------------------
* EXIT immediately, if you do not want to handle this step
IF callcontrol-step <> 'SELONE' AND
callcontrol-step <> 'SELECT' AND
callcontrol-step <> 'PRESEL1' AND
callcontrol-step <> 'DISP'.
EXIT.
ENDIF.
*"----------------------------------------------------------------------
* 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 PRESEL1 (Vorschlag für erste Selektion)
*"----------------------------------------------------------------------
IF callcontrol-step = 'PRESEL1'.
* call function 'Z_AFZ_EXIT_GRUPPE'
* tables zgruppen = igruppe
* exceptions others = 1.
* clear shlp-selopt[].
* clear rmaster.
* rmaster-shlpfield = 'GRUPPE'.
* rmaster-sign = 'I'.
* rmaster-option = 'EQ'.
* loop at igruppe.
* rmaster-low = igruppe-gruppe.
* append rmaster to shlp-selopt.
* endloop.
* 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
IF callcontrol-step = 'SELECT'.
TYPES: BEGIN OF ty_tvdc,
delco TYPE delco,
bezei TYPE bezei20,
END OF ty_tvdc.
DATA: lt_zrsd_c_delco TYPE TABLE OF zrsd_c_delco,
lt_tvdc TYPE TABLE OF ty_tvdc.
DATA: ls_shlp_selopt LIKE LINE OF shlp-selopt,
ls_zrsd_c_delco TYPE zrsd_c_delco,
ls_tvdc TYPE ty_tvdc.
DATA: lv_vkorg TYPE vkorg.
LOOP AT shlp-selopt INTO ls_shlp_selopt WHERE shlpfield = 'VBELN'.
SELECT SINGLE vkorg FROM vbak INTO lv_vkorg
WHERE vbeln = ls_shlp_selopt-low.
IF sy-subrc = 0.
SELECT * FROM zrsd_c_delco INTO TABLE lt_zrsd_c_delco
WHERE vkorg = lv_vkorg AND
active = abap_true.
IF lt_zrsd_c_delco IS INITIAL.
SELECT tvdc~delco tvdct~bezei FROM tvdc AS tvdc
INNER JOIN tvdct AS tvdct ON tvdct~delco = tvdc~delco
INTO CORRESPONDING FIELDS OF TABLE lt_tvdc
WHERE spras = sy-langu.
ELSE.
LOOP AT lt_zrsd_c_delco INTO ls_zrsd_c_delco.
CLEAR ls_tvdc.
SELECT SINGLE tvdc~delco tvdct~bezei FROM tvdc AS tvdc
INNER JOIN tvdct AS tvdct ON tvdct~delco = tvdc~delco
INTO CORRESPONDING FIELDS OF ls_tvdc
WHERE tvdc~delco = ls_zrsd_c_delco-delco AND
tvdct~spras = sy-langu.
IF sy-subrc = 0.
APPEND ls_tvdc TO lt_tvdc.
ENDIF.
ENDLOOP.
ENDIF.
ENDIF.
ENDLOOP.
CALL FUNCTION 'F4UT_RESULTS_MAP'
TABLES
shlp_tab = shlp_tab
record_tab = record_tab
source_tab = lt_tvdc
CHANGING
shlp = shlp
callcontrol = callcontrol.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
IF record_tab[] IS INITIAL.
callcontrol-step = 'EXIT'.
ELSE.
callcontrol-step = 'DISP'.
ENDIF.
EXIT. "Don't process STEP DISP additionally in this call.
ENDIF.
*"----------------------------------------------------------------------
* 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
IF callcontrol-step = 'DISP'.
* PERFORM AUTHORITY_CHECK TABLES RECORD_TAB USING SHLP.
EXIT.
ENDIF.
ENDFUNCTION.
Best Regards
Mike