Skip to Content

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

separating file name and path

Hi,

I need to separate the file name and path of the file which I am uploading from my BSP appl.I am using SO_SPLIT_FILNAME_PATH ,but it is not working because this fm identifies '\' only from GUI front end.

How do I separate the file name and path in BSP ?

Regards,

Ananya

replied

Assuming that you are using File Upload tag for file upload:

DATA: fileUpload TYPE REF TO CL_HTMLB_FILEUPLOAD.
fileUpload ?= CL_HTMLB_MANAGER=>GET_DATA(
                       request = request
                       id      = 'myUpload'
                       name    = 'fileUpload' ).

file_name      = fileUpload->file_name.
file_mime_type = fileUpload->file_content_type.
file_length    = fileUpload->file_length.
file_content   = fileUpload->file_content.

Data : filepath type string,
       filename type string,
       t1 type string.

filepath = file_name .

while filepath CA ''.

  split filepath at '' into t1 filename.

endwhile.

In my sample code above, filename attribute will contain the name of the file uploaded.

Hope this solves the problem.

Regards,

Ravikiran.

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