Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Customized Transaction

Hello Guru,

I've created a new transaction called ZTEST which should transmet some values to another transaction called ZTESTPRIMITIVE which then call a program that show us an external program.

Now, this first transaction ZTEST should be a client specific, each client has different PATH for the external program, every client should add in the transaction ZTEST the PATH and the PROGRAM name.

The problem that when I tippe down the path of that program, it tell's me that some caracters are not allowed, e.g. C:\folder1\folder2 is not permitted, i.e. \, :, ., ...

The same thing happens by PROGRAM.

Remember that transaction ZTEST use ZTESTPRIMITIVE that then set the path and the program and call the external program.

The transaction ZTEST has inside two parameters PATH and PROGRAM.

Thank you for helping me.

Bye.

Tags:
Former Member
Former Member replied

Hi,

If you want to get the FileName and path, instead of typing it on your own use the below code;

This allows you to select the filename by providing a file open dialog box;

Use the Method file_open_dialog of class cl_gui_frontend_services as given below.

DATA:
    lt_filetable TYPE filetable,
    lf_rc        TYPE i,
    lv_filename(50) TYPE c,
    lv_fileext(3) TYPE c,
    ls_file TYPE file_table,
    lv_file TYPE localfile,
    lv_title TYPE string.

  lv_title = sy-title.
  lv_progname = sy-cprog.

  CALL METHOD cl_gui_frontend_services=>file_open_dialog
    EXPORTING
      window_title            = lv_title
      file_filter             = '*.txt'
      multiselection          = abap_false
    CHANGING
      file_table              = lt_filetable
      rc                      = lf_rc
    EXCEPTIONS
      file_open_dialog_failed = 1
      cntl_error              = 2
      error_no_gui            = 3
      not_supported_by_gui    = 4
      OTHERS                  = 5.

  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE 'S' NUMBER sy-msgno
               DISPLAY LIKE 'E'
               WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    EXIT.
  ENDIF.

* Number of selected filed must be equal to one.
  CHECK lf_rc = 1.

* Access selected file
  READ TABLE lt_filetable INTO ls_file INDEX 1.

  CHECK sy-subrc = 0.

  lv_file = ls_file-filename.

  SPLIT lv_file AT '.' INTO lv_filename lv_fileext.

Revert back if you need clarifications.

Regards

Karthik D

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question