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

SO_NEW_DOCUMENT_SEND_API1

Former Member
0 Likes
419

Hi frnds,

My requirement:

subject line should be changed from Customer Name to Customer Name + Credit Memo while sending email to customer.

I am using SO_NEW_DOCUMENT_SEND_API1 fn.mod

and not 'SO_NEW_DOCUMENT_ATT_SEND_API1'.

I am passing these values,

lv_doc_data-OBJ_NAME = 'Credit Memo'.

lv_doc_data-obj_desc = '广州宏亮油泵维修有限公司Credit Memo'

But the attachement file name is also chaning to '广州宏亮油泵维修有限公司Credit Memo' .for this i am getting file name wrong error.

The file name shud not be changed as per my requirement.

Please suggest me some soln.

2 REPLIES 2
Read only

Former Member
0 Likes
339

dear friend

pls go through the code

if helpfull rewards are expecting.

vivek

*--Data declearation

DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 0 WITH HEADER LINE.

DATA: OBJHEAD LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.

DATA: OBJBIN LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.

DATA: OBJTXT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.

DATA: RECLIST LIKE SOMLRECI1 OCCURS 0 WITH HEADER LINE.

DATA: DOC_CHNG LIKE SODOCCHGI1.

DATA: TAB_LINES LIKE SY-TABIX.

DATA: L_MSG(100) TYPE C.

  • Creation of the document to be sent

DOC_CHNG-OBJ_NAME = 'Z2318S1B01'.

DOC_CHNG-OBJ_DESCR = EMSUBJ .

- Begin of update By NDASARI 05/17/2007 -


*OBJTXT = 'your report from apple vacations is enclosed as

  • ATTACHMENT'.

OBJTXT = 'your report from apple vacations is enclosed as ATTACHMENT'.

- End of update By NDASARI 05/17/2007 -


APPEND OBJTXT.

DESCRIBE TABLE OBJTXT LINES TAB_LINES.

READ TABLE OBJTXT INDEX TAB_LINES.

DOC_CHNG-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( OBJTXT ).

  • Creation of the entry for the compressed document

CLEAR OBJPACK.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 0.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = TAB_LINES.

OBJPACK-DOC_TYPE = 'RAW'.

APPEND OBJPACK.

  • Creation of the document attachment

LOOP AT IT_ATTACHMENT.

OBJBIN = IT_ATTACHMENT-EMAIL.

APPEND OBJBIN.

CLEAR OBJBIN.

ENDLOOP.

DESCRIBE TABLE OBJBIN LINES TAB_LINES.

OBJHEAD = 'Airport Mainfest'.

APPEND OBJHEAD.

  • Creation of the entry for the compressed attachment

OBJPACK-TRANSF_BIN = 'X'.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 1.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = TAB_LINES.

OBJPACK-DOC_TYPE = 'RAW'.

OBJPACK-OBJ_NAME = 'ANLAGE'.

OBJPACK-OBJ_DESCR = 'Representation of object 138'.

OBJPACK-DOC_SIZE = TAB_LINES * 255.

APPEND OBJPACK.

  • Completing the recipient list

CLEAR EMAILID.

LOOP AT EMAILID.

TRANSLATE EMAILID-LOW TO LOWER CASE.

RECLIST-RECEIVER = EMAILID-LOW.

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

CLEAR RECLIST.

ENDLOOP.

CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'

EXPORTING

DOCUMENT_DATA = DOC_CHNG

PUT_IN_OUTBOX = 'X'

COMMIT_WORK = '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

DOCUMENT_TYPE_NOT_EXIST = 3

OPERATION_NO_AUTHORIZATION = 4

PARAMETER_ERROR = 5

X_ERROR = 6

ENQUEUE_ERROR = 7

OTHERS = 8.

IF SY-SUBRC = 0.

LOOP AT RECLIST.

IF RECLIST-RETRN_CODE = 0.

CONCATENATE RECLIST-RECEIVER ':'

'The document was sent' INTO L_MSG.

MESSAGE S656 WITH L_MSG.

ELSE.

CONCATENATE RECLIST-RECEIVER ':'

'The document was sent' INTO L_MSG.

MESSAGE E656 WITH L_MSG.

ENDIF.

ENDLOOP.

ELSE.

CONCATENATE RECLIST-RECEIVER ':'

'error occurred in sending mail' INTO L_MSG.

MESSAGE S656 WITH L_MSG.

ENDIF.

Read only

Former Member
0 Likes
339

Hi nivetha a

U have to pass the name for attachment into tables parameter packing_list-obj_descr. Then u will get the correct name that u have entered.

PACKING_LIST-OBJ_DESCR = 'ABCDE'

append packing_list.

Venkat.