‎2009 Sep 14 2:36 PM
‎2009 Sep 14 2:43 PM
‎2009 Sep 14 2:43 PM
‎2009 Sep 14 3:06 PM
i have a internal table that I attach to an email in a txt file
‎2009 Sep 14 3:12 PM
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
‎2009 Sep 14 3:15 PM
Hello,
Use SAP reference program BCS_EXAMPLE_2 for the basic idea.
Further details on SDN.
Suhas
‎2009 Sep 14 4:11 PM
Hie
To attach an internal table and send to mail please try using the FM
SO_NEW_DOCUMENT_ATT_SEND_API1You will achieve your goal.
regards
Isaac Prince
‎2009 Sep 14 4:16 PM
‎2009 Sep 14 4:18 PM
Popular? Yes, it's very popular. I've used it before in many programs.
‎2009 Sep 14 4:20 PM
But the translator software the OP is using is very poor in translating )
‎2009 Sep 14 4:20 PM
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
‎2009 Sep 14 4:22 PM
‎2009 Sep 14 6:53 PM
if you got answer please select the answered post and close the thread
‎2009 Sep 14 3:13 PM
hi,
can you show the code and tell where you have problems?
regards, Dieter
‎2009 Sep 14 3:16 PM
‎2009 Sep 14 3:52 PM
I can not convert the contents of internal table in the file by email attachment
‎2009 Sep 14 3:58 PM
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
‎2009 Sep 14 4:08 PM
????asked me to send mail to the lines drawn in the report. secodn ovoi what is the best solution