Sending ALV output in a mail in PDF format
Hi folks,
I have a requiremtnt. If i execute my ALV report in background, the output should be sent to the reciepient's mail in pdf format. i have used the function moudles CONVERT_ABAPSPOOLJOB_2_PDF and SO_DOCUMENT_SEND_API1. Now i am able to see my report output in spool in some pdf formt. how can i send this to the reciever mail as an attachement...pls send me any sample report which suits my reqirement...thanks in advance,
Ram.
REPORT ZSAP_EMAIL MESSAGE-ID Z001.
*TABLES: rlgrap, btcxpm." zlookup.
DATA:
V_ZCODE(3) TYPE C,
*svrname LIKE zlookup-zdesc,
WA_ERROR(80) TYPE C,
GLOBAL_FILEMASK_ALL(80).
DATA: T_SOUD LIKE SOUD.
DATA: P_INFOLDER LIKE SOFDK.
DATA: P_OUTFOLDER LIKE SOFDK.
DATA: OBJECT_HD_DISPLAY LIKE SOOD2.
DATA: OBJECT_ID LIKE SOODK.
DATA: DOCUMENT LIKE SOOD4.
DATA: HEADER_DATA LIKE SOOD2.
DATA: LINK_FOLDER_ID LIKE SOODK.
DATA: FOLDER_SELECTIONS LIKE SOFDS.
DATA: FOLDER_LIST LIKE SOXLI OCCURS 0 WITH HEADER LINE.
DATA: RECEIVERS LIKE SOOS1 OCCURS 0 WITH HEADER LINE.
DATA: OBJCONT LIKE SOLI OCCURS 0 WITH HEADER LINE.
DATA: OBJHEAD LIKE SOLI OCCURS 0 WITH HEADER LINE.
DATA: OBJECT_CONTENT LIKE SOLISTI1 OCCURS 0 WITH HEADER LINE.
DATA: OBJECT_HD_CHANGE LIKE SOOD1.
DATA: BEGIN OF FILES OCCURS 0,
LINE(200) TYPE C,
END OF FILES.
DATA: LISTOBJECT LIKE ABAPLIST OCCURS 1 WITH HEADER LINE.
*Email to addresses
SELECTION-SCREEN: BEGIN OF BLOCK BL1 WITH FRAME TITLE TEXT-BL1.
PARAMETERS: P_MAILTO(240) TYPE C.
*PARAMETERS:P_MAILTO TYPE SOLI-LINE.
SELECTION-SCREEN SKIP 1.
SELECTION-SCREEN COMMENT 10(2) TEXT-001.
*Use zlookup-ztype as group to define multiple email to addresses
*SELECT-OPTIONS: s_mailto FOR zlookup-ztype.
SELECTION-SCREEN: END OF BLOCK BL1.
*Subject
SELECTION-SCREEN: BEGIN OF BLOCK BL2 WITH FRAME TITLE TEXT-BL2.
PARAMETERS: P_SUBJ LIKE DOCUMENT-OBJDES.
SELECTION-SCREEN: END OF BLOCK BL2.
*Body
SELECTION-SCREEN: BEGIN OF BLOCK BL3 WITH FRAME TITLE TEXT-BL3.
PARAMETERS: P_BODY1 LIKE SOLISTI1-LINE LOWER CASE.
PARAMETERS: P_BODY2 LIKE SOLISTI1-LINE LOWER CASE.
PARAMETERS: P_BODY3 LIKE SOLISTI1-LINE LOWER CASE.
PARAMETERS: P_BODY4 LIKE SOLISTI1-LINE LOWER CASE.
PARAMETERS: P_BODY5 LIKE SOLISTI1-LINE LOWER CASE.
PARAMETERS: P_BODY6 LIKE SOLISTI1-LINE LOWER CASE.
SELECTION-SCREEN: END OF BLOCK BL3.
*Attachments
SELECTION-SCREEN: BEGIN OF BLOCK BL4 WITH FRAME TITLE TEXT-BL4.
PARAMETERS: P_FNAME1 LIKE FILES-LINE.
PARAMETERS: P_FNAME2 LIKE FILES-LINE.
PARAMETERS: P_FNAME3 LIKE FILES-LINE.
PARAMETERS: P_FNAME4 LIKE FILES-LINE.
PARAMETERS: P_FNAME5 LIKE FILES-LINE.
PARAMETERS: P_FNAME6 LIKE FILES-LINE.
SELECTION-SCREEN: END OF BLOCK BL4.
AT SELECTION-SCREEN.
PERFORM CHK_SELECTION.
IF NOT WA_ERROR IS INITIAL.
MESSAGE E001 WITH WA_ERROR.
ENDIF.
START-OF-SELECTION.
END-OF-SELECTION.
PERFORM SEND_EMAIL.
FORM chk_selection
FORM CHK_SELECTION.
CLEAR WA_ERROR.
*Loop only once ???
*If more checkings to be done.
*Think about it and if not clear.
*Let it sink in for a couple of minutes.
*Still doesn't make sence? Go home and sleep on it.
DO 1 TIMES.
*Check Email to
IF P_MAILTO IS INITIAL .
*AND s_mailto IS INITIAL.
WA_ERROR = 'Invalid or no EMAIL TO selection'.
EXIT.
ENDIF.
ENDDO.
ENDFORM. "chk_selection
*& Form send_email
*text
*--> p1 text
*<-- p2 text
FORM SEND_EMAIL.
PERFORM GET_FOLDER_INFO.
PERFORM FILL_BODY.
PERFORM INS_NEW_OBJECT.
PERFORM CRT_ATTACHMENTS.
PERFORM FILL_RECEIVERS_INFO.
PERFORM SND_EMAIL.
ENDFORM. " send_email
*--+--
*FORM Get_folder_info
FORM GET_FOLDER_INFO.
CLEAR T_SOUD.
*Small so should be quick.
SELECT * FROM SOUD
INTO T_SOUD
WHERE SAPNAM = SY-UNAME.
P_INFOLDER-FOLTP = 'FOL'.
P_INFOLDER-FOLYR = T_SOUD-INBYR. "inbox
P_INFOLDER-FOLNO = T_SOUD-INBNO.
P_OUTFOLDER-FOLTP = 'FOL'.
P_OUTFOLDER-FOLYR = T_SOUD-OUTYR. "outbox
P_OUTFOLDER-FOLNO = T_SOUD-OUTNO.
ENDSELECT.
ENDFORM. "get_folder_info
*FORM fill_body *
FORM FILL_BODY.
OBJECT_CONTENT-LINE = P_BODY1.
APPEND OBJECT_CONTENT.
OBJECT_CONTENT-LINE = P_BODY2.
APPEND OBJECT_CONTENT.
OBJECT_CONTENT-LINE = P_BODY3.
APPEND OBJECT_CONTENT.
OBJECT_CONTENT-LINE = P_BODY4.
APPEND OBJECT_CONTENT.
OBJECT_CONTENT-LINE = P_BODY5.
APPEND OBJECT_CONTENT.
OBJECT_CONTENT-LINE = P_BODY6.
APPEND OBJECT_CONTENT.
ENDFORM. "fill_body
*FORM ins_new_object *
FORM INS_NEW_OBJECT.
OBJECT_HD_CHANGE-OBJNAM = 'Notes'.
OBJECT_HD_CHANGE-OBJDES = P_SUBJ.
CALL FUNCTION 'SO_OBJECT_INSERT'
EXPORTING
FOLDER_ID = P_OUTFOLDER
OBJECT_HD_CHANGE = OBJECT_HD_CHANGE
OBJECT_TYPE = 'RAW'
OWNER = SY-UNAME
IMPORTING
OBJECT_HD_DISPLAY = OBJECT_HD_DISPLAY
OBJECT_ID = OBJECT_ID
TABLES
OBJCONT = OBJECT_CONTENT
OBJHEAD = OBJHEAD
EXCEPTIONS
ACTIVE_USER_NOT_EXIST = 1
COMMUNICATION_FAILURE = 2
COMPONENT_NOT_AVAILABLE = 3
DL_NAME_EXIST = 4
FOLDER_NOT_EXIST = 5
FOLDER_NO_AUTHORIZATION = 6
OBJECT_TYPE_NOT_EXIST = 7
OPERATION_NO_AUTHORIZATION = 8
OWNER_NOT_EXIST = 9
PARAMETER_ERROR = 10
SUBSTITUTE_NOT_ACTIVE = 11
SUBSTITUTE_NOT_DEFINED = 12
SYSTEM_FAILURE = 13
X_ERROR = 14
OTHERS = 15.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "ins_new_object
*FORM crt_attachments *
*--> P_SUBJ *
FORM CRT_ATTACHMENTS.
DOCUMENT-FOLTP = P_OUTFOLDER-FOLTP.
DOCUMENT-FOLYR = P_OUTFOLDER-FOLYR.
DOCUMENT-FOLNO = P_OUTFOLDER-FOLNO.
DOCUMENT-OBJTP = OBJECT_ID-OBJTP.
DOCUMENT-OBJYR = OBJECT_ID-OBJYR.
DOCUMENT-OBJNO = OBJECT_ID-OBJNO.
DOCUMENT-OBJNAM = 'Notes'.
DOCUMENT-OBJDES = P_SUBJ.
DOCUMENT-OKCODE = 'CHNG'.
DOCUMENT-FILE_EXT = 'TXT'.
LINK_FOLDER_ID = OBJECT_ID.
HEADER_DATA-OBJLA = 'EN'.
HEADER_DATA-OBJNAM = DOCUMENT-OBJNAM.
HEADER_DATA-OBJDES = DOCUMENT-OBJDES.
HEADER_DATA-OBJPRI = '5'.
HEADER_DATA-OBJSNS = 'O'.
HEADER_DATA-FILE_EXT = 'TXT'.
REFRESH FILES.
CLEAR FILES.
IF NOT P_FNAME1 IS INITIAL.
FILES-LINE = P_FNAME1.
APPEND FILES.
ENDIF.
IF NOT P_FNAME2 IS INITIAL.
FILES-LINE = P_FNAME2.
APPEND FILES.
ENDIF.
IF NOT P_FNAME3 IS INITIAL.
FILES-LINE = P_FNAME3.
APPEND FILES.
ENDIF.
IF NOT P_FNAME4 IS INITIAL.
FILES-LINE = P_FNAME4.
APPEND FILES.
ENDIF.
IF NOT P_FNAME5 IS INITIAL.
FILES-LINE = P_FNAME5.
APPEND FILES.
ENDIF.
IF NOT P_FNAME6 IS INITIAL.
FILES-LINE = P_FNAME6.
APPEND FILES.
ENDIF.
IF NOT FILES[] IS INITIAL.
CALL FUNCTION 'SO_DOCUMENT_REPOSITORY_MANAGER'
EXPORTING
METHOD = 'ATTCREATEFROMPC'
TABLES
FILES = FILES
CHANGING
DOCUMENT = DOCUMENT
HEADER_DATA = HEADER_DATA.
IF SY-SUBRC = 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDIF.
ENDFORM. "crt_attachments
*FORM fill_receivers_info *
FORM FILL_RECEIVERS_INFO.
DATA: BEGIN OF RECLIST OCCURS 0,
REC LIKE RECEIVERS-RECEXTNAM,
END OF RECLIST.
*Build reclist
REFRESH RECLIST.
IF NOT P_MAILTO IS INITIAL.
RECLIST-REC = P_MAILTO.
APPEND RECLIST.
ENDIF.
*IF NOT s_mailto IS INITIAL.
*SELECT zdesc
*INTO reclist-rec
*FROM zlookup
*WHERE ztype IN s_mailto.
*APPEND reclist.
*ENDSELECT.
*ENDIF.
REFRESH RECEIVERS.
LOOP AT RECLIST.
FOLDER_SELECTIONS-FOLNAM = 'INBOX'.
CALL FUNCTION 'SO_FOLDER_LIST_READ'
EXPORTING
FOLDER_SELECTIONS = FOLDER_SELECTIONS
OWNER = SY-UNAME
REGION = 'P'
TABLES
FOLDER_LIST = FOLDER_LIST
EXCEPTIONS
COMPONENT_NOT_AVAILABLE = 1
OPERATION_NO_AUTHORIZATION = 2
OWNER_NOT_EXIST = 3
PARAMETER_ERROR = 4
X_ERROR = 5
OTHERS = 6.
IF SY-SUBRC = 0.
CLEAR RECEIVERS.
MOVE: SY-DATUM TO RECEIVERS-RCDAT,
SY-UZEIT TO RECEIVERS-RCTIM,
' ' TO RECEIVERS-RECESC,
P_MAILTO TO RECEIVERS-RECNAM,
'X' TO RECEIVERS-SNDEX.
APPEND RECEIVERS.
RECEIVERS-RCDAT = SY-DATUM.
RECEIVERS-RCTIM = SY-UZEIT.
RECEIVERS-RECNAM = RECLIST-REC.
RECEIVERS-RECNO = FOLDER_LIST-PARNO.
RECEIVERS-RECTP = FOLDER_LIST-PARTP.
RECEIVERS-RECYR = FOLDER_LIST-PARYR.
RECEIVERS-SNDTP = FOLDER_LIST-PARTP.
RECEIVERS-SNDYR = FOLDER_LIST-PARYR.
RECEIVERS-SNDNO = FOLDER_LIST-PARNO.
RECEIVERS-SNDNAM = SY-UNAME.
RECEIVERS-SNDPRI = '1'.
RECEIVERS-MSGID = 'SO'.
RECEIVERS-MSGNO = '619'.
RECEIVERS-DELIVER = 'X'.
RECEIVERS-NOT_DELI = 'X'.
RECEIVERS-READ = 'X'.
RECEIVERS-MAILSTATUS = 'E'.
**receivers-ADR_NAME
RECEIVERS-RESEND = ' '.
RECEIVERS-SORTFIELD = ' '. "'USER WF_BATCH INDIGO BATCH'.
RECEIVERS-SORTCLASS = '5'.
APPEND RECEIVERS.
ELSE.
CLEAR RECEIVERS.
RECEIVERS-SEL = 'X'.
RECEIVERS-RECESC = 'U'.
RECEIVERS-RECNAM = 'U-'.
RECEIVERS-RECEXTNAM = RECLIST-REC.
RECEIVERS-DELIVER = 'X'.
RECEIVERS-NOT_DELI = 'X'.
RECEIVERS-READ = 'X'.
RECEIVERS-MAILSTATUS = 'E'.
RECEIVERS-ADR_NAME = RECLIST-REC.
RECEIVERS-SORTFIELD = RECLIST-REC.
RECEIVERS-SORTCLASS = '5'.
APPEND RECEIVERS.
ENDIF.
ENDLOOP.
ENDFORM. "fill_receivers_info
*FORM snd_email *
FORM SND_EMAIL.
CALL FUNCTION 'SO_OBJECT_SEND'
EXPORTING
FOLDER_ID = P_OUTFOLDER
OBJECT_ID = OBJECT_ID
OUTBOX_FLAG = 'X'
OWNER = SY-UNAME
CHECK_SEND_AUTHORITY = 'X'
ORIGINATOR_TYPE = 'J'
LINK_FOLDER_ID = LINK_FOLDER_ID
TABLES
OBJCONT = OBJECT_CONTENT
RECEIVERS = RECEIVERS
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.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. "snd_email
go through this.
Thanks
Similar Messages
-
ALV output to be mailed in excel format
Hi All,
Currently we have a alv grid report, but my user requirement is he want this alv grid output to be mailed to his mail id in excel format.
some times data may be huge of about 8000 - 10,000 lines.
is it possiable.
can any one help.hi check this code
Here i'm posting u sample code try to execute it. It will convert all the data in the related tables to excel format and transfer it to respective mail id
code&----
*& Report ZTESTMAIL *
REPORT ZTESTMAIL .
tables: ekko.
parameters: p_email type somlreci1-receiver .
types: begin of t_ekpo,
ebeln type ekpo-ebeln,
ebelp type ekpo-ebelp,
aedat type ekpo-aedat,
matnr type ekpo-matnr,
end of t_ekpo.
data: it_ekpo type standard table of t_ekpo initial size 0,
wa_ekpo type t_ekpo.
types: begin of t_charekpo,
ebeln(10) type c,
ebelp(5) type c,
aedat(8) type c,
matnr(18) type c,
end of t_charekpo.
data: wa_charekpo type t_charekpo.
data: it_message type standard table of solisti1 initial size 0
with header line.
data: it_attach type standard table of solisti1 initial size 0
with header line.
data: t_packing_list like sopcklsti1 occurs 0 with header line,
t_contents like solisti1 occurs 0 with header line,
t_receivers like somlreci1 occurs 0 with header line,
t_attachment like solisti1 occurs 0 with header line,
t_object_header like solisti1 occurs 0 with header line,
w_cnt type i,
w_sent_all(1) type c,
w_doc_data like sodocchgi1,
gd_error type sy-subrc,
gd_reciever type sy-subrc.
t_object_header = 'Text.xls'. append t_object_header.
*START_OF_SELECTION
start-of-selection.
Retrieve sample data from table ekpo
perform data_retrieval.
Populate table with detaisl to be entered into .xls file
perform build_xls_data_table.
*END-OF-SELECTION
end-of-selection.
Populate message body text
perform populate_email_message_body.
Send file by email as .xls speadsheet
perform send_file_as_email_attachment
tables it_message
it_attach
using p_email
'Example .xls documnet attachment'
'XLS'
'filename'
changing gd_error
gd_reciever.
Instructs mail send program for SAPCONNECT to send email(rsconn01)
perform initiate_mail_execute_program.
*& Form DATA_RETRIEVAL
Retrieve data form EKPO table and populate itab it_ekko
form data_retrieval.
select ebeln ebelp aedat matnr
up to 10 rows
from ekpo
into table it_ekpo.
endform. " DATA_RETRIEVAL
*& Form BUILD_XLS_DATA_TABLE
Build data table for .xls document
form build_xls_data_table.
*CONSTANTS: con_cret TYPE x VALUE '0D', "OK for non Unicode
*con_tab TYPE x VALUE '09'. "OK for non Unicode
*If you have Unicode check active in program attributes thnen you will
*need to declare constants as follows
*class cl_abap_char_utilities definition load.
constants:
con_tab type c value cl_abap_char_utilities=>horizontal_tab,
con_cret type c value cl_abap_char_utilities=>cr_lf.
concatenate 'EBELN' 'EBELP' 'AEDAT' 'MATNR'
into it_attach separated by con_tab.
concatenate con_cret it_attach into it_attach.
append it_attach.
loop at it_ekpo into wa_charekpo.
concatenate wa_charekpo-ebeln wa_charekpo-ebelp
wa_charekpo-aedat wa_charekpo-matnr
into it_attach separated by con_tab.
concatenate con_cret it_attach into it_attach.
append it_attach.
endloop.
endform. " BUILD_XLS_DATA_TABLE
*& Form SEND_FILE_AS_EMAIL_ATTACHMENT
Send email
form send_file_as_email_attachment tables pit_message
pit_attach
using p_email
p_mtitle
p_format
p_filename
p_attdescription
p_sender_address
p_sender_addres_type
changing p_error
p_reciever.
data: ld_error type sy-subrc,
ld_reciever type sy-subrc,
ld_mtitle like sodocchgi1-obj_descr,
ld_email like somlreci1-receiver,
ld_format type so_obj_tp ,
ld_attdescription type so_obj_nam ,
ld_attfilename type so_obj_des ,
ld_sender_address like soextreci1-receiver,
ld_sender_address_type like soextreci1-adr_typ,
ld_receiver like sy-subrc.
ld_email = p_email.
ld_mtitle = p_mtitle.
ld_format = p_format.
ld_attdescription = p_attdescription.
ld_attfilename = p_filename.
ld_sender_address = p_sender_address.
ld_sender_address_type = p_sender_addres_type.
Fill the document data.
w_doc_data-doc_size = 1.
Populate the subject/generic message attributes
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle .
w_doc_data-sensitivty = 'F'.
Fill the document data and get size of attachment
clear w_doc_data.
read table it_attach index w_cnt.
w_doc_data-doc_size =
( w_cnt - 1 ) * 255 + strlen( it_attach ).
w_doc_data-obj_langu = sy-langu.
w_doc_data-obj_name = 'SAPRPT'.
w_doc_data-obj_descr = ld_mtitle.
w_doc_data-sensitivty = 'F'.
clear t_attachment.
refresh t_attachment.
t_attachment] = pit_attach[.
Describe the body of the message
clear t_packing_list.
refresh t_packing_list.
t_packing_list-transf_bin = space.
t_packing_list-head_start = 1.
t_packing_list-head_num = 0.
t_packing_list-body_start = 1.
describe table it_message lines t_packing_list-body_num.
t_packing_list-doc_type = 'RAW'.
append t_packing_list.
Create attachment notification
t_packing_list-transf_bin = 'X'.
t_packing_list-head_start = 1.
t_packing_list-head_num = 1.
t_packing_list-body_start = 1.
describe table t_attachment lines t_packing_list-body_num.
t_packing_list-doc_type = ld_format.
t_packing_list-obj_descr = ld_attdescription.
t_packing_list-obj_name = ld_attfilename.
t_packing_list-doc_size = t_packing_list-body_num * 255.
append t_packing_list.
Add the recipients email address
clear t_receivers.
refresh t_receivers.
t_receivers-receiver = ld_email.
t_receivers-rec_type = 'U'.
t_receivers-com_type = 'INT'.
t_receivers-notif_del = 'X'.
t_receivers-notif_ndel = 'X'.
append t_receivers.
call function 'SO_DOCUMENT_SEND_API1'
exporting
document_data = w_doc_data
put_in_outbox = 'X'
sender_address = ld_sender_address
sender_address_type = ld_sender_address_type
commit_work = 'X'
importing
sent_to_all = w_sent_all
tables
object_header = t_object_header
packing_list = t_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = t_receivers
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.
Populate zerror return code
ld_error = sy-subrc.
Populate zreceiver return code
loop at t_receivers.
ld_receiver = t_receivers-retrn_code.
endloop.
endform.
*& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
form initiate_mail_execute_program.
wait up to 2 seconds.
submit rsconn01 with mode = 'INT'
with output = 'X'
and return.
endform. " INITIATE_MAIL_EXECUTE_PROGRAM
*& Form POPULATE_EMAIL_MESSAGE_BODY
Populate message body text
form populate_email_message_body.
refresh it_message.
it_message = 'Please find attached a list test ekpo records'.
append it_message.
endform. " POPULATE_EMAIL_MESSAGE_BODY
*PARAMETERS: psubject(40) type c default 'Testing',
*p_email(40) type c . "use ur email id
*data: it_packing_list like sopcklsti1 occurs 0 with header line,
*it_contents like solisti1 occurs 0 with header line,
*it_receivers like somlreci1 occurs 0 with header line,
*it_attachment like solisti1 occurs 0 with header line,
*gd_cnt type i,
*gd_sent_all(1) type c,
*gd_doc_data like sodocchgi1,
*gd_error type sy-subrc.
*data: it_message type standard table of SOLISTI1 initial size 0
*with header line.
**START-OF-SELECTION.
*START-OF-SELECTION.
*Perform populate_message_table.
**Send email message, although is not sent from SAP until mail send
**program has been executed(rsconn01)
*PERFORM send_email_message.
**Instructs mail send program for SAPCONNECT to send email(rsconn01)
*perform initiate_mail_execute_program.
**& Form POPULATE_MESSAGE_TABLE
Adds text to email text table
*form populate_message_table.
*Append 'Line1' to it_message.
*Append 'Line2' to it_message.
*Append 'Line3' to it_message.
*Append 'Test- 1' to it_message.
*endform. " POPULATE_MESSAGE_TABLE
**& Form SEND_EMAIL_MESSAGE
Send email message
*form send_email_message.
Fill the document data.
*gd_doc_data-doc_size = 1.
DATA: TAB_LINES LIKE sy-tabix.
DESCRIBE TABLE it_message LINES TAB_LINES.
READ TABLE it_message INDEX TAB_LINES.
gd_doc_data-DOC_SIZE = ( TAB_LINES - 1 ) * 255 + STRLEN( it_message )
Populate the subject/generic message attributes
*gd_doc_data-obj_langu = sy-langu.
*gd_doc_data-obj_name = 'SAPRPT'.
*gd_doc_data-obj_descr = psubject.
*gd_doc_data-sensitivty = 'F'.
Describe the body of the message
Information about structure of data tables
*clear it_packing_list.
*refresh it_packing_list.
*it_packing_list-transf_bin = space.
*it_packing_list-head_start = 1.
*it_packing_list-head_num = 0.
*it_packing_list-body_start = 1.
*describe table it_message lines it_packing_list-body_num.
*it_packing_list-doc_type = 'RAW'.
*append it_packing_list.
Add the recipients email address
*clear it_receivers.
*refresh it_receivers.
*it_receivers-receiver = p_email.
*it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = 'X'.
it_receivers-notif_ndel = 'X'.
*append it_receivers.
Call the FM to post the message to SAPMAIL
*call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
*exporting
*document_data = gd_doc_data
*put_in_outbox = 'X'
*importing
*sent_to_all = gd_sent_all
*tables
*packing_list = it_packing_list
*contents_txt = it_message
*receivers = it_receivers
*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.
Store function module return code
*gd_error = sy-subrc.
Get it_receivers return code
*loop at it_receivers.
*endloop.
*endform. " SEND_EMAIL_MESSAGE
**& Form INITIATE_MAIL_EXECUTE_PROGRAM
Instructs mail send program for SAPCONNECT to send email.
*form initiate_mail_execute_program.
*wait up to 2 seconds.
*if gd_error eq 0.
*submit rsconn01 with mode = 'INT'
*with output = 'X'
*and return.
*endif.
*endform. " INITIATE_MAIL_EXECUTE_PROGRAM
[/code] -
Sending report output via E-mail (excel pivoted format)
Hi all,
i have a written a report where i need to send the report output to somebody via
E-mail.i am sending this report output via E-mail successfully.The receiver receives, my output in excel format.but this excel is not <b>pivoted</b>.
i want , the receiver should get my output in pivoted excel format.i.e my output data should be exactly fit in the excel sheet.
now the columns in excel sheet are overlapping.once i double clicked, the columns are getting separated.i do not want to double click.i want all the columns should come properly i.e excel field length should be adjusted as per the output field length.
i am giving my coding below.plz suggest how i can do the above thing .it's urgent.
any idea will be highly appreaciated.
Regards
if not p_email1 is initial.
perform fill_report_csv.
perform f_send_internet_mail.
endif.
FORM fill_report_csv.
data : l_text(232) type c,
v_matnr1(21) type c,
v_matnr(21) type c,
v_matkl(14) type c,
v_maktx(45) type c,
v_ttlstk(14) type c,
v_verpr(14) type c,
v_werks(14) type c,
v_lgort(14) type c,
v_char(10) type c,
v_stks type p ,
v_po(40) type c,
v_qty(13) type c,
v_qty1 type sy-datum,
v_date(15) type c,
v_date1(15) TYPE C,
v_name(35) type c,
v_eknam(18) type c,
v_lifnr(15) type c,
l_po(40) type c,
v_matnr(20) type c,
l_rate(11) type p decimals 5,
l_flag type c.
concatenate c_equal c_colon 'PO no.' c_colon
into v_po.
concatenate c_equal c_colon 'Material no.' c_colon
into v_matnr.
concatenate c_equal c_colon 'Description.' c_colon
into v_maktx.
concatenate c_equal c_colon 'Due Qty.' c_colon
into v_qty.
concatenate c_equal c_colon 'Del Date.' c_colon
into v_date.
concatenate c_equal c_colon 'Vendor.' c_colon
into v_name.
concatenate c_equal c_colon 'Buyer.' c_colon
into v_eknam.
concatenate c_equal c_colon 'Vendor Code.' c_colon
into v_lifnr.
concatenate
v_po v_matnr v_maktx v_qty
v_date v_name v_eknam v_lifnr
into i_download
SEPARATED BY con_tab.
append i_download .
clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
clear wa_output.
loop at i_output into wa_output.
on change of wa_output-ebeln.
clear v_lines.
loop at i_eket into wa_eket
where ebeln = wa_output-ebeln.
v_lines = v_lines + 1.
clear wa_eket.
endloop.
**-- Checking of page break
v_lines = sy-linno + v_lines .
if 55 < v_lines .
write:/0(161) sy-uline.
new-page.
endif.
clear v_lines.
loop at i_eket into wa_eket
where ebeln = wa_output-ebeln.
v_lines = v_lines + 1.
clear wa_eket.
endloop.
*-- Calculating the due qty.
wa_output-dumng = wa_output-menge - wa_output-wemng.
*-- Writing the Line items of the PO.
read table i_ekpo into wa_ekpo
with key ebeln = wa_output-ebeln
ebelp = wa_output-ebelp.
l_rate = wa_ekpo-netpr / wa_ekpo-peinh.
*-- Writing of PO detail
if wa_output-dumng gt 0 .
v_qty = wa_output-dumng.
v_date1 = wa_output-eindt.
v_maktx = wa_output-maktx.
if wa_output-maktx+0(1) = '"' .
concatenate c_equal wa_output-maktx
into v_maktx .
else .
concatenate c_equal c_colon wa_output-maktx c_colon
into v_maktx .
endif .
if wa_output-name1+0(1) = '"' .
concatenate c_equal wa_output-name1
into v_name .
else .
concatenate c_equal c_colon wa_output-name1 c_colon
into v_name .
endif .
v_name = wa_output-name1.
v_lifnr = wa_output-lifnr.
write wa_output-eindt to v_date1 DD/MM/YYYY.
concatenate '="' wa_output-ebeln '/'
wa_output-ebelp '"' into v_po .
concatenate '="' wa_output-matnr '"' into v_matnr .
concatenate c_equal c_colon wa_output-maktx c_colon
into v_maktx .
concatenate c_equal c_colon wa_output-dumng c_colon
into v_qty1 .
concatenate c_equal c_colon wa_output-eindt c_colon
into v_date1 .
concatenate c_equal c_colon wa_output-name1 c_colon
into v_name .
concatenate c_equal c_colon wa_output-eknam c_colon
into v_eknam .
concatenate c_equal c_colon wa_output-lifnr c_colon
into v_lifnr .
concatenate c_equal c_colon wa_mard-werks '/'
wa_mard-lgort c_colon
into v_lgort .
concatenate '="' wa_output-lifnr '"' into v_lifnr .
condense:v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
concatenate
v_po v_matnr v_maktx v_qty
v_date1 v_name v_eknam v_lifnr
into i_download
SEPARATED BY con_tab.
concatenate con_cret i_download INTO i_download .
append i_download .
endif.
clear : v_po,v_matnr, v_maktx, v_qty, v_date, v_name, v_eknam,v_lifnr .
endloop.
ENDFORM. " fill_report_csv
*& Form f_send_internet_mail
text
--> p1 text
<-- p2 text
FORM f_send_internet_mail.
Variables
data: it_packing_list like sopcklsti1 occurs 0 with header line,
it_contents like solisti1 occurs 0 with header line,
it_receivers like somlreci1 occurs 0 with header line,
it_attachment like solisti1 occurs 0 with header line,
gd_cnt type i,
gd_sent_all(1) type c,
gd_doc_data like sodocchgi1,
gd_error type sy-subrc.
data: it_message type standard table of SOLISTI1 initial size 0
with header line.
data : found_receiver type c,
v_title(80) type c,
l_text(180) type c.
Fill the document data.
gd_doc_data-doc_size = 1.
Adds text to email text table
append 'Pls see attached open purchase order report.' to it_message.
append '' to it_message.
concatenate 'Note: This is system generated report'
', figures may subject to actual physical count.'
into l_text separated by space.
append l_text to it_message.
Populate the subject/generic message attributes
CLEAR gd_doc_data.
READ TABLE i_download INDEX w_cnt.
gd_doc_data-doc_size =
( w_cnt - 1 ) * 255 + STRLEN( i_download ).
gd_doc_data-obj_langu = sy-langu.
gd_doc_data-obj_name = 'SAPRPT'.
if p_asdate is initial .
concatenate p_title ' '
sy-datum sy-uzeit into v_title separated by space.
else .
concatenate p_title ' '
p_bldat p_cputm into v_title separated by space.
endif .
gd_doc_data-obj_descr = v_title .
gd_doc_data-sensitivty = 'F'.
CLEAR t_attachment.
REFRESH t_attachment.
t_attachment[] = i_download[].
Describe the body of the message
clear it_packing_list.
refresh it_packing_list.
it_packing_list-transf_bin = space.
it_packing_list-head_start = 1.
it_packing_list-head_num = 0.
it_packing_list-body_start = 1.
describe table it_message lines it_packing_list-body_num.
it_packing_list-doc_type = 'RAW'.
append it_packing_list.
Create attachment notification
it_packing_list-transf_bin = 'X'.
it_packing_list-head_start = 1.
it_packing_list-head_num = 1.
it_packing_list-body_start = 1.
DESCRIBE TABLE t_attachment LINES it_packing_list-body_num.
it_packing_list-doc_type = 'XLS'.
it_packing_list-obj_descr = 'OPEN PURCHASE ORDER' .
it_packing_list-obj_name = 'PO.XLS' .
it_packing_list-doc_size = it_packing_list-body_num * 255.
APPEND it_packing_list.
assign SAP user smtp address from successful retrieval.
loop at p_email.
Add the recipients email address
found_receiver = 'X' .
it_receivers-receiver = p_email-low.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = ''.
it_receivers-notif_ndel = 'X'.
append it_receivers .
endloop .
Add default recipient email when unable to locate purc group email
if found_receiver is initial .
it_receivers-receiver = p_email.
it_receivers-rec_type = 'U'.
it_receivers-com_type = 'INT'.
it_receivers-notif_del = ''.
it_receivers-notif_ndel = 'X'.
append it_receivers.
endif .
Call the FM to post the message to SAPMAIL
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = gd_doc_data
put_in_outbox = 'X'
commit_work = 'X'
importing
sent_to_all = gd_sent_all
tables
packing_list = it_packing_list
contents_bin = t_attachment
contents_txt = it_message
receivers = it_receivers
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.
Store function module return code
gd_error = sy-subrc.
Get it_receivers return code
loop at it_receivers.
endloop.
Instructs mail send program for SAPCONNECT to send email.
wait up to 2 seconds.
if gd_error eq 0.
submit rsconn01 with mode = 'INT'
with output = ' '
and return.
endif.
ENDFORM. " f_send_internet_mailHi,
go through this link,
http://www.sapdevelopment.co.uk/reporting/email/emailhome.htm
you have some sample programs.
Regards,
Raghavendra -
How to send the form data through mail with pdf format?
forms 6i
Hi to all,
i am developed one master detail form.example is based on the dept number emp details will be displayed.here my requirment is whatever displayed on the form
the data ,these data send to mail with any format.is it possible? if is possible any one give a proper solution.
Regards,
Stevie
Edited by: 994418 on 6 May, 2013 11:15 PMHello,
you can create a Report that accepts the search parameters from the Forms mask and generates a PDF. You also have the option to send the report via mail.
Personally I would generate the report with a tool like as_pdf
http://technology.amis.nl/2012/04/11/generating-a-pdf-document-with-some-plsql-as_pdf_mini-as_pdf3/
Then you can send the mail using utl_mail or utl_smtp.
www.google.com/search?q=site:forums.oracle.com+utl_mail+utl_smtp
Regards
Marcus -
To send report output to a mail with PDF attachment
Hi All,
I have developed a code and the output of the code as to send to a mial id's mentioned on the selection screen with a PDF attachemnt.
So can any one suggest me how to do and it won't run in background it should always run in foreground.
Any examples please let me know ASAP.
Thanks
Sagar.Hi Try this code with the same requirement i have also been working with i have got this code in SDN.
Check this copy paste and execute i am getting the PDF file but not opening any how try and see
*& Report ZSDNF *
REPORT ZSDNF.
TABLES :
vbak,
vbap,
vbpa,
mara.
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001.
SELECT-OPTIONS:
s_vkorg FOR vbak-vkorg OBLIGATORY,
s_vtweg FOR vbak-vtweg OBLIGATORY,
s_spart FOR vbak-spart OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b1.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-002.
SELECT-OPTIONS:
s_vbeln FOR vbak-vbeln,
s_matnr FOR mara-matnr.
PARAMETERS:
p_kunnr TYPE vbak-kunnr.
SELECT-OPTIONS:
s_erdat FOR vbak-erdat OBLIGATORY.
SELECTION-SCREEN END OF BLOCK b2.
DATA : w_spono LIKE tsp01-rqident,
w_binsize TYPE i,
w_filelen TYPE i,
t_sale LIKE TABLE OF tline WITH HEADER LINE.
DATA:
BEGIN OF t_sales OCCURS 0,
vbeln TYPE vbak-vbeln,
vkorg TYPE vbak-vkorg,
vtweg TYPE vbak-vtweg,
spart TYPE vbak-spart,
erdat TYPE vbak-erdat,
kunnr TYPE vbak-kunnr,
posnr TYPE vbap-posnr,
matnr TYPE vbap-matnr,
arktx TYPE vbap-arktx,
parvw TYPE vbpa-parvw,
kwmeng TYPE vbap-kwmeng,
kunnr1 TYPE vbpa-kunnr ,
END OF t_sales.
START-OF-SELECTION.
SELECT vbak~vbeln
vkorg
vtweg
vbak~spart
vbak~erdat
vbak~kunnr
vbap~posnr
matnr
arktx
parvw
kwmeng
vbpa~kunnr
INTO CORRESPONDING FIELDS OF TABLE t_sales
FROM ( ( vbak JOIN vbap ON vbapvbeln EQ vbakvbeln )
JOIN vbpa ON vbpavbeln EQ vbakvbeln
and vbpaposnr eq vbapposnr
AND vbpa~parvw EQ 'WE' )
WHERE vkorg IN s_vkorg
AND vtweg IN s_vtweg
AND vbak~spart IN s_spart
AND vbak~vbeln IN s_vbeln
AND matnr IN s_matnr
AND vbak~kunnr EQ p_kunnr
AND vbak~erdat IN s_erdat.
IF sy-subrc EQ 0.
NEW-PAGE PRINT ON.
PERFORM display_sales_data.
NEW-PAGE PRINT OFF.
ELSE.
MESSAGE 'No records found with the spcified criteria' TYPE 'E'.
ENDIF.
w_spono = sy-spono.
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = w_spono
NO_DIALOG =
DST_DEVICE =
PDF_DESTINATION =
IMPORTING
pdf_bytecount = w_binsize
PDF_SPOOLID =
LIST_PAGECOUNT =
BTC_JOBNAME =
BTC_JOBCOUNT =
TABLES
pdf = t_sale
EXCEPTIONS
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11
OTHERS = 12
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
bin_filesize = w_binsize
filename =
'C:\Documents and Settings\Desktop\SO.pdf'
filetype = 'BIN'
APPEND = ' '
WRITE_FIELD_SEPARATOR = 'X'
HEADER = '00'
TRUNC_TRAILING_BLANKS = ' '
WRITE_LF = 'X'
COL_SELECT = ' '
COL_SELECT_MASK = ' '
DAT_MODE = ' '
CONFIRM_OVERWRITE = ' '
NO_AUTH_CHECK = ' '
CODEPAGE = ' '
IGNORE_CERR = ABAP_TRUE
REPLACEMENT = '#'
WRITE_BOM = ' '
IMPORTING
FILELENGTH = w_filelen
TABLES
data_tab = t_sale
EXCEPTIONS
file_write_error = 1
no_batch = 2
gui_refuse_filetransfer = 3
invalid_type = 4
no_authority = 5
unknown_error = 6
header_not_allowed = 7
separator_not_allowed = 8
filesize_not_allowed = 9
header_too_long = 10
dp_error_create = 11
dp_error_send = 12
dp_error_write = 13
unknown_dp_error = 14
access_denied = 15
dp_out_of_memory = 16
disk_full = 17
dp_timeout = 18
file_not_found = 19
dataprovider_exception = 20
control_flush_error = 21
OTHERS = 22
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
*& Form display_sales_data
This subroutine is used to display the sales report *
No interface parameters
FORM display_sales_data .
LOOP AT t_sales.
AT NEW spart.
SKIP 3.
WRITE :/ 'Sales Organization : ', t_sales-vkorg,
/ 'Distribution Channel : ', t_sales-vtweg,
/ 'Division : ', t_sales-spart.
SKIP.
WRITE:/ 'Sales Order'(001),
15 'Order Date'(002),
30 'Sold-to-party'(003),
50 'Ship-to-party'(004),
65 'Item'(005),
75 'Material'(006),
90 'Quantity'(007).
SKIP.
ENDAT.
IF t_sales-kunnr1 IS INITIAL.
t_sales-kunnr1 = p_kunnr.
ENDIF.
WRITE :/ t_sales-vbeln UNDER text-001,
t_sales-erdat UNDER text-002,
t_sales-kunnr UNDER text-003,
t_sales-kunnr1 UNDER text-004,
t_sales-posnr UNDER text-005,
t_sales-matnr UNDER text-006,
t_sales-kwmeng UNDER text-007.
ENDLOOP.
ENDFORM. -
Error while sending PO output through mail in PDF format - Urgent
Dear friends,
Developed program to send sapscript output through mail in pdf format, the program running properly, even function module SO_NEW_DOCUMENT_ATT_SEND_API1 returning sy-subrc 0. But the external mail is not going to user lying in SAP outbox with message <b>"Wait for communications service"</b> . SCOT is properly configured, tested mails sending through SAP office.
Find below the source code:
REPORT zmm_porder_gm
NO STANDARD PAGE HEADING.
TABLES: ekko, ekpa, t161t, t052, komv, j_1imocomp, t001, esll.
Internal Tables
DATA : txt LIKE tline-tdline, "HEADER LINE
your_ref LIKE ekko-ihrez, "your ref
our_ref LIKE ekko-unsez, "our ref
mcompname LIKE t001-butxt,
itemname LIKE ekpo-txz01,
del_text LIKE tline-tdline, "delivery text
mat_po_text LIKE tline-tdline. "material po text
DATA: g_ind TYPE i.
DATA: it_esll LIKE esll OCCURS 0 WITH HEADER LINE.
DATA: sub_packno LIKE esll-sub_packno.
DATA : po_flag(1) TYPE c.
DATA : it_erev LIKE erev OCCURS 0 WITH HEADER LINE.
DATA : nmebeln LIKE thead-tdname,
obj LIKE thead-tdname.
DATA : tline LIKE tline OCCURS 0 WITH HEADER LINE. "HEADER TEXT
DATA : it_ekko LIKE ekko OCCURS 0 WITH HEADER LINE.
DATA : it_ekpo LIKE ekpo OCCURS 0 WITH HEADER LINE.
DATA : it_zmm_porder LIKE zmm_porder OCCURS 0 WITH HEADER LINE.
DATA : it_konv LIKE konv OCCURS 0 WITH HEADER LINE.
DATA : it_konv_ftr LIKE konv OCCURS 0 WITH HEADER LINE.
DATA : it_konv_rate LIKE konv OCCURS 0 WITH HEADER LINE.
DATA : it_komv_tax LIKE komv OCCURS 0 WITH HEADER LINE. " For Tax Calculation
DATA : it_zmm_house_bank LIKE zmm_house_bank OCCURS 0 WITH HEADER LINE.
*DATA : mrate TYPE konv-kbetr VALUE 0, mrate1(15). rmoved by ganes and added following logic
DATA : mrate TYPE p VALUE 0 DECIMALS 2, mrate1(15).
DATA : mrate_gm TYPE p DECIMALS 2.
DATA : BEGIN OF it_konv1 OCCURS 0,
knumv LIKE konv-knumv,
kschl LIKE konv-kschl,
END OF it_konv1.
DATA : BEGIN OF it_t052u OCCURS 0.
INCLUDE STRUCTURE t052u.
DATA : END OF it_t052u.
DATA : mpay_terms LIKE t052u-text1.
DATA : mwaers LIKE konv-waers.
DATA : BEGIN OF xt052 OCCURS 0.
INCLUDE STRUCTURE t052.
DATA : END OF xt052.
DATA : it_t16ct LIKE t16ct OCCURS 0 WITH HEADER LINE.
DATA : BEGIN OF ztext OCCURS 0.
INCLUDE STRUCTURE ttext.
DATA : END OF ztext.
DATA : it_t001 LIKE t001 OCCURS 0 WITH HEADER LINE.
DATA : mtext(15) TYPE c.
DATA : it_adrc LIKE adrc OCCURS 0 WITH HEADER LINE.
DATA : it_adrc_ven LIKE adrc OCCURS 0 WITH HEADER LINE.
DATA : it_adrc_plt LIKE adrc OCCURS 0 WITH HEADER LINE.
DATA : it_makt LIKE makt OCCURS 0 WITH HEADER LINE.
DATA : it_eket LIKE eket OCCURS 0 WITH HEADER LINE. " Schedulling
DATA : it_eikp LIKE eikp OCCURS 0 WITH HEADER LINE. " Export
DATA : it_t001w LIKE t001w OCCURS 0 WITH HEADER LINE.
DATA : it_t685t LIKE t685t OCCURS 0 WITH HEADER LINE.
DATA : it_t618t LIKE t618t OCCURS 0 WITH HEADER LINE.
DATA : it_t685t_ftr LIKE t685t OCCURS 0 WITH HEADER LINE.
DATA : it_lfa1 LIKE lfa1 OCCURS 0 WITH HEADER LINE.
DATA : it_bapi_mltx_ga LIKE bapi_mltx_ga OCCURS 0 WITH HEADER LINE. "Material long text
DATA : mfirst TYPE i VALUE 0,
mpay_flag(1) TYPE c VALUE 'X',
mwerks LIKE t001w-werks,
msr TYPE i VALUE 0,
l_rate TYPE p DECIMALS 2 VALUE 0,
l_amt TYPE p DECIMALS 2 VALUE 0,
mflag(1) TYPE c,
mlctr TYPE i VALUE 0,
mfamt TYPE p DECIMALS 2 VALUE 0,
mcfamt(15) TYPE c,
mfword(100) TYPE c,
mkschl LIKE konv-kschl,
mchgamt TYPE p DECIMALS 2 VALUE 0,
mkbetr TYPE p DECIMALS 2 VALUE 0,
mkwert TYPE p DECIMALS 2 VALUE 0.
DATA : j_1iexcd TYPE j_1imocomp-j_1iexcd,
j_1icstno TYPE j_1imocomp-j_1icstno,
j_1ilstno TYPE j_1imocomp-j_1ilstno.
DATA : mjmop_r TYPE p DECIMALS 2 VALUE 0,
mjmoq_r TYPE p DECIMALS 2 VALUE 0,
mjecs_r TYPE p DECIMALS 2 VALUE 0,
mjvcs_r TYPE p DECIMALS 2 VALUE 0,
mjvrd_r TYPE p DECIMALS 2 VALUE 0,
mjsep_r TYPE p DECIMALS 2 VALUE 0.
DATA : mjmop_a TYPE p DECIMALS 2 VALUE 0,
mjmoq_a TYPE p DECIMALS 2 VALUE 0,
mjecs_a TYPE p DECIMALS 2 VALUE 0,
mjvcs_a TYPE p DECIMALS 2 VALUE 0,
mjvrd_a TYPE p DECIMALS 2 VALUE 0,
mjsep_a TYPE p DECIMALS 2 VALUE 0.
DATA : mtitle LIKE t161t-batxt.
DATA : no_ammend(10),request_by(50),ver_txt(100),ver_reason(100),stext(200).
begin of Email data declarations**************
DATA: BEGIN OF otf OCCURS 0.
INCLUDE STRUCTURE itcoo .
DATA: END OF otf.
DATA: itcpo LIKE itcpo.
DATA: itcpp LIKE itcpp.
DATA: it_docs TYPE STANDARD TABLE OF docs,
v_bin_filesize TYPE i,
it_lines TYPE STANDARD TABLE OF tline,
wa_lines TYPE tline.
DATA : i_pdf LIKE tline OCCURS 1000 WITH HEADER LINE,
v_pdf_bytecount TYPE i,
v_pdf_spoolid TYPE tsp01-rqident,
v_otf_pagecount TYPE i,
v_btc_jobname TYPE tbtcjob-jobname,
v_btc_jobcount TYPE tbtcjob-jobcount.
DATA: objpack LIKE sopcklsti1 OCCURS 0 WITH HEADER LINE.
DATA: objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE.
DATA: objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE.
DATA: objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE.
DATA: reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
DATA: vafilename(100) VALUE 'po_output.pdf'.
DATA: jobdata TYPE sxjobdata.
DATA arc_params TYPE arc_params.
DATA print_params TYPE pri_params.
DATA g_send_prog TYPE syrepid VALUE 'ZVF03_TEST_PROG'.
DATA immediate TYPE btcchar1.
DATA: i_jobname TYPE tbtcp-jobname,
i_jobcount TYPE tbtcp-jobcount,
i_jobstepcount TYPE tbtcp-stepcount.
DATA recipient_obj LIKE swotobjid.
CONSTANTS: sx_true TYPE sx_boolean VALUE 'X'.
TABLES: tbtcp.
end of Email data declarations**************
SELECTION-SCREEN : BEGIN OF BLOCK block1 WITH FRAME TITLE text-001.
SELECT-OPTIONS : mebeln FOR ekko-ebeln OBLIGATORY . " 75
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN POSITION 12.
SELECTION-SCREEN COMMENT (20) text-b01.
PARAMETERS: b1 AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF LINE.
SELECTION-SCREEN : END OF BLOCK block1.
SELECTION-SCREEN: BEGIN OF SCREEN 200 TITLE text-001 AS WINDOW.
PARAMETERS : p_email TYPE ad_smtpadr. "E-Mail Address
SELECTION-SCREEN: END OF SCREEN 200.
INITIALIZATION.
SET PF-STATUS 'ZMMPORD_STAT'.
AT SELECTION-SCREEN.
CASE sy-ucomm.
WHEN 'EMAIL'.
PERFORM zemail.
WHEN '&IC1'.
PERFORM load_data.
PERFORM process.
IF NOT p_email IS INITIAL.
PERFORM send_mail.
ENDIF.
ENDCASE.
*START-OF-SELECTION.
PERFORM load_data.
PERFORM process.
FORM load_data .
DATA : gindex LIKE sy-tabix.
SELECT * FROM t16ct INTO TABLE it_t16ct WHERE spras = 'EN'.
SELECT * FROM ekko INTO TABLE it_ekko WHERE ebeln IN mebeln.
IF sy-subrc EQ 0.
SELECT * FROM erev INTO CORRESPONDING FIELDS OF TABLE it_erev FOR ALL ENTRIES IN it_ekko
WHERE edokn = it_ekko-ebeln AND rscod <> '' .
SORT it_erev BY edokn revno DESCENDING.
LOOP AT it_ekko.
IF NOT ( it_ekko-frgke EQ 'O' OR it_ekko-frgke EQ '0' ) .
MESSAGE e000(zsd) WITH 'Purchase Order is not Realeased'.
ENDIF.
ENDLOOP.
SELECT * FROM ekpo INTO TABLE it_ekpo WHERE ebeln IN mebeln.
IF sy-subrc EQ 0.
SELECT * INTO TABLE it_makt
FROM makt
FOR ALL ENTRIES IN it_ekpo
WHERE matnr EQ it_ekpo-matnr.
SELECT * INTO TABLE it_lfa1
FROM lfa1
FOR ALL ENTRIES IN it_ekko
WHERE lifnr EQ it_ekko-lifnr.
ENDIF.
SELECT *
INTO TABLE it_t052u
FROM t052u
FOR ALL ENTRIES IN it_ekko
WHERE zterm EQ it_ekko-zterm
AND spras EQ 'EN'.
IF sy-subrc EQ 0.
SORT it_t052u BY zterm.
ENDIF.
SELECT * FROM eket INTO TABLE it_eket WHERE ebeln IN mebeln.
IF sy-subrc EQ 0.
SORT it_eket BY ebeln ebelp.
ENDIF.
SELECT *
INTO TABLE it_eikp
FROM eikp
FOR ALL ENTRIES IN it_ekko
WHERE exnum EQ it_ekko-exnum.
IF sy-subrc EQ 0.
SORT it_eikp BY exnum.
SELECT *
INTO TABLE it_t618t
FROM t618t
FOR ALL ENTRIES IN it_eikp
WHERE expvz EQ it_eikp-expvz
AND spras EQ 'E'
AND land1 EQ 'IN'.
IF sy-subrc EQ 0.
SORT it_t618t BY expvz.
ENDIF.
ENDIF.
REFRESH : it_zmm_porder.
CLEAR : it_zmm_porder.
SELECT * INTO TABLE it_zmm_porder
FROM zmm_porder
WHERE flag EQ 'L'.
IF sy-subrc EQ 0.
SORT it_zmm_porder BY kschl.
ENDIF.
SELECT * FROM konv INTO TABLE it_konv
FOR ALL ENTRIES IN it_ekko
WHERE knumv = it_ekko-knumv
AND kwert NE 0.
LOOP AT it_konv.
gindex = sy-tabix.
READ TABLE it_zmm_porder WITH KEY kschl = it_konv-kschl BINARY SEARCH.
IF sy-subrc NE 0.
DELETE it_konv INDEX gindex.
ENDIF.
ENDLOOP.
IF sy-subrc EQ 0.
SORT it_konv BY knumv kherk kschl.
ENDIF.
REFRESH : it_zmm_porder.
CLEAR : it_zmm_porder.
SELECT * INTO TABLE it_zmm_porder
FROM zmm_porder
WHERE flag EQ 'F'.
IF sy-subrc EQ 0.
SORT it_zmm_porder BY kschl.
ENDIF.
SELECT * INTO TABLE IT_KONV_FTR FROM KONV
FOR ALL ENTRIES IN IT_EKKO
WHERE KNUMV = IT_EKKO-KNUMV
AND ( KSCHL = 'ZIN1'
OR KSCHL = 'ZIN2'
OR KSCHL = 'ZINS'
OR KSCHL = 'ZPF1'
OR KSCHL = 'ZPF2'
OR KSCHL = 'ZPF3'
OR KSCHL = 'ZPKG'
OR KSCHL = 'ZPKF'
OR KSCHL = 'FRA1'
OR KSCHL = 'FRB1'
OR KSCHL = 'FRC1'
OR KSCHL = 'FRD1'
OR KSCHL = 'FRD2'
OR KSCHL = 'FRD3'
OR KSCHL = 'FRD4'
OR KSCHL = 'FRD5'
*****Added one condition type below ZFBC as on 05.06.2007 :Rajiv as per mail of Sadiq via mathew sir(RTDK906646)
OR KSCHL = 'ZFBC' )
AND KWERT NE 0
AND KPOSN GT '000000'.
AND ( KRECH = 'B' " RTDK906167
OR KRECH = 'A' ).
SELECT * INTO TABLE it_konv_ftr FROM konv
FOR ALL ENTRIES IN it_ekko
WHERE knumv = it_ekko-knumv
AND kwert NE 0
AND kposn GT '000000'.
LOOP AT it_konv_ftr.
gindex = sy-tabix.
READ TABLE it_zmm_porder WITH KEY kschl = it_konv_ftr-kschl BINARY SEARCH.
IF sy-subrc NE 0.
DELETE it_konv_ftr INDEX gindex.
ENDIF.
ENDLOOP.
IF it_konv_ftr[] IS NOT INITIAL.
SORT it_konv_ftr BY knumv kschl.
ENDIF.
SELECT KNUMV KSCHL INTO CORRESPONDING FIELDS OF TABLE IT_KONV1 FROM KONV
FOR ALL ENTRIES IN IT_EKKO
WHERE KNUMV = IT_EKKO-KNUMV
and kherk = 'D'
AND ( KSCHL = 'ZIN1'
OR KSCHL = 'ZIN2'
OR KSCHL = 'ZINS'
OR KSCHL = 'ZPF1'
OR KSCHL = 'ZPF2'
OR KSCHL = 'ZPF3'
OR KSCHL = 'ZPKG'
OR KSCHL = 'ZPKF'
OR KSCHL = 'FRA1'
OR KSCHL = 'FRB1'
OR KSCHL = 'FRC1'
OR KSCHL = 'FRD1'
OR KSCHL = 'FRD2'
OR KSCHL = 'FRD3'
OR KSCHL = 'FRD4'
OR KSCHL = 'FRD5'
*****Added one condition type below ZFBC as on 05.06.2007 :Rajiv as per mail of Sadiq via mathew sir(RTDK906646)
OR KSCHL = 'ZFBC' )
AND KWERT NE 0.
AND ( KRECH = 'B' RTDK906167
OR KRECH = 'A' ).
SELECT knumv kschl INTO CORRESPONDING FIELDS OF TABLE it_konv1 FROM konv
FOR ALL ENTRIES IN it_ekko
WHERE knumv = it_ekko-knumv
AND kwert NE 0.
DELETE ADJACENT DUPLICATES FROM it_konv1 COMPARING knumv kschl.
LOOP AT it_konv1.
gindex = sy-tabix.
READ TABLE it_zmm_porder WITH KEY kschl = it_konv1-kschl BINARY SEARCH.
IF sy-subrc NE 0.
DELETE it_konv1 INDEX gindex.
ENDIF.
ENDLOOP.
IF sy-subrc EQ 0.
SORT it_konv1 BY knumv kschl.
ENDIF.
SELECT * INTO TABLE it_t685t
FROM t685t
FOR ALL ENTRIES IN it_konv
WHERE kschl EQ it_konv-kschl
AND kappl EQ it_konv-kappl
AND spras EQ 'E'.
SELECT * INTO TABLE it_t685t_ftr
FROM t685t
FOR ALL ENTRIES IN it_konv_ftr
WHERE kschl EQ it_konv_ftr-kschl
AND kappl EQ it_konv_ftr-kappl
AND spras EQ 'E'.
it_t685t_ftr-kschl = 'JVCS'.
it_t685t_ftr-vtext = 'IN CST in vat'.
APPEND it_t685t_ftr.
SELECT * INTO TABLE it_zmm_house_bank
FROM zmm_house_bank
WHERE ebeln IN mebeln.
ELSE.
MESSAGE e899(mm) WITH 'Data not found for selection criteria...'.
ENDIF.
ENDFORM. " Load_data
FORM process .
DATA : mctr TYPE i VALUE 1.
DATA : gindex LIKE sy-tabix.
DATA : mline(75) TYPE c.
DATA : mlifn2 LIKE ekpa-lifn2.
DATA : mv_name LIKE lfa1-name1,
madrnr LIKE lfa1-adrnr.
CLEAR itcpo.
itcpo-tdgetotf = 'X'.
CALL FUNCTION 'OPEN_FORM'
EXPORTING
form = 'ZMM_PORDER'
language = sy-langu
OPTIONS = itcpo
dialog = ' '
EXCEPTIONS
OTHERS = 1.
LOOP AT it_ekko.
CALL FUNCTION 'START_FORM'
EXPORTING
form = 'ZMM_PORDER'.
SELECT SINGLE *
FROM t001
INTO it_t001
WHERE bukrs EQ it_ekko-bukrs.
mcompname = it_t001-butxt.
TRANSLATE mcompname TO UPPER CASE.
Document Type
SELECT SINGLE batxt
INTO mtitle
FROM t161t
WHERE bstyp EQ 'F'
AND spras EQ 'E'
AND bsart EQ it_ekko-bsart.
REFRESH it_adrc.
SELECT SINGLE werks
INTO mwerks
FROM ekpo
WHERE ebeln EQ it_ekko-ebeln.
SELECT SINGLE *
INTO it_t001w
FROM t001w
WHERE werks EQ mwerks.
REFRESH it_adrc.
SELECT SINGLE *
INTO it_adrc_plt
FROM adrc
WHERE addrnumber EQ it_t001w-adrnr.
REFRESH : xt052.
mfamt = 0.
msr = 0.
in 500c this statement failed.
SELECT SINGLE * FROM T052 INTO XT052 WHERE ZTERM = IT_EKKO-ZTERM.
CALL FUNCTION 'FI_TEXT_ZTERM'
EXPORTING
I_T052 = XT052
TABLES
T_ZTEXT = ZTEXT.
As per Preeti... Shipment address should be shown on top as purchase order company address. 27.04.
PERFORM writeform USING 'PLANT' 'PLANT'.
SELECT SINGLE name1 adrnr
INTO (mv_name,madrnr)
FROM lfa1
WHERE lifnr EQ it_ekko-lifnr.
REFRESH it_adrc[].
CLEAR it_adrc[].
FREE it_adrc[].
SELECT SINGLE *
INTO it_adrc_ven
FROM adrc
WHERE addrnumber EQ madrnr.
READ TABLE it_lfa1 WITH KEY lifnr = it_ekko-lifnr.
PERFORM writeform USING 'VENDOR' 'VENDOR'.
Shipment
SELECT SINGLE werks
INTO mwerks
FROM ekpo
WHERE ebeln EQ it_ekko-ebeln.
up to 1 rows.
SELECT SINGLE *
INTO it_t001w
FROM t001w
WHERE werks EQ mwerks.
SELECT SINGLE j_1iexcd j_1icstno j_1ilstno
INTO (j_1iexcd,j_1icstno,j_1ilstno)
FROM j_1imocomp
WHERE werks = mwerks.
REFRESH it_adrc.
SELECT SINGLE *
INTO it_adrc
FROM adrc
WHERE addrnumber EQ it_t001w-adrnr.
PERFORM writeform USING 'SHIPMNT' 'SHIPMNT'.
READ TABLE it_eikp WITH KEY exnum = it_ekko-exnum.
IF sy-subrc EQ 0.
READ TABLE it_t618t WITH KEY expvz = it_eikp-expvz.
ENDIF.
your_ref = it_ekko-ihrez.
our_ref = it_ekko-unsez.
READ TABLE it_erev WITH KEY edokn = it_ekko-ebeln.
IF sy-subrc = 0.
no_ammend = it_erev-revno.
request_by = it_erev-crnam.
ver_txt = it_erev-txz01.
READ TABLE it_t16ct WITH KEY rscod = it_erev-rscod.
IF sy-subrc = 0.
ver_reason = it_t16ct-rstxt.
ELSE.
ver_reason = ''.
ENDIF.
ELSE.
no_ammend = ''.
request_by = ''.
ver_txt = ''.
ver_reason = ''.
ENDIF.
PERFORM writeform USING 'PO_INFO' 'PO_INFO'.
IF it_zmm_house_bank[] IS NOT INITIAL.
READ TABLE it_zmm_house_bank INDEX 1.
PERFORM writeform USING 'BANKDTL' 'BANKDTL'.
ENDIF.
PERFORM writeform USING 'HDR_INFO' 'HDR_INFO'.
PERFORM writeform USING 'BRK_TTL' 'MAIN'.
msr = 1.
mlctr = 1.
*added by ganesh to prevent deleted items to appear in print out
LOOP AT IT_EKPO WHERE EBELN EQ IT_EKKO-EBELN.
LOOP AT it_ekpo WHERE ebeln EQ it_ekko-ebeln AND loekz NE 'L'.
*end of change
CLEAR: mrate, mrate1.
SELECT * FROM konv INTO TABLE it_konv_rate
WHERE knumv EQ it_ekko-knumv
AND kposn EQ it_ekpo-ebelp
AND ( kschl EQ 'PBXX' OR kschl EQ 'PB00' OR kschl EQ 'P001' ).
LOOP AT it_konv_rate.
IF it_konv_rate-kpein > 0. " added by ganesh as per sudhir 12.10.2007
mrate_gm = it_konv_rate-kbetr / it_konv_rate-kpein.
mrate = mrate + mrate_gm. " added by ganesh as per sudhir 12.10.2007
ELSE.
mrate = mrate + it_konv_rate-kbetr.
ENDIF.
IF it_konv_rate-waers IS NOT INITIAL.
mwaers = it_konv_rate-waers.
ENDIF.
ENDLOOP.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
mrate = mrate * 100.
ENDIF.
End for japanies Yen
mrate1 = mrate.
End rate
mfirst = 0.
MFAMT = MFAMT + ( IT_EKPO-NETPR * IT_EKPO-MENGE ).
mfamt = mfamt + ( mrate * it_ekpo-menge ).
PERFORM get_mat_long_text.
DATA: lt_ctr TYPE i VALUE 0,lt_ctr1 TYPE i, lt_count TYPE i VALUE 0. " Long text counter
DESCRIBE TABLE it_bapi_mltx_ga LINES lt_count.
CLEAR it_bapi_mltx_ga.
*Added by Rajiv 10.05.2007 Read and if condition RTDK906165
READ TABLE it_konv WITH KEY knumv = it_ekko-knumv
kposn = it_ekpo-ebelp.
mkbetr = 0.
mkwert = 0.
IF sy-subrc EQ 0.
LOOP AT it_konv WHERE knumv EQ it_ekko-knumv
AND kposn EQ it_ekpo-ebelp.
IF it_konv-krech EQ 'A'.
mkbetr = it_konv-kbetr / 10.
ELSE.
mkbetr = it_konv-kbetr.
ENDIF.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
mkbetr = mkbetr * 100.
ENDIF.
End for japaies Yen
IF mkbetr LT '0'.
mkbetr = mkbetr * ( -1 ).
ENDIF.
mkwert = it_konv-kwert.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
mkwert = mkwert * 100.
ENDIF.
End for japaies Yen
mfamt = mfamt + mkwert.
IF mkwert LT '0'.
mkwert = mkwert * ( -1 ).
ENDIF.
IF it_ekpo-matnr IS INITIAL.
itemname = it_ekpo-txz01.
ELSE.
READ TABLE it_makt WITH KEY matnr = it_ekpo-matnr.
itemname = it_makt-maktx.
ENDIF.
READ TABLE it_t685t WITH KEY kschl = it_konv-kschl BINARY SEARCH.
READ TABLE it_eket WITH KEY ebeln = it_ekpo-ebeln
ebelp = it_ekpo-ebelp BINARY SEARCH.
IF mfirst EQ 0.
PERFORM writeform USING 'BRK_INFO' 'MAIN'.
mfirst = 1.
ELSE.
ADD 1 TO lt_ctr.
CLEAR it_bapi_mltx_ga.
READ TABLE it_bapi_mltx_ga INDEX lt_ctr. "For long text
IF sy-subrc NE 0.
CLEAR it_bapi_mltx_ga.
ENDIF.
PERFORM writeform USING 'BRK_INFO1' 'MAIN'.
ENDIF.
mlctr = mlctr + 1.
ENDLOOP. " it_konv.
ELSE.
IF it_ekpo-matnr IS INITIAL.
itemname = it_ekpo-txz01.
ELSE.
READ TABLE it_makt WITH KEY matnr = it_ekpo-matnr.
itemname = it_makt-maktx.
ENDIF.
READ TABLE IT_T685T WITH KEY KSCHL = IT_KONV-KSCHL BINARY SEARCH.
READ TABLE it_eket WITH KEY ebeln = it_ekpo-ebeln
ebelp = it_ekpo-ebelp BINARY SEARCH.
mfirst = 0.
IF mfirst EQ 0.
PERFORM writeform USING 'BRK_INFO' 'MAIN'.
mfirst = 1.
ELSE.
ADD 1 TO lt_ctr.
CLEAR it_bapi_mltx_ga.
READ TABLE it_bapi_mltx_ga INDEX lt_ctr. "For long text
IF sy-subrc NE 0.CLEAR it_bapi_mltx_ga.ENDIF.
PERFORM writeform USING 'BRK_INFO1' 'MAIN'.
ENDIF.
ENDIF.
*Commented by rajiv 10.05.2007 used this code in above condition.
added by ganesh on 260407 to print record
if it_konv is initial.
READ TABLE IT_MAKT WITH KEY MATNR = IT_EKPO-MATNR.
READ TABLE IT_T685T WITH KEY KSCHL = IT_KONV-KSCHL BINARY SEARCH.
READ TABLE IT_EKET WITH KEY EBELN = IT_EKPO-EBELN
EBELP = IT_EKPO-EBELP BINARY SEARCH.
mFirst = 0.
if mFirst eq 0.
PERFORM WRITEFORM USING 'BRK_INFO' 'MAIN'.
mFirst = 1.
else.
add 1 to lt_ctr.
clear it_bapi_mltx_ga.
read table IT_BAPI_MLTX_GA index lt_ctr. "For long text
if sy-subrc ne 0.clear it_bapi_mltx_ga.endif.
PERFORM WRITEFORM USING 'BRK_INFO1' 'MAIN'.
Endif.
endif.
end of change
REFRESH it_komv_tax.
PERFORM get_tax_cal USING it_ekpo-ebeln
it_ekpo-ebelp.
Changing it_komv_tax.
REFRESH : it_zmm_porder.
CLEAR : it_zmm_porder.
SELECT * INTO TABLE it_zmm_porder
FROM zmm_porder
WHERE flag EQ 'T'.
IF sy-subrc EQ 0.
SORT it_zmm_porder BY kschl.
ENDIF.
LOOP AT it_komv_tax.
gindex = sy-tabix.
READ TABLE it_zmm_porder WITH KEY kschl = it_komv_tax-kschl BINARY SEARCH.
IF sy-subrc NE 0.
DELETE it_komv_tax INDEX gindex.
ENDIF.
ENDLOOP.
LOOP AT it_komv_tax WHERE kwert IS NOT INITIAL.
IF ( IT_KOMV_TAX-KSCHL EQ 'JMOP' OR
IT_KOMV_TAX-KSCHL EQ 'JECS' OR
IT_KOMV_TAX-KSCHL EQ 'JSEP' OR
IT_KOMV_TAX-KSCHL EQ 'JMOQ' OR
IT_KOMV_TAX-KSCHL EQ 'JVCS' OR
IT_KOMV_TAX-KSCHL EQ 'JVRD' OR
IT_KOMV_TAX-KSCHL EQ 'JMIP' OR
* IT_KOMV_TAX-KSCHL EQ 'JEIP' OR
IT_KOMV_TAX-KSCHL EQ 'JSEI' OR
IT_KOMV_TAX-KSCHL EQ 'JSRT' OR
IT_KOMV_TAX-KSCHL EQ 'JEC3' OR
IT_KOMV_TAX-KSCHL EQ 'JVRN' )
AND IT_KOMV_TAX-KWERT IS NOT INITIAL.
SELECT SINGLE vtext
INTO mtext
FROM t685t
WHERE kschl EQ it_komv_tax-kschl
AND spras EQ 'E'.
l_rate = it_komv_tax-kbetr / 10.
l_amt = it_komv_tax-kwert.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
l_amt = l_amt * 100.
ENDIF.
End for japaies Yen
ADD l_amt TO mfamt.
IF lt_ctr LT lt_count. "Long text
ADD 1 TO lt_ctr.
READ TABLE it_bapi_mltx_ga INDEX lt_ctr.
ELSE.
CLEAR it_bapi_mltx_ga.
ENDIF.
IF l_rate EQ 0 OR l_amt EQ 0.
l_rate = ''.
l_amt = ''.
ENDIF.
PERFORM writeform USING 'TAX_LINE_ITEM' 'MAIN'.
ENDIF.
ENDLOOP.
IF lt_ctr LT lt_count.
DATA mbal_line TYPE i.
mbal_line = ( lt_count - lt_ctr ).
DO mbal_line TIMES.
ADD 1 TO lt_ctr.
READ TABLE it_bapi_mltx_ga INDEX lt_ctr.
IF sy-subrc = 0.
PERFORM writeform USING 'LTEXT' 'MAIN'.
ENDIF.
ENDDO.
ENDIF.
CONCATENATE it_ekko-ebeln it_ekpo-ebelp INTO nmebeln.
REFRESH tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F04'
language = sy-langu
name = nmebeln
object = 'EKPO'
TABLES
lines = tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
LOOP AT tline.
IF tline-tdline IS NOT INITIAL.
del_text = tline-tdline.
ENDIF.
CONDENSE del_text.
ENDLOOP.
CONCATENATE it_ekko-ebeln it_ekpo-ebelp INTO nmebeln.
REFRESH tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F03'
language = sy-langu
name = nmebeln
object = 'EKPO'
TABLES
lines = tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 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.
ENDIF.
refresh.
CLEAR : po_flag, mat_po_text.
LOOP AT tline.
IF tline-tdline IS NOT INITIAL.
MOVE tline-tdline TO mat_po_text.
CONDENSE mat_po_text.
PERFORM writeform USING 'MTRL_PO_TEXT' 'MAIN'.
po_flag = 'X'.
CLEAR : mat_po_text.
ENDIF.
ENDLOOP.
*Added lines below for Schedule delivery for line item on 09.05.2007:Rajiv
CLEAR g_ind.
READ TABLE it_eket WITH KEY ebeln = it_ekpo-ebeln
ebelp = it_ekpo-ebelp BINARY SEARCH.
g_ind = sy-tabix.
LOOP AT it_eket FROM g_ind.
IF it_eket-ebeln EQ it_ekpo-ebeln AND it_eket-ebelp = it_ekpo-ebelp.
PERFORM writeform USING 'SCHEDULE' 'MAIN'.
ELSE.
EXIT.
ENDIF.
ENDLOOP.
*End Addition:Rajiv
PERFORM writeform USING 'REQSLP' 'MAIN'.
mlctr = mlctr + 1.
msr = msr + 1.
CLEAR: lt_ctr, lt_ctr1.
following lines added by ganesh to add service po details as per Mr. sadiq 21.08.2007
IF it_ekpo-packno IS NOT INITIAL.
CLEAR sub_packno.
SELECT SINGLE sub_packno INTO sub_packno FROM esll WHERE packno = it_ekpo-packno.
IF sub_packno IS NOT INITIAL.
CLEAR it_esll.
REFRESH it_esll.
SELECT * FROM esll INTO CORRESPONDING FIELDS OF TABLE it_esll
WHERE packno = sub_packno.
IF sy-subrc = 0.
PERFORM writeform USING 'SERVICE_PO_TEXT' 'MAIN'.
ENDIF.
LOOP AT it_esll.
CONCATENATE sub_packno it_esll-introw INTO obj.
CALL FUNCTION 'READ_TEXT' "4500002446 C300
EXPORTING
id = 'LTXT'
language = sy-langu
name = obj
object = 'ESLL'
TABLES
lines = tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
CLEAR stext.
LOOP AT tline.
CONCATENATE stext tline-tdline INTO stext SEPARATED BY space.
ENDLOOP.
FREE tline.
CLEAR tline.
REFRESH tline.
PERFORM writeform USING 'SERVICE_PO' 'MAIN'.
PERFORM writeform USING 'SERVICE_TEXT' 'MAIN'.
ENDLOOP.
ENDIF.
ENDIF.
end of change
ENDLOOP. " it_ekpo.
IF mlctr < 15.
DO 5 TIMES.
PERFORM writeform USING 'LINEFEED' 'MAIN'.
ENDDO.
ENDIF.
added by ganesh for allding line before ECC No.
IF it_ekko-bsart NE 'ZIM'. " IF EXPORT NO NEED TO PRINT ECC.
PERFORM writeform USING 'LIN' 'MAIN'.
PERFORM writeform USING 'WERKS_TAX_DETAIL' 'MAIN'.
ENDIF.
end of change
MFLAG = 'Y'.
PERFORM writeform USING 'TERMS_VAL' 'MAIN'.
LOOP AT it_konv1 WHERE knumv EQ it_ekko-knumv.
mkschl = it_konv1-kschl.
mchgamt = 0.
LOOP AT it_konv_ftr WHERE knumv EQ it_konv1-knumv
AND kschl EQ mkschl.
mchgamt = mchgamt + it_konv_ftr-kwert.
ENDLOOP.
For Japanies Yen "RTDK906759
IF it_ekko-waers = 'JPY'.
mchgamt = mchgamt * 100.
ENDIF.
End for japaies Yen
mfamt = mfamt + mchgamt.
IF mchgamt LT '0'.
mchgamt = mchgamt * ( -1 ).
ENDIF.
READ TABLE it_t685t_ftr WITH KEY kschl = mkschl.
PERFORM writeform USING 'TERMS_FTR_VAL' 'MAIN'.
mlctr = mlctr + 1.
ENDLOOP.
mflag = 'T'.
CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
EXPORTING
amt_in_num = mfamt
IMPORTING
amt_in_words = mfword
EXCEPTIONS
data_type_mismatch = 1
OTHERS = 2.
CONDENSE mebeln.
nmebeln = it_ekko-ebeln.
REFRESH tline.
CALL FUNCTION 'READ_TEXT'
EXPORTING
id = 'F01'
language = sy-langu
name = nmebeln
object = 'EKKO'
TABLES
lines = tline
EXCEPTIONS
id = 1
language = 2
name = 3
not_found = 4
object = 5
reference_check = 6
wrong_access_to_archive = 7
OTHERS = 8.
IF sy-subrc <> 0.
ENDIF.
*---- CHANGED BY MATHEW BECAUSE THIS STATMENT WORKING FINE IN 300 BUT NOT IN 500C.
LOOP AT ZTEXT.
IF ZTEXT-TEXT1 IS NOT INITIAL.
PERFORM WRITEFORM USING 'TERMS_COND_VAL_PAY' 'MAIN'.
ENDIF.
MPAY_FLAG = 'Y'.
ENDLOOP.
READ TABLE it_t052u WITH KEY zterm = it_ekko-zterm.
LOOP AT it_t052u WHERE zterm EQ it_ekko-zterm.
IF it_t052u-text1 IS NOT INITIAL.
PERFORM writeform USING 'TERMS_COND_VAL_PAY' 'MAIN'.
ENDIF.
mpay_flag = 'Y'.
ENDLOOP.
PERFORM writeform USING 'TERMS_COND_VAL' 'MAIN'.
LOOP AT tline.
IF tline-tdline IS NOT INITIAL.
PERFORM writeform USING 'TERMS_COND_VAL_HDR' 'MAIN'.
ENDIF.
CONDENSE txt.
ENDLOOP.
PERFORM writeform USING 'FTR' 'FTR_LIN3'.
PERFORM writeform USING 'FTR_LIN1' 'FTR_LIN1'.
CALL FUNCTION 'END_FORM'.
ENDLOOP. " It_ekko.
CALL FUNCTION 'CLOSE_FORM'
IMPORTING
RESULT = itcpp
RDI_RESULT =
TABLES
otfdata = otf
EXCEPTIONS
unopened = 1
bad_pageformat_for_print = 2
send_error = 3
spool_error = 4
codepage = 5
OTHERS = 6.
IF sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
ENDFORM. " Process
*& Form WRITEFORM
text
-->P_0150 text
-->P_0151 text
FORM writeform USING value(p_0150)
value(p_0151).
CALL FUNCTION 'WRITE_FORM'Hi
I think some basis related configuartions to be done
Try like this and inform me
A cyclic job runs, which processes the messages seen in the SOST queue.
Are you sure it's not the frequency of the cyclic job, rather than the
number of messages in the queue, that you are observing? In messages
that are queued and before the cyclic job runs, "wait for comm. service"
is the normal status.
If you mean that there are always 4 items queued in SOST regardless of
the cyclic send job, then I have no ideas. I would have thought there
was no way to do that.
when the send job runs it just never
picks them up & sends them, while it picks up many others. The send job
is somehow blind to these; no error message occurs. In this case, I
'delete' them from the queue (in SOST) and then 'undelete' (drop down
menu -> /Go to /Deleted Items) them and then re-queue them. THEN they
actually get picked up & sent when the next cyclic send job executes.
Regards
Pavan -
How to send ALV output data into Excel sheet format via Mail to the user?
Hi friends,
I have a doubt ie,
How to send ALV output data into Excel sheet format via Mail to the user?
regards
MoosaHi,
Provide the output internal table to the objbin in the below FM
Send Message
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = i_docdata
put_in_outbox = c_x
TABLES
packing_list = i_objpack
object_header = i_objhead
contents_bin = i_objbin
contents_txt = i_objtxt
receivers = i_reclist
and specify the document type
i_objpack-doc_type = 'XLS'.
and try.
Regards,
Nandha -
How To Send ALV Output By Email.
Hi !
I wanted to ask how to send ALV output of report by email.
I know that i have to use the fms :
1. 'WWW_HTML_FROM_LISTOBJECT' - in order to convert the table to HTML.
2. 'SO_NEW_DOCUMENT_ATT_SEND_API1' - in order to send the HTML file.
My problem is how to convert the ALV screen output to the apropriate table parameter of the function 'WWW_HTML_FROM_LISTOBJECT' to listobject type ?
thanks
mosheHi look at the following program.
*& Report ZSM17_EMAIL1
REPORT zsm17_email.
tables : mara.
data: begin of it_mara occurs 0,
matnr like mara-matnr,
ernam like mara-ernam,
mtart like mara-mtart,
matkl like mara-matkl,
end of it_mara.
data: begin of it_final occurs 0,
v_string(255),
end of it_final.
*DATA: objpack LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE,
objhead LIKE solisti1 OCCURS 1 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 10 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 10 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 5 WITH HEADER LINE.
DATA: objpack LIKE sopcklsti1 OCCURS 0 with header line,
objhead LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objbin LIKE solisti1 OCCURS 0 WITH HEADER LINE,
objtxt LIKE solisti1 OCCURS 0 WITH HEADER LINE,
reclist LIKE somlreci1 OCCURS 0 WITH HEADER LINE.
data: wa_objbin like line of objbin.
DATA: doc_chng LIKE sodocchgi1.
DATA: tab_lines LIKE sy-tabix.
select-options s_matnr for mara-matnr.
*--- Selecting data from mara
select matnr
ernam
mtart
matkl
into table it_mara
from mara
where matnr in s_matnr.
if sy-subrc ne 0.
write:/ 'no data found'.
exit.
else.
loop at it_mara.
concatenate it_mara-matnr
it_mara-ernam
it_mara-mtart
it_mara-matkl
into it_final-v_string separated by '~'.
append it_final.
clear it_final.
endloop.
endif.
Creating the document to be sent
doc_chng-obj_name = 'TEST'. "name of the document
title of document or subject
doc_chng-obj_descr = 'Test Email program'.
body of the mail
objtxt = 'A test report'.
APPEND objtxt.
objtxt = 'is enclosed as an attachment.'.
APPEND objtxt.
*clear objtxt.
DESCRIBE TABLE objtxt LINES tab_lines.
Size of SAPoffice Document (for API1)
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + STRLEN( objtxt ).
Creating the entry for the compressed attachment
objpack-transf_bin = 'X'.
objpack-head_start = 1.
objpack-head_num = 0.
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'.
*objpack-obj_name = 'ATTACHMENT'.
*objpack-obj_descr = 'Test Email Program'.
*objpack-doc_size = tab_lines * 255.
APPEND objpack..
*--- Populating the records in the attachment
data: w_str(255) TYPE c.
loop at it_final into wa_objbin.
append wa_objbin to objbin.
append objbin.
clear wa_objbin.
endloop.
DESCRIBE TABLE objbin LINES tab_lines.
tab_lines = tab_lines + 1.
objhead = 'test_report.txt'.
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 = 'txt'.
objpack-obj_name = 'txt'.
objpack-obj_descr = 'Test Email Program'.
objpack-doc_size = tab_lines * 255.
APPEND objpack..
*write:/ 'object text', objtxt.
Entering names in the distribution list
reclist-receiver = '[email protected]'.
reclist-rec_type = 'U'.
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.
loop at objbin.
write: objbin-line.
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. -
How to send a mail in pdf format file in sbwp??
how to send a mail in pdf format file in sbwp?? and how to read the content of the mail?
Refer the following link for Sample Program:
http://www.sapdevelopment.co.uk/reporting/rep_spooltopdf.htm -
my phone has been changed under warranty by the apple store in germany.
ı need a change document to register the phone in my country again.
ımeı numbers of old and new must be in the document.you can send an mail in pdf format
as soon as possible please.
your's respectfully.
new phone serial no:DQ******TC0
old phone serial no:DN*******T9Y
Product:
iPhone 4S
Serial Number:
DN*******T9Y
Service Requested:
December 3, 2012
Status:
Repair Complete
<Edited by Host>No we cannot send it to you because we are users just like you and Apple does not monitor these forums.
But you can find the IMEI numbers yourself. Read the ENTIRE article:
http://support.apple.com/kb/HT4061 -
How to configure a standard SmartForm to be sent by e-mail in PDF format
How to configure a standard SmartForm to be sent by e-mail in PDF format
We need to use standard SAP configuration to send e-mails (output type Medium = 5 External Send).
Currently we were able to send the forms on OTF format, not PDF.
Does anyone know how to automatically make the conversion from OTC to PDF without having to code anything on ABAP?Hello Luiz,
actually there are only a few steps to do:
Just call transaction SCOT and doubleclick your SMTP node. Click on the "set"-Button behind the supported address type "internet". Choose "PDF" as output format for SAPforms.
By the way. You can also generate a PDF-File from a Spool with report RSTXPDFT4.
I hope this will help you.
Bye
Frank -
How to get the output of the report in pdf format
how to get the output of the report in pdf format?
Thanks in advance,
madan.Refer these links
http://www.sap-img.com/bc037.htm
http://www.members.tripod.com/abap4/Save_Report_Output_to_a_PDF_File.html
CONVERT_ABAPSPOOLJOB_2_PDF FM convert abap spool output to PDF -
Output of a report in PDF Format
Hi all,
I need to get the Output of a report in PDF format.
Please suggest me hwo to do this requirement.
If having please give me the sample code
Thanks and Regards
Ajaysample code for PDF conversion...
tables : vbrk. "Billing Document: Header Data
Type pool declaration
type-pools slis.
Selection screen
selection-screen begin of block b1 with frame.
select-options : p_date for vbrk-aedat.
selection-screen end of block b1.
Types declaration
types : begin of t_vbrk,
vbeln type vbrk-vbeln, "Billing Document
aedat type vbrk-aedat, "Changed on(date)
fksto type vbrk-fksto, "Billing document is cancelled
end of t_vbrk.
Internal table declaration
data : i_vbrk type table of t_vbrk,
w_vbrk type t_vbrk.
Field catalog declaration
data : i_cat type slis_t_fieldcat_alv,
w_cat like line of i_cat,
t_print type slis_print_alv.
data :top type table of slis_listheader with header line.
data : event type table of slis_alv_event with header line.
start of selection
top-of-page.
start-of-selection.
perform get_dat.
if sy-subrc = 0.
perform build_cat.
perform alv_print_info.
perform sub_create_spool_id.
perform display_data.
perform sub_send_mail.
endif.
Subroutine GET_DAT
form get_dat .
*---To fetch canelled billing documents.
select vbeln
aedat
fksto
from vbrk
into table i_vbrk
where aedat in p_date and fksto = 'X'.
endform. " GET_DAT
Subroutine DISPLAY_DATA
form display_data .
call function 'REUSE_ALV_EVENTS_GET'
importing
et_events = event[]
top-typ = 'H'.
top-info = sy-title.
append top.
call function 'REUSE_ALV_GRID_DISPLAY'
exporting
i_callback_program = sy-repid
i_callback_top_of_page = 'NAN'
i_grid_title = 'Alok Arun (Mr.A)'
it_fieldcat = i_cat
it_events = event[]
is_print = t_print
tables
t_outtab = i_vbrk
endform. " DISPLAY_DATA
*& Subroutine BUILD_CAT
form build_cat .
w_cat-seltext_l = 'Billing Document'.
w_cat-col_pos = '1'.
w_cat-tabname = 'I_VBRK'.
w_cat-fieldname = 'VBELN'.
w_cat-ref_fieldname = 'VBELN'.
w_cat-hotspot = 'X'.
append w_cat to i_cat.
clear w_cat.
w_cat-seltext_l = 'Cancelled on'.
w_cat-col_pos = '2'.
w_cat-tabname = 'I_VBRK'.
w_cat-fieldname = 'AEDAT'.
w_cat-ref_fieldname = 'AEDAT'.
w_cat-hotspot = 'X'.
append w_cat to i_cat.
clear w_cat.
endform. " BUILD_CAT
*& Form alv_print_info
form alv_print_info .
t_print-no_print_selinfos = 'X'.
t_print-no_coverpage = 'X'.
t_print-no_print_listinfos = 'X'.
endform. " alv_print_info
*& Form sub_create_spool_id
form sub_create_spool_id .
data: lv_text(50) type c.
lv_text = sy-title.
new-page line-size sy-linsz
print on destination 'LP01'
cover text lv_text
list name 'LIST NAME SOL MANAGER'(002)
list dataset 'LIST DATASET'(003)
immediately ' '
keep in spool 'X'
new list identification 'X'
no dialog.
endform. " sub_create_spool_id
*& Form sub_send_mail
form sub_send_mail .
data: v_spono like tsp01-rqident.
v_spono = sy-spono.
data:
v_type like soodk-objtp,
i_pdflist like tline occurs 0,
t_print TYPE slis_print_alv,
jobname like tbtcjob-jobname,
jobcount like tbtcjob-jobcount,
numbytes type i,
pdfspoolid like tsp01-rqident,
jobname2 like tbtcjob-jobname,
jobcount2 like tbtcjob-jobcount,
i_compresslist like soli occurs 0.
data: pdf like tline occurs 100 with header line,
objbin like solisti1 occurs 10 with header line.
*--convert into PDF
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = v_spono
no_dialog = ' '
importing
pdf_bytecount = numbytes
pdf_spoolid = pdfspoolid
btc_jobname = jobname2
btc_jobcount = jobcount2
tables
pdf = pdf
exceptions
err_no_abap_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_destdevice = 5
user_cancelled = 6
err_spoolerror = 7
err_temseerror = 8
err_btcjob_open_failed = 9
err_btcjob_submit_failed = 10
err_btcjob_close_failed = 11.
if sy-subrc <> 0.
endif.
*-- change the width of the pdf table --
call function 'SX_TABLE_LINE_WIDTH_CHANGE'
exporting
line_width_src = 134
line_width_dst = 255
tables
content_in = pdf
content_out = objbin
exceptions
err_line_width_src_too_long = 1
err_line_width_dst_too_long = 2
err_conv_failed = 3
others = 4.
if sy-subrc <> 0.
endif.
endform. -
Need to sent alv output as html or as pdf attachment in mail
+Hello
I want to send an ALV output as attachement in html or as pdf format. how to do that? line size is greater than 600(nearly 40 fields).
+please help me in this query.
Regards
Guruvayurappan
Moderator Message: Please search before posting your question. Thread locked.
Edited by: Suhas Saha on Dec 29, 2011 4:57 PMHi,
For sending the ALV output as PDF attachment, you can create a spool (proper page size in print parameters) and convert the spool to PDF using the FM CONVERT_ABAPSPOOLJOB_2_PDF and then send the same as attachment in mail.
For send the data as HTML attachment, try the below FMs
WWW_ITAB_TO_HTML_HEADERS & WWW_ITAB_TO_HTML_LAYOUT to create the HTML layout
WWW_ITAB_TO_HTML to create the HTML for the actual data.
Hope this helps you.
Regards,
Sachinkumar Mehta -
ALV: Send ALV output as mail - background processing
Hi all,
I'm a newbie in SDC and try to implement the following functionality (Version 4.0B):
A ABAP report (to be scheduled as e.g. a daily job run) with ALV output should send an automated email containing the ALV informations to a receiver specified in the selection criterias.
I already have the following pieces:
1) The report with ALV output (running online and clicking on List/send/office works perfectly, the alv-output is attached to the mail). The report runs also in background and generates a spool.
2) A subroutine wich sends a email (input has to be in an itab)
Now I try to put them together.
Question: How can I automate the send process?
I did a little bit of debugging, but got lost in the SAP Office functions.
Any help appreciated!
ThomasHi Michael,
thank you again a helpfull reply. To solve the issue I ended up writing a second little report.
Here is a short description of my solution just in case anybody else is also interested in.
I set up a Job with two steps.
Step 1 is the ABAP that creates e.g. a ALV output (anything that goes to spool).
Step 2 is a little ABAP that does nothing else than reading the output of step 1 (Spool) and send it as SAP Office Document. (To be a little more flexible I added some selection criterias for step 2 like Jobstep number, receiver, sendmode, ...).
It works fine online (by keying in the spool number manually) and in batch mode (by determining the spool number based on the job number). I think this solution is flexible and lightwight.
Kind regards,
Thomas
Message was edited by: Thomas Hager
Message was edited by: Thomas Hager
Maybe you are looking for
-
Mid button won't open a new tab when clicked on url
Normally when i click mid button on a url, it open in a new tab However recently (possibly after an update), it won't work at all Mid button scrolling is fine so its not mouse related problem (it also works in chrome and ie, just not fx) checked thos
-
Javax.ejb.EJBException while opening the IR Objects in PI7.1.1
Hi All In our projects we are movig XI3.0 objects to PI7.1, for that we have done the Export of IR objects from XI3.0 & Import it in PI7.1. All the objectys are imported successfully in the IR of PI7.1. But when we are trying to open the objects & do
-
Can u tell me the better way of understanding and analyzing the functional specification
-
Hi there. I hope someone can help me out here. I have created a report that has a User Parameter that accepts ID's in a string seperated by commas. Now depending on what ID's the user sends, the data is going to be different. ALso the amount of delim
-
InDesign CC User Interface Preferences not sticking
You're not my father, you killed my father! I'll never join you! Help I don't want to join the DARK side. InDesign won't remember my user interface preferences. I switch to light, close the app, and it goes back to dark (medium dark) next time I open