Skip to Content
author's profile photo Former Member
Former Member

Unicode Errors

Hi ABAPpers,

I am getting the Unicode error as

Upload/Ws_Upload and Download/Ws_Download are obsolete, since they are not

Unicode-enabled; use the class cl_gui_frontend_services

in the below code

CALL FUNCTION 'UPLOAD'

EXPORTING

FILENAME = 'C:\'

FILETYPE = 'DAT'

IMPORTING

ACT_FILENAME = P_FILENAME

TABLES

DATA_TAB = I_FILE

EXCEPTIONS

CONVERSION_ERROR = 1

INVALID_TABLE_WIDTH = 2

INVALID_TYPE = 3

NO_BATCH = 4

UNKNOWN_ERROR = 5

OTHERS = 6.

CASE SY-SUBRC.

WHEN '1'. MESSAGE E014(ZV) WITH 'Conversion_error'.

WHEN '2'. MESSAGE E014(ZV) WITH 'Invalid_table_width'.

WHEN '3'. MESSAGE E014(ZV) WITH 'Invalid_type'.

WHEN '4'. MESSAGE E014(ZV) WITH 'No_batch'.

WHEN '5'. MESSAGE E014(ZV) WITH 'Unknown_error'.

WHEN '6'. MESSAGE E014(ZV) WITH 'Others'.

ENDCASE.

Now I want to chage the function module UPLOAD to GUI_UPLOAD but the problem is importing parameter ACT_FILENAME is not their in GUI_UPLOAD.

How to correct this error.

Please Reply.

Thanks and Regard,

Rahul Sinha

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

4 Answers

  • author's profile photo Former Member
    Former Member
    Posted on May 21, 2009 at 12:59 PM

    Hi,

    UPLOAD function module automatically provides a popup which is not available with GUI_UPLOAD. You have to use 2 methods. Here is a example

    After File open dialog the valiable W_P_FILE will be same as ACT_FILENAME and W_P_FILE will be used in GUI_UPLOAD

    DATA : I_FILE_TABLE TYPE  TABLE OF FILE_TABLE, 
           W_FILETABLE  TYPE  FILE_TABLE,
           W_RC         TYPE  I,
           W_P_FILE     TYPE  STRING,
           prc_user_action TYPE I.
    CONSTANTS: C_ASC(10)  TYPE  C VALUE 'ASC'. 
    
      W_P_FILE =  'C:\'.
         CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
           EXPORTING
    *         WINDOW_TITLE            =
    *         DEFAULT_EXTENSION       =
              DEFAULT_FILENAME        = W_P_FILE
    *         FILE_FILTER             = 
    *         WITH_ENCODING           =
    *         INITIAL_DIRECTORY       =
    *         MULTISELECTION          =
           CHANGING
              FILE_TABLE              = I_FILE_TABLE
              RC                      = W_RC 
              USER_ACTION             = prc_user_action
    *         FILE_ENCODING           =
           EXCEPTIONS
             FILE_OPEN_DIALOG_FAILED = 1
             CNTL_ERROR              = 2
             ERROR_NO_GUI            = 3
             NOT_SUPPORTED_BY_GUI    = 4
             others                  = 5      .
         IF sy-subrc = 0
      AND prc_user_action NE 
      CL_GUI_FRONTEND_SERVICES=>ACTION_CANCEL.
     LOOP AT I_FILE_TABLE INTO W_FILETABLE.
      W_P_FILE = W_FILETABLE-FILENAME.
      EXIT  .
     ENDLOOP.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 21, 2009 at 01:06 PM

    Remaining code

    CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          FILENAME                      = W_P_FILE
          FILETYPE                      = C_ASC
          HAS_FIELD_SEPARATOR           = 'X'
        TABLES 
          DATA_TAB                      = W_TAB
       EXCEPTIONS
         FILE_OPEN_ERROR               = 1
         FILE_READ_ERROR               = 2
         NO_BATCH                      = 3
         GUI_REFUSE_FILETRANSFER       = 4 
         INVALID_TYPE                  = 5 
         NO_AUTHORITY                  = 6
         UNKNOWN_ERROR                 = 7
         BAD_DATA_FORMAT               = 8
         HEADER_NOT_ALLOWED            = 9
         SEPARATOR_NOT_ALLOWED         = 10 
         HEADER_TOO_LONG               = 11
         UNKNOWN_DP_ERROR              = 12
         ACCESS_DENIED                 = 13
         DP_OUT_OF_MEMORY              = 14
         DISK_FULL                     = 15
         DP_TIMEOUT                    = 16 
         OTHERS                        = 17
              .
      IF SY-SUBRC NE 0.
       MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ENDIF.

    PS : Had to post this separately due to the character limit

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 21, 2009 at 01:54 PM

    Hi ,

    WS_UPLOAD , UPLOAD etc. function modules are obsolete.

    So use the GUI_UPLOAD and GUI_DOWNLOAD of the class

    cl_gui_frontend_services , that issue will be relosved

    Check the code - -

    CALL METHOD cl_gui_frontend_services=>gui_upload " To upload the file into int. table
      EXPORTING
        FILENAME                = 'C:\' " Specify the full file path
    *    FILETYPE                = 'ASC'  " Specify the desired file type
    *    HAS_FIELD_SEPARATOR     = SPACE
    *    HEADER_LENGTH           = 0
    *    READ_BY_LINE            = 'X'
    *    DAT_MODE                = SPACE
    *    CODEPAGE                = SPACE
    *    IGNORE_CERR             = ABAP_TRUE
    *    REPLACEMENT             = '#'
    *    VIRUS_SCAN_PROFILE      =
    *  IMPORTING
    *    FILELENGTH              =
    *    HEADER                  =
      CHANGING
        data_tab                = I_FILE " Internal table where data will be uploaded
      EXCEPTIONS
        FILE_OPEN_ERROR         = 1
        FILE_READ_ERROR         = 2
        NO_BATCH                = 3
        GUI_REFUSE_FILETRANSFER = 4
        INVALID_TYPE            = 5
        NO_AUTHORITY            = 6
        UNKNOWN_ERROR           = 7
        BAD_DATA_FORMAT         = 8
        HEADER_NOT_ALLOWED      = 9
        SEPARATOR_NOT_ALLOWED   = 10
        HEADER_TOO_LONG         = 11
        UNKNOWN_DP_ERROR        = 12
        ACCESS_DENIED           = 13
        DP_OUT_OF_MEMORY        = 14
        DISK_FULL               = 15
        DP_TIMEOUT              = 16
        NOT_SUPPORTED_BY_GUI    = 17
        ERROR_NO_GUI            = 18
        others                  = 19
            .
    IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

    Similarly use the gui_download of class cl_gui_frontend_services to download

    the the contents of the internal table to a file of presentation server.

    CALL METHOD cl_gui_frontend_services=>gui_download
      EXPORTING
    *    BIN_FILESIZE              =
        filename                  = 'C:\' " Specify the fine name with path
    *    FILETYPE                  = 'ASC'
    *    APPEND                    = SPACE
    *    WRITE_FIELD_SEPARATOR     = SPACE
    *    HEADER                    = '00'
    
          .
          .
          .
      changing
        data_tab                  = i_file " Internal table that contains the data
      EXCEPTIONS
        FILE_WRITE_ERROR          = 1
        NO_BATCH                  = 2
       .
       .
    

    Regards

    Pinaki

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on May 22, 2009 at 09:15 AM

    Thanks

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.