cancel
Showing results for 
Search instead for 
Did you mean: 

when export itab data to *.txt,how to keep the data format?

Former Member
0 Kudos

i want to export the data to .txt file, now i have do the things ,but the data format have some questions.

you konw ,the itab data format is :

a b c;

a1 b1 c1;

a2 b2 c2;

but now the data format of export file is like this:

a b c; a1 b1

c1;a2 b2 c2;

code:

××××××××××××××××××××××××××××××××××××××××××××××

data: l_rbetr type string.

loop at LT_ZREUGH_D into LS_ZREUGH.

if ls_zreugh-zfkzt ne 'X'.

l_rbetr = LS_ZREUGH-rbetr.

concatenate TEXT LS_ZREUGH-zbukr into TEXT.

concatenate TEXT

LS_ZREUGH-prctr

LS_ZREUGH-laufi

LS_ZREUGH-laufd

LS_ZREUGH-lifnr

LS_ZREUGH-name1

LS_ZREUGH-zbnkn

LS_ZREUGH-zbnkl

l_rbetr

LS_ZREUGH-rzawe

LS_ZREUGH-hktid

LS_ZREUGH-hbkid

LS_ZREUGH-bankn

LS_ZREUGH-text1

LS_ZREUGH-zfkzt

CL_ABAP_CHAR_UTILITIES=>NEWLINE

into TEXT separated by

CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB.

endif.

endloop.

call function 'SCMS_STRING_TO_XSTRING'

EXPORTING

TEXT = TEXT

ENCODING = '8400'"8400

IMPORTING

BUFFER = XTEXT.

WDR_TASK=>CLIENT_WINDOW->CLIENT->ATTACH_FILE_TO_RESPONSE(

**path to the word file

I_FILENAME = 'FuKuan.TXT'

  • String Variable

I_CONTENT = XTEXT

  • File Type

I_MIME_TYPE = 'NOTEPAD' )."

××××××××××××××××××××××××××××××××××××××××××××××××

what i can do to solve the question,?i will wait for answer on line.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Please check out this link -

Regards

Lekha

Answers (3)

Answers (3)

Former Member
0 Kudos

i have solved the question,thank you.

uday_gubbala2
Active Contributor
0 Kudos

Hi Windlei,

How did you resolve the problem? Was it using the same methods prescribed by the members or had you come up with any workaround method? Please share it in here so that it would be useful for other members in the future.

Regards,

Uday

Former Member
0 Kudos

Hi,

Please check this forum thread and find the answers given by thomas and Abhimanyu.

Former Member
0 Kudos

Hi,Lekha

thank you for your question,and now i just use the way you have adviese,but still have the question .

maybe i should describe my question again.

you know when you export the data of intertal table to excel, the data will have the correct format.every row will still be a row, such as ,

-


row1. | a | b | c |

row2. | a1 | b1 | c1 |

row3. | a2 | b2 | c2 |

but now the data can't keep the format correctly.such as

-


row1. | a | b | c | | a1 | b1 | c1 | | a2 |

row2. b2 | c2 |

-


i don't know how to slove the quesion.help