Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

problem in file uploading?

Former Member
0 Kudos

hello

experts,

when we are uploading a file name through f4_filename browser, FM the result sometime we have to take in a variable type string otherwise there is a short dump. why such things happens.

10 REPLIES 10

Former Member
0 Kudos

Hi,

Because you are using the function module.

Check the function module. Goto SE37--> FM --> Import parameters. There you can find the Data type for the file name. It will be string.

So if you use otherthan string then datatype mismatch will occur and a short dump occurs.

SE38->Call Function 'FM'-> Exporting filename = p_filename.

p_filename should have the datatype same as filename's datatype in the function module.

Thanks and Best Regards,

Suresh

Former Member
0 Kudos

Hi:

The best way is,

go in se37 -> Put the FM name and click on Where used list, it would display the name of used program name, Just see how the fm is being used with data declaration.

Regards

Shashi

Former Member
0 Kudos

Hi,

For the file_name variable is of type DYNFNAM. i.e. which is of type CHAR132. If you specify it will less lengh, and trying to move the one with more lengh then, it may lead to dump.

So try using the types given the function modules itself.

Regards,

Santhosh.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi,

You have to use

data: p_fname type string .

p_fname = 'C:/temp/sss.xls' .

Path format itu2019s accepted only for string data type, some special character there u2026u2026

Regards,

Ansari.

Former Member
0 Kudos

Hi,

whenever we are using FM for uploading the file, please make sure that import, export and tables and changing parameters which you are passing/accessing should contain same data type, other wise FM will throw a dump

former_member216100
Participant
0 Kudos

use

* Needed for Class CL_GUI_FRONTEND_SERVICES
  DATA: 
   IT_FILTB TYPE FILETABLE,
   V_RETCD TYPE I.
   W_PATH          TYPE STRING VALUE 'C:\xyz\blablabla',
   I_WHATTYPE TYPE STRING.

CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
    EXPORTING
      WINDOW_TITLE            = 'Open File'      "Titel
      FILE_FILTER             = 'all files (*.csv*)|*.CSV*|'   "type of file
      INITIAL_DIRECTORY       = W_PATH     "directory (see value)
      DEFAULT_FILENAME        = I_WHATTYPE 
    CHANGING
      FILE_TABLE              = IT_FILTB
      RC                      = V_RETCD
    EXCEPTIONS
      FILE_OPEN_DIALOG_FAILED = 1
      CNTL_ERROR              = 2
      ERROR_NO_GUI            = 3
      NOT_SUPPORTED_BY_GUI    = 4
      OTHERS                  = 5.

Former Member
0 Kudos

Hi,

Yes in FM F4_FILENAME the filename has to be of type IBIPPARMS-PATH or RLGRAP-FILENAME as follows:

PARAMETER P_FNAME LIKE RLGRAP-FILENAME OBLIGATORY.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR P_FNAME.
  CALL FUNCTION 'F4_FILENAME'
   EXPORTING
*     PROGRAM_NAME        = SYST-CPROG
*     DYNPRO_NUMBER       = SYST-DYNNR
     FIELD_NAME          = 'P_FNAME'
   IMPORTING
     FILE_NAME           = P_FNAME
            .

However if you wish to have the filename as string simply convert:

DATA: P_FNAME2 TYPE STRING.
P_FNAME2 = P_FNAME.

Or vice versa.

Regards.

Former Member
0 Kudos

thanks

Former Member
0 Kudos

thanks