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

problem sending mail

Former Member
0 Likes
1,509

I attach the contents of a table inside a mail as I do?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,473

HI,

Can you explain your question properly..?

regards,

surya

16 REPLIES 16
Read only

Former Member
0 Likes
1,474

HI,

Can you explain your question properly..?

regards,

surya

Read only

0 Likes
1,473

i have a internal table that I attach to an email in a txt file

Read only

0 Likes
1,473

Hi,

yes you can attach an iternal table to a mail please use the following sample code.

*&----


*

*& Form F_SEND_MAIL

*&----


*

  • text

*----


*

  • <--P_I_FINAL text

*----


*

FORM F_SEND_MAIL CHANGING P_I_FINAL.

DATA:V_MESSAGE1(250),

V_MESSAGE2(250),

L_V_DATE TYPE CHAR10.

  • Begin of change UPG6_Obj1932 by MOHANTSK CTS TD6K902020

  • CONSTANTS TAB_MARK TYPE X VALUE '09'.

CONSTANTS TAB_MARK TYPE C VALUE '09'.

*CONSTANTS CR_MARK TYPE X VALUE '0D'.

CONSTANTS CR_MARK TYPE C VALUE '0D'.

  • End of change UPG6_Obj1932 by MOHANTSK CTS TD6K902020

DATA L_V_FILENAME TYPE CHAR40.

MESSAGE = TEXT-013.

APPEND MESSAGE.

MESSAGE = ''.

APPEND MESSAGE.

CONCATENATE SY-DATUM+4(2)

'/'

SY-DATUM+6(2)

'/'

SY-DATUM+0(4)

INTO L_V_DATE.

CONCATENATE TEXT-009 S_TPLNR-LOW TEXT-010 L_V_DATE INTO MESSAGE

SEPARATED BY SPACE.

APPEND MESSAGE.

MESSAGE = ''.

APPEND MESSAGE.

MESSAGE = ''.

APPEND MESSAGE.

MESSAGE = TEXT-014.

APPEND MESSAGE.

LOOP AT I_FINAL INTO WA_FINAL.

CONCATENATE CR_MARK WA_FINAL-TPLNR TAB_MARK WA_FINAL-PLTXT TAB_MARK

WA_FINAL-EQFNR TAB_MARK WA_FINAL-EQUNR TAB_MARK WA_FINAL-EQKTX

INTO OBJTXT.

APPEND OBJTXT.

CLEAR OBJTXT.

ENDLOOP.

DESCRIBE TABLE MESSAGE LINES SY-TFILL.

OBJPACK-DOC_SIZE = SY-TFILL * 255.

OBJPACK-TRANSF_BIN = 'X'.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 0.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = SY-TFILL.

OBJPACK-DOC_TYPE = 'RAW'.

OBJPACK-OBJ_NAME = 'ATTACHMENT'.

OBJPACK-OBJ_DESCR = 'equipe'.

APPEND OBJPACK.

CONCATENATE TEXT-012 SY-DATUM '.xls' INTO L_V_FILENAME.

DESCRIBE TABLE OBJTXT LINES SY-TFILL.

OBJPACK-DOC_SIZE = SY-TFILL * 255.

OBJPACK-TRANSF_BIN = ' '.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 1.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = SY-TFILL.

OBJPACK-DOC_TYPE = 'XLS'.

OBJPACK-OBJ_NAME = 'ATTACHMENT'.

OBJPACK-OBJ_DESCR = L_V_FILENAME.

APPEND OBJPACK.

CONCATENATE TEXT-011 S_TPLNR-LOW TEXT-010 SY-DATUM INTO V_SUBJECT

SEPARATED BY SPACE.

DOC_CHNG-OBJ_NAME = 'Mail'.

DOC_CHNG-OBJ_LANGU = 'E'.

DOC_CHNG-OBJ_DESCR = V_SUBJECT.

*Receivers

RECLIST-REC_TYPE = 'C'..

RECLIST-RECEIVER = P_DLIST.

RECLIST-EXPRESS = 'X'.

APPEND RECLIST.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

DOCUMENT_DATA = DOC_CHNG

PUT_IN_OUTBOX = 'X'

COMMIT_WORK = 'X' "TD6K900416

TABLES

PACKING_LIST = OBJPACK

CONTENTS_BIN = MESSAGE

CONTENTS_TXT = OBJTXT

RECEIVERS = RECLIST

  • 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.

.

IF SY-SUBRC = 0.

WRITE :/5 'MAIL SENT SUCCESSFULLY TO THE BELOW LIST : ' COLOR 4,

/5 P_DLIST COLOR 3.

ENDIF.

ENDFORM. " F_SEND_MAIL

thanks,

Venkat

Edited by: Annamaneni Venkat on Sep 14, 2009 4:12 PM

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,473

Hello,

Use SAP reference program BCS_EXAMPLE_2 for the basic idea.

Further details on SDN.

Suhas

Read only

0 Likes
1,473

Hie

To attach an internal table and send to mail please try using the FM

SO_NEW_DOCUMENT_ATT_SEND_API1

You will achieve your goal.

regards

Isaac Prince

Read only

0 Likes
1,473

have some examples of how popular the function?

Read only

0 Likes
1,473

Popular? Yes, it's very popular. I've used it before in many programs.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,473

But the translator software the OP is using is very poor in translating )

Read only

0 Likes
1,473

Hi,

sorry, but do you search in SDN????

Lot of examples.

Try it and if you get problems, show these and perhaps someone can help.

Regards, Dieter

Read only

0 Likes
1,473

thk

Read only

0 Likes
1,473

if you got answer please select the answered post and close the thread

Read only

Former Member
0 Likes
1,473

hi,

can you show the code and tell where you have problems?

regards, Dieter

Read only

Former Member
0 Likes
1,473

Hi,

Refer to the following link to find out the required code:

Regards,

Rajesh Kumar

Read only

0 Likes
1,473

I can not convert the contents of internal table in the file by email attachment

Read only

0 Likes
1,473

Hi,

Why you need to convert the contents of internal table. that code was to convert SAP Script output into PDF and put that into an internal table. you can just refer to the code which is used to attach that internal table ti send as email.

Regards,

Rajesh kumar

Read only

0 Likes
1,473

????asked me to send mail to the lines drawn in the report. secodn ovoi what is the best solution