Skip to Content
0
Former Member
Nov 26, 2004 at 03:12 PM

problem with so_object_send in time delay.

31 Views

I have to send two mails through this report (using 4.6c)first one immediately and second with delay of 4 minute.The delay is not working and both mails are sent at the same time.

If the commit work at the end of so_object_send is removed then no mail is sent.

Kindly suggest some solution.

Code----


>

*********************************************************

REPORT Z_SSM_SENDMAIL .

PARAMETERS : P_EMAIL(100) TYPE C.

DATA: WRK_OBJHEAD LIKE SOOD1,

VAR_NAME LIKE SOOS1-RECEXTNAM,

IT_OBJCONT LIKE SOLI OCCURS 0 WITH HEADER LINE,

IT_RECLIST LIKE SOOS1 OCCURS 0 WITH HEADER LINE,

TAB_LINES LIKE SY-TABIX.

START-OF-SELECTION.

  • Set Message Header

WRK_OBJHEAD-OBJLA = SY-LANGU.

WRK_OBJHEAD-OBJNAM = 'Immediate mail'.

CONCATENATE 'Testing mail ' 'immediate'

INTO WRK_OBJHEAD-OBJDES SEPARATED BY ' '.

CONCATENATE 'Testing mail' '.'

INTO IT_OBJCONT SEPARATED BY SPACE.

APPEND IT_OBJCONT.

CLEAR IT_OBJCONT. APPEND IT_OBJCONT.

DESCRIBE TABLE IT_OBJCONT LINES TAB_LINES.

READ TABLE IT_OBJCONT INDEX TAB_LINES.

WRK_OBJHEAD-OBJLEN = ( TAB_LINES - 1 ) * 255 + STRLEN( IT_OBJCONT ).

WRK_OBJHEAD-OBJSNS = 'O'.

  • Receivers Name

IT_RECLIST-RECEXTNAM = P_EMAIL.

IT_RECLIST-RECESC = 'E'.

IT_RECLIST-SNDART = 'INT'.

IT_RECLIST-SNDPRI = 1.

IT_RECLIST-MAILSTATUS = 'E'.

IT_RECLIST-RCDAT = sy-datum.

IT_RECLIST-RCTIM = SY-UZEIT .

IT_RECLIST-DELIVER = 'X'.

IT_RECLIST-MAILSTATUS = 'X'.

IT_RECLIST-NOT_DELI = 'X'.

APPEND IT_RECLIST.

CALL FUNCTION 'SO_OBJECT_SEND'

EXPORTING

OBJECT_HD_CHANGE = WRK_OBJHEAD

OBJECT_TYPE = 'RAW'

OWNER = sy-uname

TABLES

OBJCONT = IT_OBJCONT

RECEIVERS = IT_RECLIST

EXCEPTIONS

ACTIVE_USER_NOT_EXIST = 1

COMMUNICATION_FAILURE = 2

COMPONENT_NOT_AVAILABLE = 3

FOLDER_NOT_EXIST = 4

FOLDER_NO_AUTHORIZATION = 5

FORWARDER_NOT_EXIST = 6

NOTE_NOT_EXIST = 7

OBJECT_NOT_EXIST = 8

OBJECT_NOT_SENT = 9

OBJECT_NO_AUTHORIZATION = 10

OBJECT_TYPE_NOT_EXIST = 11

OPERATION_NO_AUTHORIZATION = 12

OWNER_NOT_EXIST = 13

PARAMETER_ERROR = 14

SUBSTITUTE_NOT_ACTIVE = 15

SUBSTITUTE_NOT_DEFINED = 16

SYSTEM_FAILURE = 17

TOO_MUCH_RECEIVERS = 18

USER_NOT_EXIST = 19

X_ERROR = 20

OTHERS = 21.

*commit work.

WRITE : / SY-SUBRC.

  • Receivers Name

WRK_OBJHEAD-OBJNAM = 'delay'.

CONCATENATE 'Delayed mail by 4 min' ''

INTO WRK_OBJHEAD-OBJDES.

refresh it_reclist.

clear it_reclist.

IT_RECLIST-RECEXTNAM = P_EMAIL.

IT_RECLIST-RECESC = 'E'.

IT_RECLIST-SNDART = 'INT'.

IT_RECLIST-SNDPRI = 1.

IT_RECLIST-MAILSTATUS = 'E'.

IT_RECLIST-RCDAT = sy-datum.

IT_RECLIST-RCTIM = SY-UZEIT + 240. "P_TIME.

IT_RECLIST-DELIVER = 'X'.

IT_RECLIST-MAILSTATUS = 'X'.

IT_RECLIST-NOT_DELI = 'X'.

APPEND IT_RECLIST.

CALL FUNCTION 'SO_OBJECT_SEND'

EXPORTING

OBJECT_HD_CHANGE = WRK_OBJHEAD

OBJECT_TYPE = 'RAW'

OWNER = sy-uname

TABLES

OBJCONT = IT_OBJCONT

RECEIVERS = IT_RECLIST

EXCEPTIONS

ACTIVE_USER_NOT_EXIST = 1

COMMUNICATION_FAILURE = 2

COMPONENT_NOT_AVAILABLE = 3

FOLDER_NOT_EXIST = 4

FOLDER_NO_AUTHORIZATION = 5

FORWARDER_NOT_EXIST = 6

NOTE_NOT_EXIST = 7

OBJECT_NOT_EXIST = 8

OBJECT_NOT_SENT = 9

OBJECT_NO_AUTHORIZATION = 10

OBJECT_TYPE_NOT_EXIST = 11

OPERATION_NO_AUTHORIZATION = 12

OWNER_NOT_EXIST = 13

PARAMETER_ERROR = 14

SUBSTITUTE_NOT_ACTIVE = 15

SUBSTITUTE_NOT_DEFINED = 16

SYSTEM_FAILURE = 17

TOO_MUCH_RECEIVERS = 18

USER_NOT_EXIST = 19

X_ERROR = 20

OTHERS = 21.

commit work.

WRITE : / SY-SUBRC.