‎2012 Jul 05 8:45 PM
Hi,
I have a program where it uploads two types of files.
User can select the radio button which file he wants to upload. The program uses the GUI_UPLOAD to upload the file.
My problem is, how do i validate the file the user uploads.
For example, if the user selects the A radio button and upload the B file, then how do i let the user know that he selected wrong file?
The problem is first 5 columns of both A and B structures are same. the only difference between A structure and B structure is number of fields.
A has 7 and B has 9.
Please let me know if there is a way to count the number of tab delimited columns uploaded into internal table. that way i can count the columns and validate them agains the radio button selected.
thanks for you help.
‎2012 Jul 05 8:51 PM
Hi Rampso,
You can count the number of tabs in the line of the internal table (Tab = cl_abap_har_utilities=>horizontal_tab).
If it is incorrect for the file type selected throw an error.
Regards,
Shravan
‎2012 Jul 05 8:51 PM
Hi Rampso,
You can count the number of tabs in the line of the internal table (Tab = cl_abap_har_utilities=>horizontal_tab).
If it is incorrect for the file type selected throw an error.
Regards,
Shravan
‎2012 Jul 05 8:56 PM
You can use FIND command with MATCH COUNT addition to get the number of times tab character appears.
Regards,
Shravan
‎2012 Jul 05 9:03 PM
You can created 2 file paths for each file type and enable them like wise
File A
File Path Enable or disable based on radio button.
File B
File Path
Quite simple..
‎2012 Jul 05 9:27 PM
‎2012 Jul 06 4:03 PM
FIND command with MATCH COUNT works Ok but iam having problem when there are some blank tabs at the end of the columns. the program counting those tabs aswell.
rather, is there any way we can count the actuall columns?
‎2012 Jul 06 4:25 PM
Well, how do you really differentiate File A with 7 columns and file B with 9 columns with last two columns as blank.
You can try deleting consecutive tabs before counting the columns.
Can you use a different delimiter like comma separated or Pipe delimited (|).
Regards,
Shravan