Advertisement
rplantiko

Trigger PAI after selection of a value in a search help

Jun 23rd, 2020
4,105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
ABAP 1.72 KB | None | 0 0
  1. FUNCTION z_f4if_trigger_pai.
  2. *"----------------------------------------------------------------------
  3. *"*"Lokale Schnittstelle:
  4. *"  TABLES
  5. *"      SHLP_TAB TYPE  SHLP_DESCR_TAB_T
  6. *"      RECORD_TAB STRUCTURE  SEAHLPRES
  7. *"  CHANGING
  8. *"     REFERENCE(SHLP) TYPE  SHLP_DESCR_T
  9. *"     REFERENCE(CALLCONTROL) TYPE  DDSHF4CTRL
  10. *"----------------------------------------------------------------------
  11.  
  12. * If a value is picked from a search help, usually no "process after input" (PAI)
  13. * is triggered. Generally, this is useful system behaviour (there will be more
  14. * than one field on the dynpro, and the combined input should trigger PAI, not
  15. * the input of an isolated field). But sometimes, you want the immediate trigger.
  16.  
  17. * For this purpose, you can attach this function module as F4 exit to your
  18. * search help.
  19.  
  20. * If the fcode for "Enter" is not 'ENT1' in your scenario:
  21. * Change the value of lv_fcode to the value you need as "Enter" command
  22.   DATA: lv_fcode TYPE syucomm VALUE 'ENT1'.
  23.  
  24. * EXPORT different fcode to memory in the initialization step of a particular program
  25. * This keeps this function module reusable with the above default fcode
  26.   IMPORT fcode TO lv_fcode FROM MEMORY ID 'FCODE_ENTER'.  " (Doesn't change lv_fcode if nothing found)
  27.  
  28. * Also, you can switch off this exit by "EXPORTing fcode from space" to memory,
  29. * because SAPGUI_SET_FUNCTION ignores fcode blank.
  30.  
  31.   IF callcontrol-step = 'RETURN'.
  32.  
  33. * Um einen PAI auszulösen nach Auswahl eines Wertes
  34.     CALL FUNCTION 'SAPGUI_SET_FUNCTIONCODE'
  35.       EXPORTING
  36.         functioncode           = lv_fcode
  37.       EXCEPTIONS
  38.         function_not_supported = 0
  39.         OTHERS                 = 0.
  40.  
  41.   ENDIF. "callcontrol-step = 'RETURN'.
  42.  
  43. ENDFUNCTION.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement