Saturday, September 15, 2012

ABAP Folder Selection input box

The below program will create a input selection that will pop up the folder selection box.




REPORT  z_select_folder.

CONSTANTS: c_default_folder TYPE rlgrap-filename VALUE 'C:\'.

SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-002.
PARAMETERS :  p_folder LIKE rlgrap-filename OBLIGATORY DEFAULT c_default_folder.
SELECTION-SCREEN END OF BLOCK b1.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_folder.
  PERFORM select_folder CHANGING p_folder.


FORM select_folder  CHANGING p_p_folder.
  DATA: l_path TYPE string.

  CALL METHOD cl_gui_frontend_services=>directory_browse
    EXPORTING
      window_title         = 'Select Folder'
      initial_folder       = 'C:\'
    CHANGING
      selected_folder      = l_path
    EXCEPTIONS
      cntl_error           = 1
      error_no_gui         = 2
      not_supported_by_gui = 3
      OTHERS               = 4.
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
  ENDIF.

  MOVE l_path TO p_p_folder.
ENDFORM.                    " SELECT_FOLDER

2 comments:

  1. Thanks for sharing these. It’s always useful to get pointers to the good blogs out there.
    SAP ERP Users Email List offered by Parana Impact will help your organization fill in the blanks in your databases.

    ReplyDelete
  2. WynnBET Mobile app review & bonus: $50 free on your first
    WynnBET 시흥 출장안마 mobile 경기도 출장샵 app review & bonus: $50 free on your first 2 deposits. WynnBET has a great new 나주 출장마사지 customer sign 하남 출장마사지 up 세종특별자치 출장마사지 bonus for existing customers.

    ReplyDelete