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

Upload .CSV file - Long text problem

Former Member
0 Likes
1,198

Hi All,

I am uploading .CSV file format through FM 'GUI_UPLOAD'. After that I am Splitting the record using SPLIT itab-rec at '"' into w_var it_asset-bukrs and so on.

****But here I have a TEXT field in that CSV format file. Here the users are entering long text by pressing enter and with special charecters.

When splitting this long text field it was getting failed.

I tried with FM 'ALSM_EXCEL_TO_INTERNAL_TABLE' also. But when this long text come it is getting failed.

Please advice if any alternate is there for this. Like Standard text etc.

Or any FM which will handle better.

Thanks in advance.

Deepak.

Message was edited by:

KDeepak

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
904

Hello Deepak,

Use CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' and then convert.

eg.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = PATH

I_BEGIN_COL = 1

I_BEGIN_ROW = 2

I_END_COL = 6

I_END_ROW = 100

TABLES

INTERN = T_INTERN

EXCEPTIONS

INCONSISTENT_PARAMETERS = 1

UPLOAD_OLE = 2

OTHERS = 3.

LOOP AT T_INTERN INTO WA_INTERN.

CASE WA_INTERN-COL.

WHEN '0001'.

WA_SP-rec = WA_INTERN-VALUE.

WHEN '0002'.

WA_SP-bukrs = WA_INTERN-VALUE.

ENDCASE.

AT END OF ROW.

APPEND WA_SP TO IT_SP.

ENDAT.

ENDLOOP.

Regards,

Neelambari.

5 REPLIES 5
Read only

Former Member
0 Likes
905

Hello Deepak,

Use CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE' and then convert.

eg.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = PATH

I_BEGIN_COL = 1

I_BEGIN_ROW = 2

I_END_COL = 6

I_END_ROW = 100

TABLES

INTERN = T_INTERN

EXCEPTIONS

INCONSISTENT_PARAMETERS = 1

UPLOAD_OLE = 2

OTHERS = 3.

LOOP AT T_INTERN INTO WA_INTERN.

CASE WA_INTERN-COL.

WHEN '0001'.

WA_SP-rec = WA_INTERN-VALUE.

WHEN '0002'.

WA_SP-bukrs = WA_INTERN-VALUE.

ENDCASE.

AT END OF ROW.

APPEND WA_SP TO IT_SP.

ENDAT.

ENDLOOP.

Regards,

Neelambari.

Read only

0 Likes
904

Hi Neelambari,

Thank you very much for your reply.

Once please check my code.

************************************************************************************

DATA : ITAB1 LIKE ALSMEX_TABLINE OCCURS 0 WITH HEADER LINE.

DATA : B1 TYPE I VALUE 1,

C1 TYPE I VALUE 1,

B2 TYPE I VALUE 15,

C2 TYPE I VALUE 65000.

CALL FUNCTION 'ALSM_EXCEL_TO_INTERNAL_TABLE'

EXPORTING

FILENAME = p_p_file3

I_BEGIN_COL = B1

I_BEGIN_ROW = C1

I_END_COL = B2

I_END_ROW = C2

TABLES

INTERN = ITAB1

EXCEPTIONS

INCONSISTENT_PARAMETERS = 1

UPLOAD_OLE = 2

OTHERS = 3.

IF SY-SUBRC <> 0.

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

sort itab1 by row col.

loop at itab1.

clear: v_menge, v_wrbtr.

check sy-tabix GT 11.

case itab1-col.

when '1'.

it_polin1-bukrs = itab1-value.

when '2'.

it_polin1-ebeln = itab1-value.

when '3'.

it_polin1-rcptid = itab1-value.

when '4'.

it_polin1-req_no = itab1-value.

when '5'.

it_polin1-zeile = itab1-value.

when '6'.

it_polin1-ebelp = itab1-value.

when '7'.

it_polin1-txz01 = itab1-value. "<<<---Long text

when '8'.

v_menge = itab1-value.

it_polin1-menge = v_menge.

when '9'.

v_wrbtr = itab1-value.

move v_wrbtr to it_polin1-wrbtr.

when '10'.

it_polin1-waers = itab1-value.

when '11'.

it_polin1-werks = itab1-value.

endcase.

at end of row.

append it_polin1.

clear it_polin1.

endat.

endloop.

***********************************************************************************

Please check it once and advice me with some solution.

Thanks,

Deepak.

Read only

0 Likes
904

Hello Deepak,

If ur getting proper data in it_polin1 then it's fine.

Regards,

Neelambari.

Read only

0 Likes
904

Hi,

Let me tell you how my data is in long text field.

Actually the data is comming from external system. There they are entering this Long text in some kind like 'List box' some thing like that. So they can enter the text as much as they can by pressing 'Enter'.For example I am getting more than 255 char. And also i am gettign the Special charecters.

So what is happening is when it recognizing the 'Enter' in that long text field..... It is considering as New row.

So remaining text is going to next row from BUKRS in my case.

Please advice. This is critical job which I need to handle.

Can i get your email so I can the code.

Thanks for your help.

Regards,

Deepak.

Message was edited by:

KDeepak

Message was edited by:

KDeepak

Read only

gopi_narendra
Active Contributor
0 Likes
904

Check the sample code provided in the WIKI of SDN

https://www.sdn.sap.com/irj/sdn/wiki?path=/display/abap/abap+general&;

Regards

Gopi