ABAP F4 Help for File on SAP Application Server

Use the following steps to provide ABAP F4 help for SAP application server file on selection screen.

  1. Declare a input field(PARAMETER) for filename.
  2. Use function module ‘/SAPDMC/LSM_F4_SERVER_FILE’ in AT SELECTION-SCREEN ON VALUE-REQUEST FOR FIELD event to provide F4 help for SAP application server file.
  3. Upload data from/Download data to file.

Below program uses function module‘/SAPDMC/LSM_F4_SERVER_FILE’ to provide ABAP F4 help for a file on application server.

*----------------------------------------------------------------------*
*     Data Decalaration
*----------------------------------------------------------------------*
DATA: g_directory(30).
*----------------------------------------------------------------------*
*     SELECTION-SCREEN
*----------------------------------------------------------------------*
PARAMETERS: p_file TYPE rlgrap-filename OBLIGATORY.

*----------------------------------------------------------------------*
*     AT SELECTION-SCREEN ON VALUE-REQUEST
*----------------------------------------------------------------------*
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_file.

*Set default directory
  g_directory = '.'.

*F4 help for file name on SAP application server
  CALL FUNCTION '/SAPDMC/LSM_F4_SERVER_FILE'
    EXPORTING
      directory        = g_directory
    IMPORTING
      serverfile       = p_file
    EXCEPTIONS
      canceled_by_user = 1
      OTHERS           = 2.
  IF sy-subrc <> 0.
    MESSAGE 'Error Message' TYPE 'I'.
  ENDIF.

*----------------------------------------------------------------------*
*     START-OF-SELECTION
*----------------------------------------------------------------------*
START-OF-SELECTION.
  WRITE:/ 'Filepath : ', p_file.

When you execute the above program and press F4 help for file on selection screen, file dialog pop up will be displayed.

abap-file-f4-help-application-server


Be the first to comment

Leave a Reply

Your email address will not be published.


*