Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 2878

Re: Search Help Refresh

$
0
0

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
      " AND SO ON
      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


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

     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.

     exit.
   endif.

endfunction.


Viewing all articles
Browse latest Browse all 2878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>