Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

E_MAIL program not working

halo fellow SAPiens,

i worte a program which when executed will mail its vendors (regarding Bid date -- for SRM)......but i dont receive any mail when executed in the SRM server........but when the same prgm is executed in R/3, i do Rx a mail..........

what could be the problem..........

this is the code......

&----


*& Report ZTEST_TIMES

*&

&----


*&

*&

&----


report ZTEST_TIMES.

data : LV_DATE type SY-DATUM .

data : LV_TIME type SY-UZEIT .

data : LV_DATE1(10) type C ."SY-DATUM .

data : LV_TIME1(10) type C ."SY-UZEIT .

data : LV_TIMESTAMP_FROM type TZONREF-TSTAMPS .

data : LV_TIMESTAMP_TO type TZONREF-TSTAMPS .

data : LT_BBP_PDHSB type table of BBP_PDHSB with header line.

data : LW_BBP_PDHSB type BBP_PDHSB .

data: LT_BBP_PDS_PARTNER type table of BBP_PDS_PARTNER.

data : LW_BBP_PDS_PARTNER type BBP_PDS_PARTNER.

data: LS_BBP_PDS_AUC_HEADER_D type BBP_PDS_AUC_HEADER_D.

data: GS_MAILDATA type SODOCCHGI1.

data: IT_MAILTXT type table of SOLISTI1 with header line.

data: IT_MAILREC type table of SOMLREC90 with header line.

data: IT_MAILHDR type table of SOLISTI1 with header line.

data: TEMP_MAIL_ID(50) type C."like LW_BBP_PDS_PARTNER-E_MAIL.

clear: GS_MAILDATA, IT_MAILTXT, IT_MAILREC.

refresh: IT_MAILTXT, IT_MAILREC.

start-of-selection.

LV_DATE = '20071004'."sy-datum .

LV_TIME = '120000' .

call function 'IB_CONVERT_INTO_TIMESTAMP'

exporting

I_DATLO = LV_DATE

I_TIMLO = LV_TIME

I_TZONE = 'CET'

importing

E_TIMESTAMP = LV_TIMESTAMP_FROM.

LV_DATE = LV_DATE + 3 .

LV_TIME = '120000' .

call function 'IB_CONVERT_INTO_TIMESTAMP'

exporting

I_DATLO = LV_DATE

I_TIMLO = LV_TIME

I_TZONE = 'CET'

importing

E_TIMESTAMP = LV_TIMESTAMP_TO.

select * from BBP_PDHSB

into table LT_BBP_PDHSB

where START_TIME between LV_TIMESTAMP_FROM and LV_TIMESTAMP_TO.

"where START_TIME ge LV_TIMESTAMP_FROM

"and START_TIME le LV_TIMESTAMP_TO .

  • BREAK CVSITDEV .

loop at LT_BBP_PDHSB.

call function 'BBP_PD_AUC_GETDETAIL'

exporting

I_GUID = LT_BBP_PDHSB-GUID

  • I_OBJECT_ID =

  • I_ATTACH_WITH_DOC =

  • IT_DYN_ATTR =

I_WITH_ITEMDATA = 'X'

  • I_ITEM_SORTED_BY_HIERARCHY =

  • I_READ_FROM_ARCHIVE = ' '

importing

E_HEADER = LS_BBP_PDS_AUC_HEADER_D

  • ET_ATTACH =

  • ET_DYN_ATTR =

tables

  • E_ITEM =

E_PARTNER = LT_BBP_PDS_PARTNER

  • E_LONGTEXT =

  • E_STATUS =

  • E_ORGDATA =

  • E_CHAT =

  • E_BID_HIST =

  • E_HEADER_REL =

  • E_ITMLIM_REL =

  • E_FAC =

  • E_ACTIVITIES =

  • E_MESSAGES =

  • E_HCF =

  • E_ICF =

  • ET_EXCHRATE =

.

check LT_BBP_PDS_PARTNER[] is not initial.

read table LT_BBP_PDS_PARTNER into LW_BBP_PDS_PARTNER

with key PARTNER_FCT = '00000018'.

if SY-SUBRC = 0.

if LW_BBP_PDS_PARTNER-E_MAIL is not initial.

IT_MAILREC-RECEIVER = LW_BBP_PDS_PARTNER-E_MAIL .

TEMP_MAIL_ID = LW_BBP_PDS_PARTNER-E_MAIL.

IT_MAILREC-REC_TYPE = 'U'.

append IT_MAILREC.

LV_DATE1 = LS_BBP_PDS_AUC_HEADER_D-QUOT_DEAD.

LV_TIME1 = LS_BBP_PDS_AUC_HEADER_D-QUOT_DEAD_TIME.

perform DATE_CONVERSION using LV_DATE1.

perform TIME_CONVERSION using LV_TIME1.

concatenate 'Your Quotation Date is going to End on :' LV_DATE1

'Time :' Lv_TIME1 '.'

into IT_MAILHDR-LINE separated by ''.

IT_MAILTXT-LINE = 'AUCTION.'.

append IT_MAILTXT.

endif.

endif.

*****Mailing Code

GS_MAILDATA-OBJ_NAME = 'TEST-MAIL'.

GS_MAILDATA-OBJ_DESCR = 'Deadline for Auction'.

GS_MAILDATA-OBJ_LANGU = SY-LANGU.

  • IT_MAILTXT-LINE = 'This is a test'.

  • append IT_MAILTXT.

*

  • IT_MAILREC-RECEIVER = 'sajithmenon27@gmail.com'.

  • IT_MAILREC-REC_TYPE = 'U'.

  • append IT_MAILREC.

<b>call function 'SO_NEW_DOCUMENT_SEND_API1'

exporting

DOCUMENT_DATA = GS_MAILDATA

DOCUMENT_TYPE = 'RAW'

COMMIT_WORK = 'X'

tables

OBJECT_HEADER = IT_MAILHDR

OBJECT_CONTENT = IT_MAILTXT

RECEIVERS = IT_MAILREC

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.

message id SY-MSGID type SY-MSGTY number SY-MSGNO

with SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

else.

write:/ 'Mailed Succesfully to ',TEMP_MAIL_ID.

endif.</b>

***Initiate mail execute program..........

*WAIT UP TO 2 SECONDS.

*submit RSCONN01 with MODE = 'INT'

  • with OUTPUT = 'X'

  • and return.

*******end mail execute program.

clear: IT_MAILREC,IT_MAILTXT, LW_BBP_PDS_PARTNER,LS_BBP_PDS_AUC_HEADER_D.

endloop.

&----


*& Form date_conversion

&----


  • text

----


  • --> p1 text

  • <-- p2 text

----


form DATE_CONVERSION using p_LV_DATE1.

data: TEMP(10).

TEMP = p_LV_DATE1.

concatenate TEMP6(2) TEMP4(2) TEMP+0(4) into p_LV_DATE1 separated by '.'.

endform. " date_conversion

&----


*& Form time_conversion

&----


  • text

----


  • -->P_LV_TIME1 text

----


form TIME_CONVERSION using P_LV_TIME1.

data: temp(8).

temp = p_LV_time1.

CONCATENATE temp0(2) TEMP2(2) temp+4(2) into P_LV_TIME1 SEPARATED BY ':'.

endform. " time_conversion

Tags:
Former Member
Not what you were looking for? View more on this topic or Ask a question