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: 

Error with the data format in the TXT file, sending as an Email attachment

Former Member
0 Kudos

Hi all,

I have an problem in the data formating in the TXT file while sending as an attachment via an email by using the FM "SO_DOCUMENT_SEND_API1".

For eg:

The data in the TXT file is looking like as follows:

0 0 0 0 2 L O U D S P E A K R O T H E R 3 8 W h i t e 0 0

0031 L O U D S P E A K R O T H E R 3 8 Black 0 000

38 L O U D S P E A K R O T H E R 3 8 Brown 0 00040

L O U D S P E A K R O T H E R 3 8 Brown 0 00042

.

.

.

and so on

But it should come as :

0 0 0 0 2 L O U D S P E A K R O T H E R 3 8 W h i t e

0 0 0031 L O U D S P E A K R O T H E R 3 8 Black

0 00038 L O U D S P E A K R O T H E R 3 8 Brown

0 00040 L O U D S P E A K R O T H E R 3 8 Brown

All the internal tables are correctly filled.

The code is as follows:

gwa_objtxt = 'Please find attached DATA EXTRACT Sheet'.

append gwa_objtxt to git_objtxt.

describe table git_objtxt lines gv_cnt.

clear git_doc_data.

read table git_objtxt index gv_cnt.

git_doc_data-doc_size = ( gv_cnt - 1 ) * 255 + strlen( gwa_objtxt ).

git_doc_data-obj_langu = sy-langu.

git_doc_data-obj_descr = lv_mtitle.

append git_doc_data.

clear git_packing_list.

refresh git_packing_list.

  • git_packing_list-transf_bin = space.

git_packing_list-head_start = 1.

git_packing_list-head_num = 0.

git_packing_list-body_start = 1.

git_packing_list-body_num = gv_cnt.

git_packing_list-doc_type = 'RAW'.

append git_packing_list.

Clear : gv_cnt.

Describe table git_objbin lines gv_cnt.

git_packing_list-transf_bin = 'X'.

git_packing_list-head_start = 1.

git_packing_list-head_num = 1.

git_packing_list-body_start = 1.

git_packing_list-body_num = gv_cnt.

git_packing_list-doc_type = 'TXT'.

git_packing_list-obj_descr = 'ATTACH.TXT'.

git_packing_list-obj_name = 'book'.

git_packing_list-doc_size = gv_cnt * 255.

APPEND git_packing_list.

clear git_receivers.

refresh git_receivers.

git_receivers-receiver = gv_eid.

git_receivers-rec_type = 'U'.

append git_receivers.

*

CALL FUNCTION 'SO_DOCUMENT_SEND_API1'

EXPORTING

DOCUMENT_DATA = git_doc_data

PUT_IN_OUTBOX = 'X'

COMMIT_WORK = 'X'

TABLES

PACKING_LIST = git_packing_list

CONTENTS_BIN = git_objbin

CONTENTS_TXT = git_objtxt

RECEIVERS = git_receivers

EXCEPTIONS

TOO_MANY_RECEIVERS = 1

DOCUMENT_NOT_SENT = 2

DOCUMENT_TYPE_NOT_EXIST = 3

OPERATION_NO_AUTHORIZATION = 4

PARAMETER_ERROR = 5

X_ERROR = 6

ENQUEUE_ERROR = 7

OTHERS = 8.

2 REPLIES 2

Former Member
0 Kudos

Hi,

Try replacing 'TXT' in the place of 'RAW' in the code below...

git_packing_list-doc_type = 'RAW'.

regards,

madhu

Former Member
0 Kudos

please give the code of

contents bin = git_objbin " how this is getting populated.

0 0 0 0 2 L O U D S P E A K R O T H E R 3 8 W h i t e <b>0 0</b>

0031 L O U D S P E A K R O T H E R 3 8 Black

0 000

38

from this im not able to understand is this over population or concatenation problem

y dont u make a append to the final table

like

data : begin of itxt occurs 0, ,

s1(132) type c ,

end of itxt.

loop at itab.

itxt-s1+0(4) = itab-f1.

itxt-s1+4(6) = itab-f2.

itxt-s1+10(8) = itab-f3.

itxts1+18(4) = itab-f4.

append itxt.

clear itxt.

endloop.

exchange this to the contents bin of hte Fm .

regards,

vijay.

can u please mail the text file and the expected o/p to my mail id kshitij_kv5@yahoo.co.in so that i can see the same from the data provided i m not able to check the result properly .