Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Search Help Refresh

Former Member
0 Likes
2,056

Hello,

I implemented a search help with an own search help exit. In this search help exit I control the hit list based on the field 'VKORG'.

If I open the sales order dialog for a specific sales order, the hit list is getting generated correctly. If I leave the dialog (without calling the transaction once again) and take a sales order number having another 'VKORG' the hit list shows the old (wrong for this 'VKORG') values. It need to be refreshed -> search help exit called again.

It only works if the transaction is called again.

Do you have any solution to call the search help again without rerunning the complete transaction?

Best Regards

Mike

9 REPLIES 9
Read only

oliver_wurm
Active Participant
0 Likes
1,624

Hi Mike,

where is your search help exit getting the Sales Organization from?

Regards

Oliver

Read only

0 Likes
1,624

The search help is assigned to a field in table VBKD. Additional to the "normal" parameters I do send VBELN out of VBKD to the search help exit. In the search help exit I read VBAK.

But I think that is nonrelevant. The problem is that the search help is only initially called when transaction is called.

Read only

0 Likes
1,624

The search Help Exit is called for the various steps it performs each time you press F4 on the field it is assigned to. Just put a break point into the exit function.

Regards

Oliver

Read only

0 Likes
1,624

In my case it is assigned a VBKD dictionary field and SAP does not allow to assign it to the related dynpro field. In this case it is definitly not performed each time the F4 button is pressed (break point)    😞

Best Regards

Mike

Read only

0 Likes
1,624

Maybe you would like to paste your code inside search help exit then. It will help anybody wants to analyze.

R

Read only

0 Likes
1,624

I set a breakpoint at the first step of the search help exit. It is going to get called only once when the transaction is called. Because of this fact it doesn't matter what the code inside the search help exit looks like.

Read only

0 Likes
1,624

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.

Read only

0 Likes
1,624

Hi,

Based on the documentation the FM F4UT_RESULTS_MAP should be called when callcontrol-step = 'SELECT' .


So what might be happening that since you are calling it in 'DISP' step the data is not getting refreshed because this FM might be using ABAP memory to keep the old data.

So try this.

Move the entire code to under IF callcontrol-step = 'SELECT'  instead of 'DISP'

And at the end set callcontrol-step = 'DISP' .

So the logic should be:

IF callcontrol-step = 'SELECT' .

.....Your code..

set callcontrol-step = 'DISP' .


ENDIF.


R

Read only

0 Likes
1,624

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