Code of program
email send program code as follows but note that we dont have e-mail server .
is it possible without email server or not?
REPORT zattach_email MESSAGE-ID zz
LINE-SIZE 132
NO STANDARD PAGE HEADING.
DATA: t_mailhex TYPE STANDARD TABLE OF solix,
t_contents TYPE STANDARD TABLE OF solisti1,
wa_contents TYPE solisti1,
w_file TYPE dsvasdocid,
w_extn(5) TYPE c,
w_mail_subj TYPE string,
w_document TYPE REF TO cl_document_bcs.
CONSTANTS:
*-- Constants used in the body of the Email (HTML)
c_htm TYPE char3 VALUE 'HTM',
c_style_start TYPE char255 VALUE '<FONT face=Arial size=2>',
c_new_line TYPE char255 VALUE '<br>',
c_link_start TYPE char128 VALUE '<A href="www.w3schools.com">',
c_link_text TYPE char32 VALUE 'Link for learning HTML',
c_link_end TYPE char4 VALUE '</A>',
c_space(6) TYPE c VALUE ' ',
*-- Used as an Example for displaying space between texts in Email body
c_emp1(6) TYPE c VALUE 101001,
c_emp2(6) TYPE c VALUE 101002,
c_emp3(6) TYPE c VALUE 101003.
*-- Input Details - Block
SELECTION-SCREEN BEGIN OF BLOCK file WITH FRAME TITLE text-t01.
PARAMETERS: p_attach TYPE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK file.
*-- Email ID of the Recipient
SELECTION-SCREEN BEGIN OF BLOCK mail WITH FRAME TITLE text-t02.
SELECT-OPTIONS: s_mailid FOR somlreci1-receiver NO INTERVALS.
SELECTION-SCREEN END OF BLOCK mail.
*-- Providing F4 Help for the input file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_attach.
PERFORM file_path USING 'P_ATTACH'.
START-OF-SELECTION.
IF p_attach IS INITIAL.
MESSAGE i999(zz) WITH 'Please Enter at-least one file name'(001).
EXIT.
ENDIF.
*-- Upload data from Presentation Server to SAP
PERFORM upload_data.
END-OF-SELECTION.
*-- Frame the Body of the Email
PERFORM frame_mail_body.
*-- Send Mail
PERFORM send_mail.
FORM file_path USING fp_file TYPE any.
*-- Selects the directory list
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = fp_file
dyname = sy-cprog
dynumb = sy-dynnr
filetype = 'P'
location = 'P'
server = space.
ENDFORM. " file_path
FORM upload_data.
*-- Local data declaration
DATA: l_file TYPE string,
l_index TYPE sy-tabix,
*-- For holding the split file name
tl_splitfile TYPE STANDARD TABLE OF rlgrap-filename,
wl_splitfile TYPE rlgrap-filename.
l_file = p_attach.
**-- Function module to split the Filename and Extension from the Path
CALL FUNCTION 'CH_SPLIT_FILENAME'
EXPORTING
complete_filename = l_file
IMPORTING
extension = w_extn
name = w_file.
*-- Split the filename at '.'
SPLIT l_file AT '.' INTO TABLE tl_splitfile.
DESCRIBE TABLE tl_splitfile LINES l_index.
*-- In case the filename contains more than one dot
IF l_index GT 2.
CLEAR: wl_splitfile, w_extn.
*-- Get the Extension of the file
READ TABLE tl_splitfile INTO wl_splitfile INDEX l_index.
w_extn = wl_splitfile.
DELETE tl_splitfile INDEX l_index.
DELETE tl_splitfile INDEX 1.
CLEAR wl_splitfile.
*-- Get the Actual filename
LOOP AT tl_splitfile INTO wl_splitfile.
CONCATENATE '.' wl_splitfile INTO wl_splitfile.
ENDLOOP.
CONCATENATE w_file wl_splitfile INTO w_file.
ENDIF.
CONDENSE w_extn.
*-- Upload File
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
filetype = 'BIN'
TABLES
data_tab = t_mailhex
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc IS NOT INITIAL.
MESSAGE i999(zz) WITH 'Error in reading file for upload'(002)
w_file.
ENDIF.
ENDFORM. " upload_data
FORM frame_mail_body.
*-- Local data declaration to hold the textpool
DATA: tl_textpool TYPE STANDARD TABLE OF textpool,
wl_textpool TYPE textpool.
*-- Read the Entire Textpool into an Internal table
READ TEXTPOOL sy-repid INTO tl_textpool LANGUAGE sy-langu.
IF sy-subrc IS INITIAL.
SORT tl_textpool BY id key.
ENDIF.
*-- Font start
CLEAR wa_contents.
wa_contents-line = c_style_start.
APPEND wa_contents TO t_contents.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- Program name : Email Attachment
CLEAR: wl_textpool, wa_contents.
READ TABLE tl_textpool INTO wl_textpool
WITH KEY id = 'I' key = 'T03'
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_contents-line = wl_textpool-entry.
*-- "#" Present in the Text Element will be replaced by the below value
REPLACE: '#' WITH 'Email Attachment' INTO wa_contents-line.
APPEND wa_contents TO t_contents.
ENDIF.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- You can also change or add the text here...
CLEAR: wl_textpool, wa_contents.
READ TABLE tl_textpool INTO wl_textpool
WITH KEY id = 'I' key = 'T04'
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_contents-line = wl_textpool-entry.
APPEND wa_contents TO t_contents.
ENDIF.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- For giving spaces between texts, you can use...
CLEAR: wl_textpool, wa_contents.
READ TABLE tl_textpool INTO wl_textpool
WITH KEY id = 'I' key = 'T05'
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_contents-line = wl_textpool-entry.
APPEND wa_contents TO t_contents.
ENDIF.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- For Ex; Employee Numbers :
CLEAR: wl_textpool, wa_contents.
READ TABLE tl_textpool INTO wl_textpool
WITH KEY id = 'I' key = 'T06'
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_contents-line = wl_textpool-entry.
*-- How to give Spaces in between texts
CONCATENATE wa_contents-line c_space c_emp1 c_space c_emp2
c_space c_emp3 INTO wa_contents-line.
APPEND wa_contents TO t_contents.
ENDIF.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- For more Information on HTML..
CLEAR: wl_textpool, wa_contents.
READ TABLE tl_textpool INTO wl_textpool
WITH KEY id = 'I' key = 'T07'
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_contents-line = wl_textpool-entry.
APPEND wa_contents TO t_contents.
ENDIF.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- Hyperlink
CLEAR wa_contents.
CONCATENATE c_link_start c_link_text c_link_end INTO wa_contents-line.
APPEND wa_contents TO t_contents.
*-- Subject of the Mail
CONCATENATE text-t08 w_mail_subj INTO w_mail_subj.
ENDFORM. " frame_mail_body
FORM send_mail.
*-- Local data declaration for sending mail
DATA: l_send_request TYPE REF TO cl_bcs,
l_document TYPE REF TO cl_document_bcs,
l_sender TYPE REF TO cl_sapuser_bcs,
l_sub TYPE char50,
l_recipient TYPE REF TO if_recipient_bcs,
tl_contents TYPE STANDARD TABLE OF soli,
l_doc_len TYPE so_obj_len,
l_cnt TYPE sy-tabix,
l_rcv_email TYPE adr6-smtp_addr,
l_result TYPE sy-binpt,
l_bcs_exception TYPE REF TO cx_bcs,
l_subj TYPE string,
wl_mailid LIKE LINE OF s_mailid.
TRY.
*-- Create persistent send request
l_send_request = cl_bcs=>create_persistent( ).
tl_contents[] = t_contents[].
*-- Get the length of the Document
DESCRIBE TABLE tl_contents LINES l_cnt.
READ TABLE tl_contents INTO wa_contents INDEX l_cnt.
l_doc_len = ( l_cnt - 1 ) * 255 + STRLEN( wa_contents ).
*-- Subject of the mail
l_sub = w_mail_subj.
*-- Create Document
l_document = cl_document_bcs=>create_document(
i_type = c_htm
i_text = tl_contents
i_length = l_doc_len
i_subject = l_sub
i_language = sy-langu
i_importance = '1' ).
*-- Subject of the mail
MOVE w_mail_subj TO l_subj.
w_document = l_document.
TRY.
*-- Set the Message Subject
CALL METHOD l_send_request->set_message_subject
EXPORTING
ip_subject = l_subj.
CATCH cx_sy_dyn_call_illegal_method.
ENDTRY.
*-- Add document to send request
CALL METHOD l_send_request->set_document( l_document ).
*-- Do send delivery info for successful mails
CALL METHOD l_send_request->set_status_attributes
EXPORTING
i_requested_status = 'E'
i_status_mail = 'A'.
*-- Set sender
l_sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD l_send_request->set_sender
EXPORTING
i_sender = l_sender.
*-- To frame the attachments for the mail
PERFORM frame_attachments.
*-- Add the recipients to the Send mail
LOOP AT s_mailid INTO wl_mailid.
l_rcv_email = wl_mailid-low.
CHECK NOT l_rcv_email IS INITIAL.
l_recipient = cl_cam_address_bcs=>create_internet_address(
l_rcv_email ).
CALL METHOD l_send_request->add_recipient
EXPORTING
i_recipient = l_recipient
i_express = 'X'.
ENDLOOP.
*-- Send Email
CALL METHOD l_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = l_result ).
IF l_result = 'X'.
MESSAGE s999(zz) WITH
'Approval Mail Sent Successfully'(003).
ENDIF.
CATCH cx_bcs INTO l_bcs_exception.
IF l_result NE 'X'.
MESSAGE s999(zz) WITH
'Approval Mail Not Successful'(004).
ENDIF.
ENDTRY.
COMMIT WORK. "Commit Work
ENDFORM. " send_mail
FORM frame_attachments.
*-- Local Data declaration
DATA: l_subject TYPE so_obj_des,
l_att_type TYPE soodk-objtp.
*-- Subject of the Attachment
l_subject = w_file.
*-- Format of the Attachment
l_att_type = w_extn.
IF t_mailhex[] IS NOT INITIAL.
TRY.
*-- Add Attachment to the Document
CALL METHOD w_document->add_attachment
EXPORTING
i_attachment_type = l_att_type
i_attachment_subject = l_subject
i_att_content_hex = t_mailhex.
CATCH cx_document_bcs.
ENDTRY.
ENDIF.
ENDFORM. " frame_attachments
Thanks,
Jyotsna
email send program code as follows but note that we dont have e-mail server .
is it possible without email server or not?
REPORT zattach_email MESSAGE-ID zz
LINE-SIZE 132
NO STANDARD PAGE HEADING.
DATA: t_mailhex TYPE STANDARD TABLE OF solix,
t_contents TYPE STANDARD TABLE OF solisti1,
wa_contents TYPE solisti1,
w_file TYPE dsvasdocid,
w_extn(5) TYPE c,
w_mail_subj TYPE string,
w_document TYPE REF TO cl_document_bcs.
CONSTANTS:
*-- Constants used in the body of the Email (HTML)
c_htm TYPE char3 VALUE 'HTM',
c_style_start TYPE char255 VALUE '<FONT face=Arial size=2>',
c_new_line TYPE char255 VALUE '<br>',
c_link_start TYPE char128 VALUE '<A href="www.w3schools.com">',
c_link_text TYPE char32 VALUE 'Link for learning HTML',
c_link_end TYPE char4 VALUE '</A>',
c_space(6) TYPE c VALUE ' ',
*-- Used as an Example for displaying space between texts in Email body
c_emp1(6) TYPE c VALUE 101001,
c_emp2(6) TYPE c VALUE 101002,
c_emp3(6) TYPE c VALUE 101003.
*-- Input Details - Block
SELECTION-SCREEN BEGIN OF BLOCK file WITH FRAME TITLE text-t01.
PARAMETERS: p_attach TYPE rlgrap-filename.
SELECTION-SCREEN END OF BLOCK file.
*-- Email ID of the Recipient
SELECTION-SCREEN BEGIN OF BLOCK mail WITH FRAME TITLE text-t02.
SELECT-OPTIONS: s_mailid FOR somlreci1-receiver NO INTERVALS.
SELECTION-SCREEN END OF BLOCK mail.
*-- Providing F4 Help for the input file
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_attach.
PERFORM file_path USING 'P_ATTACH'.
START-OF-SELECTION.
IF p_attach IS INITIAL.
MESSAGE i999(zz) WITH 'Please Enter at-least one file name'(001).
EXIT.
ENDIF.
*-- Upload data from Presentation Server to SAP
PERFORM upload_data.
END-OF-SELECTION.
*-- Frame the Body of the Email
PERFORM frame_mail_body.
*-- Send Mail
PERFORM send_mail.
FORM file_path USING fp_file TYPE any.
*-- Selects the directory list
CALL FUNCTION 'F4_DXFILENAME_4_DYNP'
EXPORTING
dynpfield_filename = fp_file
dyname = sy-cprog
dynumb = sy-dynnr
filetype = 'P'
location = 'P'
server = space.
ENDFORM. " file_path
FORM upload_data.
*-- Local data declaration
DATA: l_file TYPE string,
l_index TYPE sy-tabix,
*-- For holding the split file name
tl_splitfile TYPE STANDARD TABLE OF rlgrap-filename,
wl_splitfile TYPE rlgrap-filename.
l_file = p_attach.
**-- Function module to split the Filename and Extension from the Path
CALL FUNCTION 'CH_SPLIT_FILENAME'
EXPORTING
complete_filename = l_file
IMPORTING
extension = w_extn
name = w_file.
*-- Split the filename at '.'
SPLIT l_file AT '.' INTO TABLE tl_splitfile.
DESCRIBE TABLE tl_splitfile LINES l_index.
*-- In case the filename contains more than one dot
IF l_index GT 2.
CLEAR: wl_splitfile, w_extn.
*-- Get the Extension of the file
READ TABLE tl_splitfile INTO wl_splitfile INDEX l_index.
w_extn = wl_splitfile.
DELETE tl_splitfile INDEX l_index.
DELETE tl_splitfile INDEX 1.
CLEAR wl_splitfile.
*-- Get the Actual filename
LOOP AT tl_splitfile INTO wl_splitfile.
CONCATENATE '.' wl_splitfile INTO wl_splitfile.
ENDLOOP.
CONCATENATE w_file wl_splitfile INTO w_file.
ENDIF.
CONDENSE w_extn.
*-- Upload File
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_file
filetype = 'BIN'
TABLES
data_tab = t_mailhex
EXCEPTIONS
file_open_error = 1
file_read_error = 2
no_batch = 3
gui_refuse_filetransfer = 4
invalid_type = 5
no_authority = 6
unknown_error = 7
bad_data_format = 8
header_not_allowed = 9
separator_not_allowed = 10
header_too_long = 11
unknown_dp_error = 12
access_denied = 13
dp_out_of_memory = 14
disk_full = 15
dp_timeout = 16
OTHERS = 17.
IF sy-subrc IS NOT INITIAL.
MESSAGE i999(zz) WITH 'Error in reading file for upload'(002)
w_file.
ENDIF.
ENDFORM. " upload_data
FORM frame_mail_body.
*-- Local data declaration to hold the textpool
DATA: tl_textpool TYPE STANDARD TABLE OF textpool,
wl_textpool TYPE textpool.
*-- Read the Entire Textpool into an Internal table
READ TEXTPOOL sy-repid INTO tl_textpool LANGUAGE sy-langu.
IF sy-subrc IS INITIAL.
SORT tl_textpool BY id key.
ENDIF.
*-- Font start
CLEAR wa_contents.
wa_contents-line = c_style_start.
APPEND wa_contents TO t_contents.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- Program name : Email Attachment
CLEAR: wl_textpool, wa_contents.
READ TABLE tl_textpool INTO wl_textpool
WITH KEY id = 'I' key = 'T03'
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_contents-line = wl_textpool-entry.
*-- "#" Present in the Text Element will be replaced by the below value
REPLACE: '#' WITH 'Email Attachment' INTO wa_contents-line.
APPEND wa_contents TO t_contents.
ENDIF.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- You can also change or add the text here...
CLEAR: wl_textpool, wa_contents.
READ TABLE tl_textpool INTO wl_textpool
WITH KEY id = 'I' key = 'T04'
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_contents-line = wl_textpool-entry.
APPEND wa_contents TO t_contents.
ENDIF.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- For giving spaces between texts, you can use...
CLEAR: wl_textpool, wa_contents.
READ TABLE tl_textpool INTO wl_textpool
WITH KEY id = 'I' key = 'T05'
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_contents-line = wl_textpool-entry.
APPEND wa_contents TO t_contents.
ENDIF.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- For Ex; Employee Numbers :
CLEAR: wl_textpool, wa_contents.
READ TABLE tl_textpool INTO wl_textpool
WITH KEY id = 'I' key = 'T06'
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_contents-line = wl_textpool-entry.
*-- How to give Spaces in between texts
CONCATENATE wa_contents-line c_space c_emp1 c_space c_emp2
c_space c_emp3 INTO wa_contents-line.
APPEND wa_contents TO t_contents.
ENDIF.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- For more Information on HTML..
CLEAR: wl_textpool, wa_contents.
READ TABLE tl_textpool INTO wl_textpool
WITH KEY id = 'I' key = 'T07'
BINARY SEARCH.
IF sy-subrc EQ 0.
wa_contents-line = wl_textpool-entry.
APPEND wa_contents TO t_contents.
ENDIF.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- New line
CLEAR wa_contents.
wa_contents-line = c_new_line.
APPEND wa_contents TO t_contents.
*-- Hyperlink
CLEAR wa_contents.
CONCATENATE c_link_start c_link_text c_link_end INTO wa_contents-line.
APPEND wa_contents TO t_contents.
*-- Subject of the Mail
CONCATENATE text-t08 w_mail_subj INTO w_mail_subj.
ENDFORM. " frame_mail_body
FORM send_mail.
*-- Local data declaration for sending mail
DATA: l_send_request TYPE REF TO cl_bcs,
l_document TYPE REF TO cl_document_bcs,
l_sender TYPE REF TO cl_sapuser_bcs,
l_sub TYPE char50,
l_recipient TYPE REF TO if_recipient_bcs,
tl_contents TYPE STANDARD TABLE OF soli,
l_doc_len TYPE so_obj_len,
l_cnt TYPE sy-tabix,
l_rcv_email TYPE adr6-smtp_addr,
l_result TYPE sy-binpt,
l_bcs_exception TYPE REF TO cx_bcs,
l_subj TYPE string,
wl_mailid LIKE LINE OF s_mailid.
TRY.
*-- Create persistent send request
l_send_request = cl_bcs=>create_persistent( ).
tl_contents[] = t_contents[].
*-- Get the length of the Document
DESCRIBE TABLE tl_contents LINES l_cnt.
READ TABLE tl_contents INTO wa_contents INDEX l_cnt.
l_doc_len = ( l_cnt - 1 ) * 255 + STRLEN( wa_contents ).
*-- Subject of the mail
l_sub = w_mail_subj.
*-- Create Document
l_document = cl_document_bcs=>create_document(
i_type = c_htm
i_text = tl_contents
i_length = l_doc_len
i_subject = l_sub
i_language = sy-langu
i_importance = '1' ).
*-- Subject of the mail
MOVE w_mail_subj TO l_subj.
w_document = l_document.
TRY.
*-- Set the Message Subject
CALL METHOD l_send_request->set_message_subject
EXPORTING
ip_subject = l_subj.
CATCH cx_sy_dyn_call_illegal_method.
ENDTRY.
*-- Add document to send request
CALL METHOD l_send_request->set_document( l_document ).
*-- Do send delivery info for successful mails
CALL METHOD l_send_request->set_status_attributes
EXPORTING
i_requested_status = 'E'
i_status_mail = 'A'.
*-- Set sender
l_sender = cl_sapuser_bcs=>create( sy-uname ).
CALL METHOD l_send_request->set_sender
EXPORTING
i_sender = l_sender.
*-- To frame the attachments for the mail
PERFORM frame_attachments.
*-- Add the recipients to the Send mail
LOOP AT s_mailid INTO wl_mailid.
l_rcv_email = wl_mailid-low.
CHECK NOT l_rcv_email IS INITIAL.
l_recipient = cl_cam_address_bcs=>create_internet_address(
l_rcv_email ).
CALL METHOD l_send_request->add_recipient
EXPORTING
i_recipient = l_recipient
i_express = 'X'.
ENDLOOP.
*-- Send Email
CALL METHOD l_send_request->send(
EXPORTING
i_with_error_screen = 'X'
RECEIVING
result = l_result ).
IF l_result = 'X'.
MESSAGE s999(zz) WITH
'Approval Mail Sent Successfully'(003).
ENDIF.
CATCH cx_bcs INTO l_bcs_exception.
IF l_result NE 'X'.
MESSAGE s999(zz) WITH
'Approval Mail Not Successful'(004).
ENDIF.
ENDTRY.
COMMIT WORK. "Commit Work
ENDFORM. " send_mail
FORM frame_attachments.
*-- Local Data declaration
DATA: l_subject TYPE so_obj_des,
l_att_type TYPE soodk-objtp.
*-- Subject of the Attachment
l_subject = w_file.
*-- Format of the Attachment
l_att_type = w_extn.
IF t_mailhex[] IS NOT INITIAL.
TRY.
*-- Add Attachment to the Document
CALL METHOD w_document->add_attachment
EXPORTING
i_attachment_type = l_att_type
i_attachment_subject = l_subject
i_att_content_hex = t_mailhex.
CATCH cx_document_bcs.
ENDTRY.
ENDIF.
ENDFORM. " frame_attachments
Thanks,
Jyotsna
Similar Messages
-
STAD - get the 'transaction code' and 'program name'
Hi, I was wondering if someone knows about a bapi with which I can get only the "transaction code" and "program name".
I need to get those for a specified user, but I don't want to set on a trace, that's why I'd like to use the transaction STAD.
If anyone can help, thanks in advance
Grtz,
Dragovianok, so I go like this
TYPE-POOLS sapwl .
DATA: all_stats TYPE sapwl_allstats.
CALL FUNCTION 'SAPWL_READ_STATISTIC_FILES'
EXPORTING
read_client = '*'
read_time = '200000'
read_start_date = sy-datum
read_start_time = '000000'
read_username = sy-uname
read_workprocess = 'FFFF'
wait_factor = 150
CHANGING
all_stats = all_stats
how'd I get "start-time" "report-name" "date" "username"? -
How to find out all the tables associated with particular T-code or Program
Hi All,
In 4.6B we have a transaction code SE49, where we can see all the tables associated with particular Transaction code or Program.
But in ECC 5.0 or in ECC 6.0 this transaction code is not available.So is there any alternative where i can find out all the tables associated with particular T-code or Program.
Thanks
ShubhamHi,
you are right, Transaction SE49 as well as SE48 do not exist anymore I'm afraid, they
are discontinued.
You might try to create a transaction variant:
1) Start SE93 to create a transaction variant
2) Specify a name, eg. ZSE49, and choose the first option:
"program and screen (dialog transaction)
3) Here specify SAPMSEUZ as program, and 200 as screen number
4) Choose a suitable development class (package) if you want it to be
transportable or Local (=$TMP) if non-transportable
5) press Save
Same applies for SE48, same program but dynpro 100.
Sorry for not being able the reasons behind the decision to discontinue
these transactions. I suppose at least part of the functionality was
integrated in SE38.
Best regards
Erika -
I Seek code for programming lego minstorm with labview
Hi,
I'am building a car with lego mindstorm for a project and i seek code for programming my car with labview. If you already use labview for programming lego mindstorm, can you send exemples codes for see how the car do for move or turn. please.
Thanksduplicate post
duplicate post
Please try to keep your question to one thread. Otherwise people don't know where to respond. -
Performance/ Runtime improvement of T.code:MB5B /Program: RM07MLBD
Hi Guys,
Big Thank ! if you help me out.
Actuallt while running T.code MB5B/ Program:RM07MLBD.it is taking long time to execute.
Could you please advise me
Thanks
TataThis is a good solution, we have ourselves looked at this and are implementing it on our system.
A work of caution, since changes are made to the MSEG table which is a large table it's advised to work together with the database administrator so that the updating of the table when executing the correction report runs smoothly and you will not be experiencing unforeseen locks which can cause big issues. -
How to find out top 10 records from the R/3 using Java code (WD Program)
Hi Experts,
I have used Java Web Dynpro program to fetch records from the backend. Following code helps me and fetches record. As per the customer reqirement, we have to fetch only top 10 records (Actual Cost) from the backend. So I have to modify the Java code. How I can do so? Please help.
wdContext.nodeGraphData().invalidate();
IPublicCostcnt.IGraphDataElement categoryElement;
for (int i = 0; i < wdContext.nodeItab_Final1().size(); i++) {
categoryElement = wdContext.createGraphDataElement();
categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
wdContext.nodeGraphData().addElement(categoryElement);
Regards,
GaryDear SDN Users,
This is how I resolved the issue.
1) Requested ABAPer to provide me sorted data. The data has been sorted in descending order of actual_cost.
2) After that I used following code. This resolved the issue.
if (wdContext.nodeItab_Final1().size()>10){
IPublicCostcnt.IGraphDataElement categoryElement;
for (int i = 0; i < 10; i++) {
categoryElement = wdContext.createGraphDataElement();
categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
wdContext.nodeGraphData().addElement(categoryElement);
if (wdContext.nodeItab_Final1().size()<=10){
if (wdContext.nodeItab_Final1().size()>0){
IPublicCostcnt.IGraphDataElement categoryElement;
for (int i = 0; i < wdContext.nodeItab_Final1().size(); i++) {
categoryElement = wdContext.createGraphDataElement();
categoryElement.setCostElement(""+ wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getDescription());
categoryElement.setActualCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getActual_Cost().toString());
categoryElement.setPlannedCost(wdContext.nodeItab_Final1().getItab_Final1ElementAt(i).getPlan_Cost().toString());
wdContext.nodeGraphData().addElement(categoryElement);
Regards,
Gary -
Urgent How to Code Custom program to get_data and Set_data
Hi,
I am using BADI to enhance the vendor master screen.
The Badi were implemented as per OSS 580266.
Subscreen is appering, new buttion is working fine.
But how to communicate between my custom program's PBO , PAI to Badi's GET_DATA
and SET_DATA.
Is any one got any sample code?
Thanks for the help
Rgd.Hiii John Wu,
Thanks for your reply,
And i have a little bit confuse. I mean, now my project available in SAP Netweaver Developer Studio. I have 2 DCs the first DC for User Interface and the second for EJB. where do i have implement servlet in each others or i need to create and implement at another DC. How to implement it? sorry for somethings write above so I am a new comer for SAP development.
Thank you! -
Transaction Code - Upload Program
Dear All,
Please help.
Like wise we can assign a T code to a BDC program for using it as upload program.
Please tell me can a T code be assigned to an upload program done through LSMW
& how...???
Regards
DhananjayHello,
you can create a templete for uploading the data using LSMW and create as a program and assign a transaction code to it. But all you require is ABAP help.
Prase -
Product id/serial number/ license code storage program
hey, i'm looking for a good program to store and organize all my license codes for various pieces of software, does anyone have any good suggestions?
Hey there,
Perhaps, [License Buoy|http://www.macupdate.com/info.php/id/23659] will do the trick for you. Hope it helps.
B-rock -
How to hide ABAP report source codes like program SAPMSYST
hello guys , I only want to know how SAP hide ABAP codes, any one could told me?
BRs.
Justinhi
u can use table name D010TAB
IF J > 1.
WRITE: / 'Cannot generate appropriate program name'.
EXIT.
ENDIF.
DATA: F5(8).
EXEC SQL.
SELECT MASTER INTO :F5 FROM D010TAB WHERE MASTER = :NEW_NAME
ENDEXEC.
IF F5 IS INITIAL.
There is no such hidden program, hide it
EXEC SQL.
UPDATE D010TAB SET MASTER = :NEW_NAME WHERE MASTER = :PROGRAM
ENDEXEC.
concatenate 'Program' :program 'was hidden.'
into message separated by space.
ELSE.
There is already a hidden program there, unhide it
EXEC SQL.
UPDATE D010TAB SET MASTER = :PROGRAM WHERE MASTER = :NEW_NAME
ENDEXEC.
concatenate 'Program' :program 'was restored.'
into message separated by space.
ENDIF.
write message.
Edited by: krupa jani on Nov 9, 2009 7:30 AM -
Location of ABAP codes - customed programs
Dear All,
Would you assist to confirm my understanding that,
any ABAP codings/developments, ABAP programs (customed programs) all store in /usr/sap/trans
and /usr/sap/trans only.
We are a very small SAP shop with just 1 developer and little developement,
so if I need on older version of an abap program,
I can just restore /usr/sap/trans from backup tape. This is DEV box only.
Please help.
Thank you.
Edited by: elizabeth ly on Apr 13, 2011 7:08 PMHi John,
There was a problem with our SAP DEV hardware server (Win 2003),
so we bring our SAP DEV system and put it on a VM temporary. During this time, there was 1 brand new customized ABAP program created while on VM.
Now that we finished preparing with the new SAP DEV hardware, we take our DEV off from VM.
But, what we are missing is the 1 brand new customized ABAP program.
I figure if I restored from the /usr/sap/trans, the new codes would be there.
Please confirm my understanding.
Thank you.
Elizabeth -
CC: No Transaction Codes for Programs!
Hi experts, this is quite an alarming situation. I found that for a particular company, they have a lot of customized reports (and PROGRAM!) which do not have an underlying tcode tied to it. I'm sure this is not the best practice as the user simply go via SA38 to execute the program directly. The authorisation is currently controlled by the auth obj define in each program.
I'm not sure if anyone has this experience. W/o the tcode available for the program, is it feasible or efficient to check only via Tcode SA38 ? It seems very unlikely there is time to create a tcode per program at this moment. Is there any other ways? The company also does not have customised authorisation objects built in su24.Hi Peter,
This is a very serious issue and has to be addressed to on a top priority.If your client is hit by SOX,it is sure to be qualified,inviting heavy penalties etc.The Auditors has to attest the adequacy of intenal controls u/s 404 of the Sarbox Act;as such they hardly overlook these type of issues-as this a classic case of weak internal control.
I know many companies do SOD_analysis frequently as an aftermath of being qualified under SOX.This is in spite of the best practices under vogue.Taking cue from this,you may think of remedying things.
At this stage it will be very difficult to introduce T/codes.So better consider introducing the compensatory controls-this brings the impact of the violations within the permissible limits.The Control Self Assesment is the best technique to do this.You get a lot of ideas from the shop floor.
Mutually exclusive authorizations to Group A and B sometimes can amount to be inflexible.If your change management system is not sound you stand to end in disaster.
As a long term strategy,you can toy with the idea of introducing "Management cockpit of controls"-here you start excercising the controls from the moment you add the programme to your library.It is rather the frequent changes to the functionalaties without making the corresponding amendments to the affected programmes that play havoc.With the inventory of large number of programmes and disperate locations,this will help you in a big way.
In a nut shell yours calls for a short term strategy to deflect the audit problems etc and a sound long term strategy to bring in the best practices in managing this area.
Regards,
Ramesh. -
Transaction code or program updating table TBD05
Hi All,
While executing some program we encountered the following message.
"No log.sys. for plant plant_name"
This is because one entry is missing in the table TBD05 with the combinations of messsge type ZMDCMS and the plant name.
Please let me know if any one knows how this particular table gets populated.
Thank you all..
Binduhi
plz checl t code SALE
go to SM30 here give table click on customizing
then click on without project
here u will get all spro paths where this table is used
hope it help
regards
kunal -
Error 1097, but unfamiliar with code and programming
USB device (Hantek DSO-2090 USB Oscilloscope) came with .dll and sample Labview file. It wasn't working until I applied a path constant to each Call Library Function Node, yet the largest one always seems to yield Error 1097. Not sure why, but I'll include everything. Please help!
Attachments:
DSO2090.zip 85 KBActually wrong calling conventions quite often crash instead of causing error 1097. Error 1097 can have lots of causes but one of the most common is that the programmer has not preallocated array or string buffers used as output data before calling the C function. Most LabVIEW programmers are so used to LabVIEW handling array and string resizing automatically, that they don't even think about that this could be different when dealing with the Call Library Node. But here the external C code has normally no way of resizing such arrays to whatever size it needs and LabVIEW has no way of knowing what size the C function requires for the buffer. So there needs to be the programmer who deduces that information from function documentation, intuition, experience and sometimes simple trial, error and crash exercises to make this explicitedly.
I took a quick look at the VI in the OP and I was truely appaled by it's lack of structure and architecture. This is not a LabVIEW example to show off for sure. Nevertheless, based on the claim of the OP that the LARGEST node causes the error, (talk about clearness in communication caused by such a spaghetti diagram) I assumed he meant the dsoGetChannelData() CLN and that indeed has two array inputs that are meant to be filled by the function. They are connected to two hidden array controls containing 30000 elements of default data each, so as long as the function does not try to return more than 30000 samples for each of the two channels, this should not be the problem. But I'm not sure if this oscilloscope will ALWAYS return exactly 30000 values for each channel, or if this number can be adjusted somehow. It's however the only thing I can say based on the claim that the largest node causes the error. And digging into this deeper requires the DLL documentation and lots of time, which I don't plan to invest in such a poor piece of software.
The reason that he needed to define the path to each node is that the DLL clearly is not located in a standard nor fixed location. Windows will never search any directory in the Program Files directory for DLLs, unless that directory happens to be listed in the PATH environment variable. And the Program Files directory path can change based on Windows bitness, system administrator configurations and more. In order for LabVIEW to find the DLL on any system, the DLL has either to be:
1) in the same directory as the VI or project file
2) in the executable directory (where labview.exe is or yourapp.exe for a built application)
3) in the $(System) directory
4) in the $(Windows) directory
5) in a directory that is listed in the PATH environment variable
But moving around DLLs without knowing what you are doing can make the DLL unloadable as it may be missing dependencies that way.
Rolf Kalbermatter
CIT Engineering Netherlands
a division of Test & Measurement Solutions -
Problem in Vl01n T-code Upload program
Hi Experts,
I have a issue in BDC for T-code 'VL01N' (Creating Outbound Delivery with Sales Order Reference) ..
I Have to perform page down in table control for line items and batch Split for the same line items.
First It will select the first line item and then i will press batch split button at the button in the same screen, It will take to next screen that is also table control with batch split here also i should
perform page down option i may have 500 to 600 batch for single line item.
In the same way i may have 500 line items for the same order so i have to select line item and then perform
batch split option then come back and Select the next line item in the same order.
I am facing problem in page scrolling in line item wise.
Is there any BAPI Code for the same Please forward me . i am working on ECC 5.0 version.
Thank you .
Regards.
Ravi.
Message was edited by:
Ravi reddyHi Sam,
Thanks for the reply sam.
I have written BDC program its working fine but in some scenarios this not working .
Example:-
For a Sales order 10000. there are 24 line items assume that.
I can view 13 line items in the table control . After processing 13 line items i perform
page down then the remaining 11 line items should process but its picking 13 line items in the table control. the first two line items are already process one.
this is the problem i am facing .
regards.
Ravi.
Maybe you are looking for
-
Safari Reopen All Windows from last session greyed out
Hi there, I am using Safari 7.0.6 version. I have a Macbook Pro OS X 10.9.4 I have made sure that under my Safari Preferences/General/ the Close all windows .... is UNCHECKED but I still can't get the "Reopen All Windows From Last Session" to be ac
-
I have set my daughter up her own Itunes on my pc but, despite all the settings being right and having logged in on her own account it will not sync music. the first time she tried it wiped any music off that is on there and now will go through sync
-
How do I rename my ipod touch in itunes?
I have setup a new library in iTunes for my granddaughter for her iPod Touch. iTunes wants to name the iPod with my name not hers. How can I change it?
-
Pipelined function ignores DML changes on subqueries
Hello all, I have a really specific issue when using a pipelined function used in a complex subquery where the function ignores the changes made on the current transaction. The problem is the hidden hint materialize sometimes used by the Oracle optim
-
Suppress HTTP Authentication dialog for invalid credentials
If I want a custom login screen with domain, username and password fields for my AIR application, that uses Basic Authentication on the server, I can use <code> URLRequestDefaults.setLoginCredentialsForHost(myDomain, myUsername, myPassword); </code>