Skip to content
Skip to content
Menu
SAP ABAP DWIMAN
  • About
SAP ABAP DWIMAN

SAP ABAP – F4 Search Help in Selection Screen with Refresh Screen

By juananda.satria on February 28, 2024

Bismillah..

Below is how we can enhance our selection screen with custom search help, and how to refresh the related input before we get the data of search help.


AT SELECTION-SCREEN ON VALUE-REQUEST FOR so_docty-low.
  " refresh screen
  PERFORM f_read_dynp_values '<FIELDNAME>' '<X/blank>'. " -> key1 = field reference ; key 2 = (boolean) is date type?
  " popup f4
  PERFORM f_f4_docty USING 'SO_DOCTY-LOW'.

*&---------------------------------------------------------------------*
*& Form f_f4_docty
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
FORM f_f4_docty USING p_field TYPE help_info-dynprofld.

  SELECT doc_type, doc_text
    FROM ztable
    INTO TABLE @DATA(lt_sel).

  CALL FUNCTION 'F4IF_INT_TABLE_VALUE_REQUEST' ##FM_SUBRC_OK
    EXPORTING
      retfield        = 'DOC_TYPE'
      dynpprog        = sy-repid
      dynpnr          = sy-dynnr
      dynprofield     = p_field
      value_org       = 'S'
    TABLES
      value_tab       = lt_sel
    EXCEPTIONS
      parameter_error = 1
      no_values_found = 2
      OTHERS          = 3.
ENDFORM.


*&---------------------------------------------------------------------*
*& Form f_read_dynp_values
*&---------------------------------------------------------------------*
*& text
*&---------------------------------------------------------------------*
FORM f_read_dynp_values USING p_field p_isdat.
  DATA: lt_dynpro_values TYPE TABLE OF dynpread WITH HEADER LINE.
  FIELD-SYMBOLS: <fs> TYPE any .

  lt_dynpro_values-fieldname = p_field.
  APPEND lt_dynpro_values.

  CALL FUNCTION 'DYNP_VALUES_READ' ##FM_SUBRC_OK
    EXPORTING
      dyname               = sy-cprog
      dynumb               = sy-dynnr
      translate_to_upper   = 'X'
    TABLES
      dynpfields           = lt_dynpro_values[]
    EXCEPTIONS
      invalid_abapworkarea = 1
      invalid_dynprofield  = 2
      invalid_dynproname   = 3
      invalid_dynpronummer = 4
      invalid_request      = 5
      no_fielddescription  = 6
      invalid_parameter    = 7
      undefind_error       = 8
      double_conversion    = 9
      stepl_not_found      = 10
      OTHERS               = 11.

  READ TABLE lt_dynpro_values WITH KEY fieldname = p_field.
  IF sy-subrc EQ 0.
    IF p_isdat IS INITIAL.
      ASSIGN (p_field) TO <fs>.
      <fs> = lt_dynpro_values-fieldvalue.
    ELSE.
      ASSIGN (p_field) TO <fs>.
      <fs> = lt_dynpro_values-fieldvalue+6(4) && lt_dynpro_values-fieldvalue+3(2) && lt_dynpro_values-fieldvalue(2).
    ENDIF.
  ENDIF.
ENDFORM.

Post navigation

SAP ABAP – DO… WHILE VARYING
SAP ABAP – All About Report Painter GRR1 / GRR2 / GRR3

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • SAP ABAP – Generate Fiori URL
  • SAP ABAP – Workflow Agents CDS
  • SAP ABAP – Workflow Level with Table Function
  • SAP ABAP – Download ALV to Excel with Total and Subtotal
  • SAP ABAP – BDC Template

Recent Comments

  1. SAP ABAP – Simple Interface FTP Inbound (SAP Consume File From FTP) – SAP ABAP DWIMAN on SAP ABAP – String Encode & Decode BASE64
  2. Upload file – SAP ABAP DWIMAN on F4 Search Help File

Archives

  • May 2025
  • August 2024
  • June 2024
  • May 2024
  • March 2024
  • February 2024
  • January 2024
  • December 2023
  • November 2023
  • October 2023
  • May 2023
  • April 2023

Categories

  • Uncategorized
©2026 SAP ABAP DWIMAN | WordPress Theme by SuperbThemes.com