Function Module to get file extension name

In this tutorial, I will discuss with you some standard SAP Function Modules that can be used to get the extension name of a given file such as PDF, DOC, XLS etc.

The first one that I want to show is the FM SCTS_EXE_FILE. It has two input parameters and one output which is the extension name. As seen from this screenshot below. I tested a file having two periods(.) to check if the FM can still recognize the extension name of a given file. As expected, it outputs the correct extension name. So our mark for this FM, PASSED.





The second FM is CRM_IC_WZ_UTILITIES. Just like the first FM above, I tested the same having two periods on the filename. This is to ensure that it takes the correct extension name once processing is done. Voila, as seen below, PDF was taken from the input name filename.file.pdf. So our mark for this FM, PASSED.




In this third FM, PC_SPLIT_COMPLETE_FILENAME, it has two input parameters and five outputs. This time, my test data failed. Using the same file like the one above, nothing was returned as output as seen below. I did not debug anymore this FM to know where it commits the error. But one thing I am sure, it can not be used in this case having two periods in a filename. So our mark for this FM, FAILED.





On this last FM, i used the same data, filename.file.pdf. Amazingly, it returns an output unlike the third FM which returns nothing. But as can be seen below, the extension name that it returns is a part of the filename itself and not the extension name. It takes the first period of a filename whereas it must take the rightmost one. So our mark for this FM, FAILED.




I hope I shared to you some insights which FM can be used if your requirement is to take the extension name of a given filename. Enjoy reading my blog. :)

How to download the data structure of tables in SE11?

Good morning people around the world. Its me again doing some blogs. Sharing to you some tips and tricks in the SAP world. Well, before I s...