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

File upload.

sachin_mathapati
Contributor
0 Likes
1,313

Hi All,

There is a text file which has special character at the end of every line.

I am uploading this text file into SAP using FM 'GUI_UPLOAD'.

Because of this special character, the data is not uploading into SAP properly.

Any pointers to resolve the above problem.

Thanks and Regards,

Sachin M M

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,258

Try to convert your XLS data to SAP.

Using below FM

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

I_LINE_HEADER = ''

I_TAB_RAW_DATA = IT_RAW " WORK TABLE

I_FILENAME = P_SOURCE

TABLES

I_TAB_CONVERTED_DATA = IT_DATATAB[] "ACTUAL DATA

EXCEPTIONS

CONVERSION_FAILED = 1

OTHERS = 2.

IF SY-SUBRC EQ 0.

WRITE: 'ok'.

ENDIF.

Hope this helps.

Regards,

Neha Rai

8 REPLIES 8
Read only

Former Member
0 Likes
1,258

before passing the internal table to GUI_UPLOAD..

please remove that spl character from Internal table...

using replace stmt...

Read only

Former Member
0 Likes
1,258

Run a Check on the uploaded data (internal table) by looping through line by line (work area),

by using the statement -

IF <line> CN 'ABCDEFGH......1234567890'.

<discard line from being upload>

ENDIF.

Have you tried this approach already??

Regards

Dedeepya C

Read only

Former Member
0 Likes
1,259

Try to convert your XLS data to SAP.

Using below FM

CALL FUNCTION 'TEXT_CONVERT_XLS_TO_SAP'

EXPORTING

  • I_FIELD_SEPERATOR =

I_LINE_HEADER = ''

I_TAB_RAW_DATA = IT_RAW " WORK TABLE

I_FILENAME = P_SOURCE

TABLES

I_TAB_CONVERTED_DATA = IT_DATATAB[] "ACTUAL DATA

EXCEPTIONS

CONVERSION_FAILED = 1

OTHERS = 2.

IF SY-SUBRC EQ 0.

WRITE: 'ok'.

ENDIF.

Hope this helps.

Regards,

Neha Rai

Read only

Former Member
0 Likes
1,258

What is the file type you are using?

Read only

0 Likes
1,258

Hi Vikranth,

I am using 'ASC' file type.

Regards,

Sachin M M

Read only

0 Likes
1,258

Hi Sachin,

Make sure you make has_field_seperator as 'X' if the text file is tab seperated. And did you declare a field for the special variable too in the upload internal table? If so what is the type of that field?

Vikranth

Read only

Former Member
0 Likes
1,258

Hi,,

to read the special character upload the excel file using FM

ALSM_EXCEL_TO_INTERNAL_TABLE

this will uplaod the special char as well.

hope this will help you in resolving your query

thanks,

tanmaya

Read only

sachin_mathapati
Contributor
0 Likes
1,258

thanks