‎2007 Mar 22 7:49 AM
i have a table with n records where email id is 1 field. In this table i have email id records.
i want logic and coding for the following
1. the mail id should be printed only once in the screen followed by its contents.
00 LPS19073_CRF-DESIGN_P1 LPS 000 - 22.03.2007 CHANDRASEKARAN.P@YAHOO.CO
00 LPS19073_CRF-DESIGN_P5 LPS 000 - 01.04.2007 SAKTHIVEL.N@YAHOO.COM
00 LPS19073_CRF-DESIGN_P7 LPS 000 - 22.03.2007 SAKTHIVEL.N@YAHOO.COM
for next mai id it should be printed in the next line and its contents should be printed .
the putput should like this
SAKTHIVEL.N@YAHOO.COM
00 LPS19073_CRF-DESIGN_P5 LPS 000 - 01.04.2007
00 LPS19073_CRF-DESIGN_P7 LPS 000 - 22.03.2007
CHANDRASEKARAN.P@YAHOO.CO
00 LPS19073_CRF-DESIGN_P1 LPS 000 - 22.03.2007
plz help me
‎2007 Mar 22 7:57 AM
hi
use control break statements AT NEW OR ON CHANGE OF inside your loop...endloop..
loop at itab.
at new mailid.
write : itab-mailid.
endat.
write : / itab-field1, itab-field2,...itab-field10.
endloop.
if helpful, reward
Sathish. R
‎2007 Mar 22 7:57 AM
hi
use control break statements AT NEW OR ON CHANGE OF inside your loop...endloop..
loop at itab.
at new mailid.
write : itab-mailid.
endat.
write : / itab-field1, itab-field2,...itab-field10.
endloop.
if helpful, reward
Sathish. R
‎2007 Mar 22 8:06 AM
Chandrasekharan,
Check the below code.There we are passing the total internal table data at once in FM
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = object_hd_change
object_type = 'RAW'
outbox_flag = 'X'
TABLES
objcont = object_content
receivers = rec_table
Instead of this put the internal table in LOOP . and assign the mail ID value to
rec_table-recextnam = 'destination@yahoo.com'.
rec_table-adr_name = 'destination@yahoo.com'.
So you will achieve your goal.Pls. see the below code.
Go through the below code.
-
REPORT zmbundal_email_out .
DATA BEGIN OF object_hd_change. "SAPoffice: object definition,
INCLUDE STRUCTURE sood1. "change attributes
DATA END OF object_hd_change.
DATA BEGIN OF object_content OCCURS 5. "SAPoffice: Single List with
INCLUDE STRUCTURE solisti1. "Column Length 255
DATA END OF object_content.
DATA BEGIN OF rec_table OCCURS 1. "SAPoffice: recipient with
INCLUDE STRUCTURE soos1. "attributes
DATA END OF rec_table.
Build email recipient table...........................................
CLEAR rec_table.
rec_table-sel = 'X'.
rec_table-recesc = 'B'.
rec_table-recesc = 'U'.
rec_table-recnam = 'U-'.
rec_table-recextnam = 'destination@yahoo.com'.
rec_table-adr_name = 'destination@yahoo.com'.
rec_table-sndex = 'X'.
rec_table-sndpri = '1'.
rec_table-mailstatus = 'E'.
rec_table-SNDSPO = 442355.
rec_table-SNDCP = 'X'.
COLLECT rec_table.
*.Email.content.........................................................
object_content = 'dannyboy baboy'. APPEND object_content.
object_content = 'dannyboy pogi'. APPEND object_content.
object_content = 'dannyboy fagg*t'. APPEND object_content.
*...Subject.Line........................................................
object_hd_change-objnam = 'Test email'.
object_hd_change-objdes = ' Email for Baboy'.
Send Email............................................................
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
object_hd_change = object_hd_change
object_type = 'RAW'
outbox_flag = 'X'
TABLES
objcont = object_content
receivers = rec_table
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
originator_not_exist = 20
x_error = 21
OTHERS = 22.
*...SAPconnect..........................................................
SUBMIT rsconn01 "SAPconnect Start Send Process
WITH mode EQ '*'
WITH output EQ ''
TO SAP-SPOOL
DESTINATION 'LOCAL'
IMMEDIATELY ' '
KEEP IN SPOOL 'X'
WITHOUT SPOOL DYNPRO
AND RETURN.
_________________
Don't forget to reward if useful....
‎2007 Mar 22 8:10 AM
Declare the internal table, the first field should be mail id field.
sort itab by mailid.
loop at itab.
at new mailid.
write:/ itab-mailid.
endat.
write:/ itab-field2, itab-field3.
endloop.