cancel
Showing results for 
Search instead for 
Did you mean: 

How to perform input validation for file type of .XLSX at selection screen?

I have created a program that uploads data from an excel file to a database table. I am using function modules F4_FILENAME and then TEXT_CONVERT_XLS_TO_SAP. How can I make it so that at the selection screen the user can only input a file that ends in XLSX or XLS?

Former Member
0 Kudos

Thank you for visiting SAP Community to get answers to your questions. Since this is your first question, I recommend that you familiarize yourself with: https://community.sap.com/resources/questions-and-answers, as the overview provides tips for preparing questions that draw responses from our members.

Should you wish, you can revise your question by selecting Actions, then Edit. By adding a picture to your profile you encourage readers to respond: https://developers.sap.com/tutorials/community-profile.html
Sandra_Rossi
Active Contributor
0 Kudos

I would recommend CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG instead of F4_FILENAME, the latter is not supported by SAP. There's also the parameter FILE_FILTER to help.

Accepted Solutions (1)

Accepted Solutions (1)

former_member808116
Participant

Hope it helps you

FredericGirod
Active Contributor

Quynh Bui Cong, thans to do a lot of job today, just a little remark, if you post ABAP code, copy past the text, and use the button [CODE] to format it

Answers (1)

Answers (1)

Sandra_Rossi
Active Contributor
0 Kudos

You may use CP (Conforms to Pattern, star character as wildcard). Note that it's case insensitive.

IF p_file CP '*.xlsx' OR p_file CP '*.xls'.
  ...
ENDIF.