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: 

Email from SAP data format problem

Former Member
0 Kudos

Hi ,

I am facing problem in formatting the data sent via mail using SAP function module.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

document_data = doc_chng

put_in_outbox = 'X'

TABLES

packing_list = objpack

object_header = objhead

contents_bin = objbin

contents_txt = objtxt

receivers = reclist

EXCEPTIONS

too_many_receivers = 1

document_not_sent = 2

operation_no_authorization = 4

OTHERS = 99.

when i fill the body of the email

i fill it from multiple entries from an internal table like

      • only staring point of every field

LOOP AT itab INTO wa.

objtxt-line+0 = wa-bname.

objtxt-line+15 = wa-trdat.

objtxt-line+35 = wa-modda.

APPEND objtxt. CLEAR objtxt.

ENDLOOP.

or

      • staring point and length of every field

LOOP AT itab INTO wa.

objtxt-line+0(15) = wa-bname.

objtxt-line+15(20) = wa-trdat.

objtxt-line+35(20) = wa-modda.

APPEND objtxt. CLEAR objtxt.

ENDLOOP.

or

      • only staring point of every field(field length according to data element of the field)

LOOP AT itab INTO wa.

objtxt-line+0(12) = wa-bname.

objtxt-line+12(8) = wa-trdat.

objtxt-line+20(8) = wa-modda.

APPEND objtxt. CLEAR objtxt.

ENDLOOP.

in all the cased the data is not coming in correct format.

The data is coming as below.

User-Id Last Login Date Last Change

xxxxxx 20070727 20070727

xxxxxxyy 20070727 20070727

xxxxxxyyzz 20070727 20070727

As i increase the field values from 6 to 8 to 10, the next fields are not aligned properly.

I have tried in many ways but i am unable to arrange them properly

I found a way in SDN (previous forums) to implement it by making it as script or smartform, but i may do that because it is a pure report.

I want the values in the mail to be displayed as below.

User-Id Last Login Date Last Change

xxxxxx 20070727 20070727

xxxxxxyy 20070727 20070727

xxxxxxyyzzz 20070727 20070727

Please help me in getting the right allignment in the mail body.

Thanks,

Kiran.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

2 REPLIES 2

Former Member
0 Kudos

0 Kudos

Thank you.