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: 

reports

Former Member
0 Kudos

Hi,

i have one report and in the selection screen i have some parameters and a receipent mail id parameter.so when i execute the program it should retrieve the data and it should be sent to that mail id directly with an attachment of the output.so here when i execute that program the mail was going but the attachment was not going .so what may be the reason.?its urgent plz help me.

i found fm like SO_NEW_DOCUMENT_ATT_SEND_API1 in that report .what is its purpose.i think it is for this only ?than how to check that.

regards,

rakesh.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi Rakesh,

This FM is used to send the mail. Just check if the attachement is there or not in the code.

Thanks & Regards,

Atish

Message was edited by:

Atish Sarda

5 REPLIES 5

Former Member
0 Kudos

Hi Rakesh,

This FM is used to send the mail. Just check if the attachement is there or not in the code.

Thanks & Regards,

Atish

Message was edited by:

Atish Sarda

Former Member
0 Kudos

Hi,

How to check that .I am not able to find that attachment in the program.

Former Member
0 Kudos

Hi Rakesh,

Check this code.

DATA: OBJCONT LIKE SOLISTI1 OCCURS 5 WITH HEADER LINE.

DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.

DATA: DOC_CHNG LIKE SODOCCHGI1.

DATA: ENTRIES LIKE SY-TABIX.

DATA: NAME(15).

  • Fill the document

DOC_CHNG-OBJ_NAME = 'URGENT'.

DOC_CHNG-OBJ_DESCR = 'Read at once !'.

DOC_CHNG-SENSITIVTY = 'P'.

OBJCONT = 'Hey guys, time for lunch !!!'.

APPEND OBJCONT.

OBJCONT = 'Lets get going !'.

APPEND OBJCONT.

DESCRIBE TABLE OBJCONT LINES ENTRIES.

READ TABLE OBJCONT INDEX ENTRIES.

DOC_CHNG-DOC_SIZE = ( ENTRIES - 1 ) * 255 + STRLEN( OBJCONT ).

  • Fill the receiver list

CLEAR RECLIST.

RECLIST-RECEIVER = SY-UNAME. " replace with <login name>

RECLIST-REC_TYPE = 'B'.

RECLIST-EXPRESS = 'X'.

APPEND RECLIST.

CLEAR RECLIST.

RECLIST-RECEIVER = 'ned.neighbour@next.door.com'.

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

  • Send the document

CALL FUNCTION 'SO_NEW_DOCUMENT_SEND_API1'

EXPORTING

DOCUMENT_TYPE = 'RAW'

DOCUMENT_DATA = DOC_CHNG

PUT_IN_OUTBOX = 'X'

TABLES

OBJECT_CONTENT = OBJCONT

RECEIVERS = RECLIST

EXCEPTIONS

TOO_MANY_RECEIVERS = 1

DOCUMENT_NOT_SENT = 2

OPERATION_NO_AUTHORIZATION = 4

OTHERS = 99.

CASE SY-SUBRC.

WHEN 0.

LOOP AT RECLIST.

IF RECLIST-RECEIVER = SPACE.

NAME = RECLIST-REC_ID.

ELSE.

NAME = RECLIST-RECEIVER.

ENDIF.

IF RECLIST-RETRN_CODE = 0.

WRITE: / NAME, ': succesfully sent'.

ELSE.

WRITE: / NAME, ': error occured'.

ENDIF.

ENDLOOP.

WHEN 1.

WRITE: / 'Too many receivers specified !'.

WHEN 2.

WRITE: / 'No receiver got the document !'.

WHEN 4.

WRITE: / 'Missing send authority !'.

WHEN OTHERS.

WRITE: / 'Unexpected error occurred !'.

ENDCASE.

Former Member
0 Kudos

hi,

the function module s used to send mail with attachments...

c the code below

REPORT ZSSO_DOCUMENT_SEND_API1.

DATA: OBJPACK LIKE SOPCKLSTI1 OCCURS 2 WITH HEADER LINE.

DATA: OBJHEAD LIKE SOLISTI1 OCCURS 1 WITH HEADER LINE.

DATA: OBJBIN LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.

DATA: OBJTXT LIKE SOLISTI1 OCCURS 10 WITH HEADER LINE.

DATA: RECLIST LIKE SOMLRECI1 OCCURS 5 WITH HEADER LINE.

DATA: DOC_CHNG LIKE SODOCCHGI1.

DATA: TAB_LINES LIKE SY-TABIX.

  • Creating the document to be sent

DOC_CHNG-OBJ_NAME = 'OFFER'.

DOC_CHNG-OBJ_DESCR = 'Auction of a Picasso jr'.

OBJTXT = 'Reserve price : $250000'.

APPEND OBJTXT.

OBJTXT = 'A reproduction of the painting to be auctioned'.

APPEND OBJTXT.

OBJTXT = 'is enclosed as an attachment.'.

APPEND OBJTXT.

DESCRIBE TABLE OBJTXT LINES TAB_LINES.

READ TABLE OBJTXT INDEX TAB_LINES.

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

  • Creating the entry for the compressed document

CLEAR OBJPACK-TRANSF_BIN.

OBJPACK-HEAD_START = 1.

OBJPACK-HEAD_NUM = 0.

OBJPACK-BODY_START = 1.

OBJPACK-BODY_NUM = TAB_LINES.

OBJPACK-DOC_TYPE = 'RAW'.

APPEND OBJPACK.

  • Creating the document attachment

  • (Assume the data in OBJBIN are given in BMP format)

OBJBIN = ' \O/ '. APPEND OBJBIN.

OBJBIN = ' | '. APPEND OBJBIN.

OBJBIN = ' / \ '. APPEND OBJBIN.

DESCRIBE TABLE OBJBIN LINES TAB_LINES.

OBJHEAD = 'picasso.bmp'. APPEND OBJHEAD.

  • Creating 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 = 'BMP'.

OBJPACK-OBJ_NAME = 'ATTACHMENT'.

OBJPACK-OBJ_DESCR = 'Reproduction object 138'.

OBJPACK-DOC_SIZE = TAB_LINES * 255.

APPEND OBJPACK..

  • Entering names in the distribution list

RECLIST-RECEIVER = 'guido.geldsack@money.com'.

RECLIST-REC_TYPE = 'U'.

APPEND RECLIST.

RECLIST-RECEIVER = 'DLI-NEUREICH'.

RECLIST-REC_TYPE = 'P'.

APPEND RECLIST.

  • Sending the document

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

OPERATION_NO_AUTHORIZATION = 4

OTHERS = 99.

CASE SY-SUBRC.

WHEN 0.

WRITE: / 'Result of the send process:'.

LOOP AT RECLIST.

WRITE: / RECLIST-RECEIVER(48), ':'.

IF RECLIST-RETRN_CODE = 0.

WRITE 'sent successfully'.

ELSE.

WRITE 'not sent'.

ENDIF.

ENDLOOP.

WHEN 1.

WRITE: / 'no authorization to send to the specified number of' 'recipients!'.

WHEN 2.

WRITE: / 'document could not be sent to any of the recipients!'.

WHEN 4.

WRITE: / 'no authorization to send !'.

WHEN OTHERS.

WRITE: / 'error occurred during sending !'.

ENDCASE.

u can use this code to send mail...

Regards,

viji

Former Member
0 Kudos