Application Development and Automation 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: 
Read only

Uploading file

ramesh_putta
Participant
0 Likes
834

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.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
784

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

6 REPLIES 6
Read only

Former Member
0 Likes
785

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

Read only

0 Likes
784

You can use FIND command with MATCH COUNT addition to get the number of times tab character appears.

Regards,

Shravan

Read only

Former Member
0 Likes
784

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..

Read only

ramesh_putta
Participant
0 Likes
784

Thank you guys.. your suggesions did help me.

Read only

ramesh_putta
Participant
0 Likes
784

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?

Read only

0 Likes
784

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