Application Development 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: 

CSV file Format Error

Former Member
0 Kudos

Hi All,

I'm down loading text file data to CSV format,it's downloading to CSV As each field is not separating the output is comming like:

01;OPA01/2009;063840045;P;20090122;1;2009;2000.00;AV00612/ADVANCE;;4000145004501/20

the CSV file has to be :

01 | PA01/2009 | 063840045 | P | 2009122 |.

I followed the logic is:

CALL FUNCTION 'SAP_CONVERT_TO_CSV_FORMAT'

EXPORTING

i_field_seperator = '|'

TABLES

i_tab_sap_data = itab

CHANGING

i_tab_converted_data = itab1

EXCEPTIONS

conversion_failed = 1

OTHERS = 2.

IF sy-subrc NE 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

Please help one this..

Thank you..

Srii...

9 REPLIES 9

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi.

Please try here.

CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'

p.s.

Because SAP_CONVERT_TO_CSV_FORMAT uses a fixed value for the separator[;].

Former Member
0 Kudos

Hi,

I try it with SAP_CONVERT_TO_TEX_FORMAT and works well

constants:C_FIELD_SEPARATOR type c value '|'.

CALL FUNCTION 'SAP_CONVERT_TO_TEX_FORMAT'

EXPORTING

I_FIELD_SEPERATOR = C_FIELD_SEPARATOR

  • I_LINE_HEADER = I_LINE_HEADER

  • I_FILENAME = I_FILENAME

TABLES

I_TAB_SAP_DATA = itab

CHANGING

I_TAB_CONVERTED_DATA = itab1

EXCEPTIONS

CONVERSION_FAILED = 1.

Best regards.

0 Kudos

Thank q very much for ur help and I'll award points ...now its downloading fine..

But wn this downloaded CSV file i want to upload.

this CSV file is not clearly seperated according to coloumns ..

Like

the CSV file now downloading format is:

A B C D E

01 | OPA01/2009 | 063840045 |

02 | OPA01/2009 | 073840046 |

It only will upload when we can see to CSV file : A | B | C |

01 | OPA01/2009 | 063840045 |

02 | OPA01/2009 | 073840046 |

Suggest me on this...

thank you.

Srii

Edited by: sridhar reddy on Apr 2, 2009 5:06 AM

Edited by: sridhar reddy on Apr 2, 2009 5:07 AM

Edited by: sridhar reddy on Apr 2, 2009 5:08 AM

Edited by: sridhar reddy on Apr 2, 2009 5:41 AM

0 Kudos

any suggestion please..

Former Member
0 Kudos

No replays getting so leave this I'll try to post new one

0 Kudos

Hi Sreedhar

Is your issue with header data??

regards

sas

If so just when ayou are passing the header details just make sure that they are seperated by '|' and append them to INTERNAL table and pass to the download details....this will solve your problem...

Edited by: saslove sap on Apr 2, 2009 11:11 AM

Former Member
0 Kudos

Yes this is master data.. but y this CSV file downloading with ';' .

help me on this

Former Member
0 Kudos

Answered