Send report output(alv display) as email to end user
I have developed a report the output of which has to be sent to the end user if he enters his email id in selection screen. The out put is in alv form. Pls can anyone tell me how to send this displayed output as an email attachment using function module SO_NEW_DOCUMENT_ATT_SEND_API1 . I am wondering How this displayed output can be passed as a parameter to this function module.
Thanks Sham..
I am able to send HTML email following above link.
The problem i am facing is,When i am deploying the code through crxde.Code is working fine.
But using maven deploy..Bundle get activated ..But at line:
messageGateway = this.messageGatewayService.getGateway(HtmlEmail.class);
,it gives null Pointer exception.
Any pointer,why its not working from maven deployment.
Regards
Deepika
Similar Messages
-
How to send smartform output in body of email?
Hi all ,
I have to send smartform output in body of email (not as an attachement in mail) .PLease help me in this regard.
Thanks,
Ananth S.Hi Ananth
See these threads.
[https://forums.sdn.sap.com/click.jspa?searchID=23497094&messageID=6889194]
[https://forums.sdn.sap.com/click.jspa?searchID=23497094&messageID=6861330]
[https://forums.sdn.sap.com/click.jspa?searchID=23497094&messageID=6855364]
Regards
Hareesh Menon -
Very urjent how to send report output in mail
hi experts,
how to send report output in mail which function module should i use wht parameters should i pass.
thanks in addavnce,
points to be awarded.CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = '026c'
copies = count
list_name = 'VATS_ASBUILT'
list_text = v_list
immediately = 'X'
release = 'X'
new_list_id = 'X'
expiration = days
line_size = 132
line_count = 65
layout = 'X_65_132'
* sap_cover_page = 'X'
* cover_page = 'X'
receiver = 'SAP*'
department = 'VATS'
no_dialog = 'X'
IMPORTING
out_parameters = params
valid = valid.
SUBMIT zppr_vats_asbuilt WITH p_aufnr EQ v_aufnr
TO SAP-SPOOL WITHOUT SPOOL DYNPRO
SPOOL PARAMETERS params
AND RETURN.
SELECT SINGLE rqident FROM tsp01 INTO l_spoolno
WHERE rqtitle = v_list .
* convert report to PDF format
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
src_spoolid = l_spoolno
no_dialog = 'X'
TABLES
pdf = l_ipdf
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.
EXIT .
ENDIF.
Now comes the part to send the mail
try.
* -------- create persistent send request ------------------------
send_request = cl_bcs=>create_persistent( ).
clear document.
* -------- create and set document with attachment ---------------
* create document from internal table with text
document = cl_document_bcs=>create_document(
i_type = 'RAW'
i_text = text
i_length = '12'
i_subject = '' ).
*changing the content of the attachment
binary_content[] = l_iobjbin[].
*change the name of the PDF attachment
concatenate 'Build ID' s_buildid_i 'Rev' v_buildid_rev
into i_att_sub separated by space.
* add attachment to document
call method document->add_attachment
exporting
i_attachment_type = 'PDF'
i_attachment_subject = i_att_sub
i_att_content_hex = binary_content.
*setting the option to send an e-mail more than 50 characters
call method send_request->set_message_subject
exporting
ip_subject = t_sub.
* add document to send request
call method send_request->set_document
exporting
i_document = document.
* --------- set sender -------------------------------------------
* note: this is necessary only if you want to set the sender
* different from actual user (SY-UNAME). Otherwise sender is
* set automatically with actual user.
sender = cl_sapuser_bcs=>create( 'VATSUPPORT' ).
call method send_request->set_sender
exporting
i_sender = sender.
*Send the list based on receivers list obtained
loop at l_ireclist.
AD_SMTPADR = l_ireclist-receiver.
* --------- add recipient (e-mail address) -----------------------
* create recipient - please replace e-mail address !!!
recipient = cl_cam_address_bcs=>create_internet_address(
AD_SMTPADR ).
* add recipient with its respective attributes to send request
call method send_request->add_recipient
exporting
i_recipient = recipient
i_express = 'X'.
ENDLOOP.
call method send_request->set_status_attributes
exporting
i_requested_status = 'E'
i_status_mail = 'E'.
* To send the mail immediately
call method send_request->set_send_immediately( 'X' ).
* ---------- send document ---------------------------------------
call method send_request->send( ).
commit work. -
How to send HTML email to End User using OOTB email processs?
Hi,
We are using OOTB Send email process to send email to end user.
Templates has been created inside /etc/workflow/ProjectName/email folder.
Its working properly for plain text email.but for html template ,It send the email with html tags.
Any pointer on how to write html template for OOTB email process and activate email type as html ?
Thanks
DeepikaThanks Sham..
I am able to send HTML email following above link.
The problem i am facing is,When i am deploying the code through crxde.Code is working fine.
But using maven deploy..Bundle get activated ..But at line:
messageGateway = this.messageGatewayService.getGateway(HtmlEmail.class);
,it gives null Pointer exception.
Any pointer,why its not working from maven deployment.
Regards
Deepika -
Email sending: "sending report output directly to the body of the email"
Hi
I got one requirement.this is the enhancement to already exisitng report.when user clicks on send email check box,report has to be display and this report output has to be send to email of the particular vendor. it has be seen directly in the body of the mail.not as attachement.Report output is in ALV format.Data is stored in internal table t_data.can anyone suggest what is the procedure for this.Hi i have tried the same thing and it works very fine,
i will share my code, you just follow exactly, hopefully you can solve the issue..
you refer clearly the body of the mail,
it should solve your issue/
FORM send_email .
DATA lt_message TYPE bcsy_text.
DATA lv_mail_title TYPE so_obj_des.
DATA document TYPE REF TO cl_document_bcs.
DATA recipient TYPE REF TO if_recipient_bcs.
DATA send_request TYPE REF TO cl_bcs.
DATA sent_to_all TYPE os_boolean.
DATA bcs_execption TYPE REF TO cx_bcs.
DATA wf_string(200) TYPE c.
* DATA wf_string TYPE string.
DATA doc_execption TYPE REF TO cx_document_bcs.
DATA lv_status(20) TYPE c.
DATA lv_count_email TYPE i.
DATA lv_temp_stepcount TYPE c.
LOOP AT wt_email INTO wa_email.
TRY.
CLEAR send_request.
send_request = cl_bcs=>create_persistent( ).
*Create Title
lv_mail_title = 'Report Title'.
*Create Message(EMAIL Body)
REFRESH lt_message.
APPEND '<p><b>Dear Sir/Madam,</b></p>' TO lt_message.
APPEND '<p>The following report shows the status of </p>' TO lt_message.
APPEND '<br>' TO lt_message.
APPEND '<table border= "1" color = 2>' TO lt_message.
CLEAR wf_string.
CONCATENATE '<th><tr>'
'<td>Vendor </td>'
'<td>Vendor Name</td>'
'<td>Coloun 1</td>'
'<td>Coloum 2</td>'
'</tr></th>' INTO wf_string.
APPEND wf_string TO lt_message.
LOOP AT wt_itbl INTO wa_itbl WHERE vendor = wa_email-vendor. "-> Define your Condition here wt_email( should contains vendor and its respective email id)
CLEAR wf_string.
CONCATENATE '<tr><td>' wa_itbl-vendor '</td>' INTO wf_string.
APPEND wf_string TO lt_message.
CONCATENATE '<td>' wa_itbl-Vendor_name '</td>' INTO wf_string.
APPEND wf_string TO lt_message.
CONCATENATE '<td>' wa_itbl-COL2 '</td></tr>' INTO wf_string.
APPEND wf_string TO lt_message.
CONCATENATE '<td>' wa_itbl-COL3 '</td></tr>' INTO wf_string.
APPEND wf_string TO lt_message.
ENDLOOP.
APPEND '</table>' TO lt_message.
APPEND '<br>' TO lt_message.
APPEND '<p><b>Thank You</b></p>' TO lt_message.
*Create Document
CLEAR document.
TRY.
CALL METHOD cl_document_bcs=>create_from_text
EXPORTING
i_text = lt_message
i_documenttype = 'HTM'
i_subject = lv_mail_title
RECEIVING
result = document.
CATCH cx_document_bcs INTO doc_execption.
ENDTRY.
*Add document to email
send_request->set_document( document ).
*Add recipients to send request
IF wa_email-smtp_addr IS NOT INITIAL.
recipient = cl_cam_address_bcs=>create_internet_address(
i_address_string = wa_email-smtp_addr ).
send_request->add_recipient( i_recipient = recipient ).
ENDIF.
*Send Email
CALL METHOD send_request->send
RECEIVING
result = sent_to_all.
COMMIT WORK.
IF sent_to_all EQ 'X'.
lv_count_email = lv_count_email + 1.
ENDIF.
CATCH cx_bcs INTO bcs_execption.
ENDTRY.
ENDLOOP.
IF sent_to_all = 'X'.
SKIP 2.
FORMAT COLOR COL_GROUP INTENSIFIED ON.
ULINE /(10).
WRITE: / 'Remark : '.
ULINE /(10).
FORMAT RESET.
WRITE: / 'Email Message Sent Succesfully'.
RETURN.
ENDIF.
ENDFORM. -
Re: Sending report output in the body of Email (Not as an attachment)
Hi,
My requirement is to send the report output in body part of the mail itself. I am able to send the mail with the output as an attachment but requirement is it shoud be in the body part not as an attachment..
Thanks,
Anshuman.Hi Anshu,
Can you please let me know is the ERMS configured in your system or you are sending
the mail to the customer using Action Profiles. If you are sending the mail using a smartform
assigned to an Action profile then you can display that report internal table data or etc.. in
the smartform itself so that the output data will be available in the e-mail body itself.
Please let me know the way you are sending the e-mail if the above ones are incorrect.
Thanks
Arun -
Send report output via email as zipped attachment
Is it possible for the report output to be zipped before being attached to an email when running on a windows reports_server? On unix we theoretically have the ability to modify the mail.sh shell script that performs the mail operation for reports.
Hi Richard
This is a Reports 9i solution.
You may create a batch file that runs the report, compresses the file and invokes, say, a Java application that mails the given .zip file.
More "advanced" options would be:
You may create a pluggable destination that captures report output. Next, your code does the compresses the output file and mails it.
A simpler solution would be to run two reports. First, that creates the reports output file. In its AFTER_REPORT trigger, call Java method (thru. Java Importer), that picks up the output file and compresses it. Second, that uses XML distribution feature of Reports 9i and mails the .zip file as a file attachment using appropriate construct.
Regard
Sripathy -
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 report output from SUBMIT statement
Hi,
I need to develop one report whcih can be use to send any report output in mail as attachment in txt of execl format. So i will be using SUBMIT statement to execute the report in my new report and i need to convert the reportout in txt or excel format and need to send as attachment in mail. This new report can be use to execute any report which may have ALV GRid, Normal outout screen. So what could be the best way to develop this kind of report.
Br,
Piyush>
piyush mathur wrote:
> Hi Suhas,
>
> LIST_TO_ASCI will give me data in lines. and its difficult to separate the columns in another internal table for attachment file. As this report is going to use to send any report output so i can not fixed the delimiter. So i am looking some function which can split the data in columns when I am reading from List.
> Br,
> Piyush
No need to seperate nothing additionally, this will come automatically in the attached file. Draft below
DATA list_tab TYPE TABLE OF abaplist.
SUBMIT your_report EXPORTING LIST TO MEMORY
AND RETURN.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = list_tab
EXCEPTIONS
not_found = 1
OTHERS = 2.
DATA string_tab TYPE list_string_table.
"use table type appropriate for attchement
DATA ascii_tab TYPE soli_tab.
CALL FUNCTION 'LIST_TO_ASCI'
TABLES
listasci = ascii_tab
listobject = list_tab.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = 'C:\test.txt'
filetype = 'ASC'
TABLES
data_tab = ascii_tab.
DATA go_email_doc TYPE REF TO cl_document_bcs.
go_email_doc = cl_document_bcs=>create_document(
i_type = 'TXT'
go_email_doc->add_attachment( i_attachment_type = 'TXT'
i_attachment_subject = 'My Attachment'
i_att_content_text = ascii_tab ).
Regards
Marcin -
Report output getting truncated in email attachment
Hello Gurus,
My requirement is to send a report output as an email attachment.
I have done the coding for this but have a small problem. In the attachment the report is getting truncated after certain length.
Can you advise wats the problem ?
Regards,
SuhasHello Guys,
I too was contemplating on those lines. But actually i was calculating the File Size incorrectly.
Changed the code & now it working !!!!!!!
BR,
Suhas -
Code for hr-abap report in alv display
Hi Gurus,
I am new to hr-abap and I want some sample code to display a hr report in an alv.
Thanks,
Raj.This is one such...
REPORT yh_rep_hr_certified_instructor MESSAGE-ID yh_messages NO STANDARD
PAGE
HEADING .
Program : YH_REP_HR_CERTIFIED_INSTRUCTOR *
Description : Certified Instructor Eligibility Criteria *
TABLES *
TABLES :hrp1000 ,hrp1001, pa0000.
TYPE-POOLS *
*Type Pool for ALV display
TYPE-POOLS :slis. " Global types for generic cunning components
INTERNAL TABLES *
*Internal Table to keep Selection Screen field values
DATA : BEGIN OF t_validation OCCURS 0.
INCLUDE STRUCTURE dynpread.
DATA END OF t_validation.
*Internal Table for Business Event Groups
DATA : BEGIN OF t_bgrp OCCURS 0,
objid TYPE hrobjid,
blank(1),
stext TYPE stext,
END OF t_bgrp.
*Internal Table for Business Event Type IDs with text for selected Event
*GROUPS
DATA : BEGIN OF t_btyp OCCURS 0,
objid TYPE hrobjid,
blank(1),
stext TYPE stext,
END OF t_btyp.
*Internal Table for Business Event Type IDs for selected Event Groups
DATA : BEGIN OF t_eventtypelist OCCURS 0,
objid TYPE hrobjid,
END OF t_eventtypelist.
*Internal table to store the business Groups
DATA : BEGIN OF t_group OCCURS 0,
objid LIKE hrp1001-objid,
sobid LIKE hrp1001-sobid,
sclas LIKE hrp1001-sclas,
END OF t_group.
*Internal table to hold the business event group and/or bus. event types
DATA : BEGIN OF t_eventgroup OCCURS 0,
objid LIKE hrp1001-objid,
END OF t_eventgroup.
*Internal Table for FieldCatalog used for ALV Display
DATA: t_fieldcatalog TYPE slis_t_fieldcat_alv WITH HEADER LINE.
*Work Area for Checking Business Event Group Validity
DATA: BEGIN OF wa_bgrp,
objid TYPE hrobjid,
stext TYPE stext,
END OF wa_bgrp.
*Internal table to fetch object id for Qualification
DATA: BEGIN OF t_objid OCCURS 0,
objid TYPE hrp1000-objid,
sobid TYPE hrp1001-sobid,
sobid_copy TYPE hrp1001-objid,
END OF t_objid.
*Internal table to fetch Id of related object
*Fetches Pernr of Certified Instructors
DATA: BEGIN OF t_sobid OCCURS 0,
objid TYPE hrp1000-objid,
sobid TYPE hrp1001-sobid,
adatanr TYPE hrpad31-adatanr,
sobid_copy TYPE hrp1001-objid,
END OF t_sobid.
*Internal table to fetch skill rating
*of the Instructor
DATA: BEGIN OF t_prof OCCURS 0,
adatanr TYPE hrpad31-adatanr,
chara TYPE hrpad31-chara,
END OF t_prof.
*Internal table to fetch grade
*of the Insturctor
DATA: BEGIN OF t_grade OCCURS 0,
pernr TYPE pa0008-pernr,
yysalgr TYPE pa0008-yysalgr,
END OF t_grade.
*Internal table which contains all information about the Person like
*Name Project Project Manager Name Account and Vertical Name
DATA: t_projdetails TYPE zbapi_projdetails OCCURS 0 WITH HEADER LINE.
*Final Internal table which contains all information
*about the Instructors
DATA: BEGIN OF t_final OCCURS 0,
empid TYPE pa0000-pernr,
empname(84) TYPE c,
grade TYPE pa0008-yysalgr,
atndttt(3) TYPE c,
sklrate TYPE hrpad31-chara,
pgmng TYPE pa0001-ename,
accname TYPE hrp1000-stext,
vertname TYPE hrp1000-stext,
END OF t_final.
VARIABLES *
*ALV layout
DATA: gs_layout TYPE slis_layout_alv, "alvtot test
gt_events TYPE slis_t_event,
gt_list_top_of_page TYPE slis_t_listheader,
gs_variant LIKE disvariant, "For Layout
g_save. "For Layout Save
DATA: w_pos TYPE i VALUE 1, " Position of Fields in ALV
w_sort TYPE slis_t_sortinfo_alv, "ITab for Sorting Options
w_flag TYPE i,
w_repid TYPE sy-repid,
w_lineno TYPE sy-tabix.
DATA: l_short TYPE hrp1000-short. "variable to check the heirarchy
SELECTION-SCREEN DESIGN *
SELECTION-SCREEN BEGIN OF BLOCK b1 WITH FRAME TITLE text-001. "NO INTERVALS .
SELECTION-SCREEN BEGIN OF LINE.
SELECTION-SCREEN COMMENT 1(20) text-009 MODIF ID xyz.
PARAMETERS : p_bgrp TYPE hrobjid OBLIGATORY,
p_bgrp1 TYPE stext .
SELECTION-SCREEN END OF LINE.
SELECT-OPTIONS :s_btyp FOR hrp1000-objid OBLIGATORY NO INTERVALS.
SELECTION-SCREEN END OF BLOCK b1.
INITIALIZATION *
INITIALIZATION.
*Assign Program Name into a variable
w_repid = sy-repid.
*Build layout for list display
gs_layout-detail_popup = 'X'.
*To get All Events in TOP-OF-PAGE
perform eventtab_build using gt_events[].
gs_variant-report = w_repid.
g_save = 'A'.
AT SELECTION SELECTION *
AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_bgrp.
PERFORM get_bgrp.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_btyp-low.
IF NOT p_bgrp IS INITIAL .
PERFORM get_btyp USING 'l'.
ELSE .
MESSAGE s999 WITH text-e09.
ENDIF.
AT SELECTION-SCREEN ON VALUE-REQUEST FOR s_btyp-high.
IF NOT p_bgrp IS INITIAL .
PERFORM get_btyp USING 'h'.
ELSE .
MESSAGE s999 WITH text-e09.
ENDIF.
AT SELECTION-SCREEN ON p_bgrp.
SELECT SINGLE objid stext
FROM hrp1000
INTO wa_bgrp
WHERE objid = p_bgrp AND
otype = 'L' AND
plvar = '01' AND
( short = 'ROLE' OR
short = 'TECH_PROGRAM' ).
IF sy-subrc EQ 0.
p_bgrp1 = wa_bgrp-stext.
ELSE.
MESSAGE e999 WITH text-e09.
ENDIF.
AT SELECTION-SCREEN ON s_btyp.
CLEAR : t_eventtypelist, t_group, t_eventgroup.
REFRESH : t_eventtypelist, t_group, t_eventgroup.
CLEAR : w_flag.
*Fetch all the subordinates under given Event Group - L/D
SELECT objid
sobid
sclas
FROM hrp1001
INTO TABLE t_group
WHERE objid = p_bgrp
AND plvar = '01'
AND rsign = 'B'
AND relat = '003'
AND ( sclas = 'L' OR sclas = 'D' ).
WHILE w_flag <> 1.
PERFORM get_objids.
ENDWHILE.
IF NOT t_eventtypelist[] IS INITIAL.
*Get only valid Event Types from input Event Types, for given Event
*Group - by deleting others..
LOOP AT t_eventtypelist.
IF t_eventtypelist-objid IN s_btyp.
EXIT.
ELSE.
DELETE t_eventtypelist.
ENDIF.
AT LAST.
*since we r checking Event Types, All other fields will be locked
*but we need Event Group field to be unlocked to edit again,
*if theres no theres no valid Event Types in given input
LOOP AT SCREEN.
CHECK screen-name = 'P_bgrp'.
screen-input = '1'.
MODIFY SCREEN.
ENDLOOP.
MESSAGE e999 WITH text-e04.
EXIT.
ENDAT.
ENDLOOP.
ELSE.
LOOP AT SCREEN.
CHECK screen-name = 'P_bgrp'.
screen-input = '1'.
MODIFY SCREEN.
ENDLOOP.
MESSAGE e999 WITH text-e03.
ENDIF.
FORM get_bgrp *
FORM get_bgrp .
SELECT objid stext
FROM hrp1000
INTO CORRESPONDING FIELDS OF TABLE t_bgrp
WHERE plvar = '01' AND
otype = 'L' AND
short = 'ROLE' OR
short = 'TECH_PROGRAM' .
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
endpos_col = 75
endpos_row = 20
startpos_col = 30
startpos_row = 05
titletext = 'Select Business Event Group'
IMPORTING
choise = w_lineno
TABLES
valuetab = t_bgrp
EXCEPTIONS
break_off = 1
OTHERS = 2.
IF sy-subrc EQ 0 .
READ TABLE t_bgrp INDEX w_lineno.
IF sy-subrc EQ 0.
p_bgrp = t_bgrp-objid.
p_bgrp1 = t_bgrp-stext.
ENDIF .
CLEAR t_bgrp .
REFRESH t_bgrp .
ENDIF .
ENDFORM . "get_bgrp
****subroutine for business eventtype input criteria
FORM get_btyp USING f_range.
CLEAR : t_validation,
t_btyp,
t_eventtypelist,
t_group,
t_eventgroup,
w_flag.
REFRESH : t_validation,
t_btyp,
t_eventtypelist,
t_group,
t_eventgroup.
t_validation-fieldname = 'P_BGRP'.
APPEND t_validation.
CLEAR t_validation.
*Getting Screen Values
CALL FUNCTION 'DYNP_VALUES_READ'
EXPORTING
dyname = w_repid
dynumb = '1000'
TABLES
dynpfields = t_validation
EXCEPTIONS
invalid_abapworkarea = 1
invalid_dynprofield = 2
invalid_dynproname = 3
invalid_dynpronummer = 4
invalid_request = 5
no_fielddescription = 6
invalid_parameter = 7
undefind_error = 8
double_conversion = 9
stepl_not_found = 10
OTHERS = 11.
IF sy-subrc NE 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
READ TABLE t_validation WITH KEY fieldname = 'P_BGRP'.
IF NOT t_validation-fieldname IS INITIAL.
*Getting Event Group ID that entered
LOOP AT t_validation.
IF t_validation-fieldname = 'P_BGRP'.
p_bgrp = t_validation-fieldvalue.
ENDIF.
ENDLOOP.
CLEAR t_validation.
REFRESH t_validation.
*To fetch the business event groups and business event types that belong
to the input business event group.Since a business group can have a
*business groups as well as business event types we have pick all of
*them
*Getting all subordinates - Event Group/Type under given Event Group
SELECT objid
sobid
sclas
FROM hrp1001
INTO TABLE t_group
WHERE objid = p_bgrp
AND plvar = '01'
AND rsign = 'B'
AND relat = '003'
AND endda = '99991231'
AND ( sclas = 'L' OR sclas = 'D' ).
*Getting all Event Types
WHILE w_flag <> 1.
PERFORM get_objids.
ENDWHILE.
IF NOT t_eventtypelist[] IS INITIAL.
SORT t_eventtypelist BY objid.
*Getting Names of Event Types
SELECT objid
stext
FROM hrp1000
INTO CORRESPONDING FIELDS OF TABLE t_btyp
FOR ALL ENTRIES IN t_eventtypelist
WHERE objid = t_eventtypelist-objid
AND otype = 'D' AND plvar = '01'
AND endda = '99991231'.
IF sy-subrc = 0.
*PopUp Display for Event Types
CALL FUNCTION 'POPUP_WITH_TABLE_DISPLAY'
EXPORTING
endpos_col = 75
endpos_row = 20
startpos_col = 30
startpos_row = 05
titletext = 'Select Business Event Type ID'
IMPORTING
choise = w_lineno
TABLES
valuetab = t_btyp
EXCEPTIONS
break_off = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ELSE.
*Since the Table returned by function module will have data in Header,
*clear the Header
*Retreive Selected Event Type into Select Option
READ TABLE t_btyp INDEX w_lineno.
IF sy-subrc EQ 0.
IF f_range = 'l'.
s_btyp-low = t_btyp-objid.
ELSE.
s_btyp-high = t_btyp-objid.
ENDIF.
ENDIF.
ENDIF.
ELSE.
MESSAGE s999 WITH text-e03.
ENDIF.
ELSE.
MESSAGE s999 WITH text-e01.
ENDIF.
ENDIF.
ENDFORM. " EVNTTY
FORM get_objids *
FORM get_objids.
*To delete the business event types that are found and push it in
*another table
IF NOT t_group[] IS INITIAL.
LOOP AT t_group.
*If event type
IF t_group-sclas = 'D'.
t_eventtypelist-objid = t_group-sobid.
APPEND t_eventtypelist.
CLEAR t_eventtypelist.
DELETE t_group.
*If event group
ELSEIF t_group-sclas = 'L'.
t_eventgroup-objid = t_group-sobid.
APPEND t_eventgroup.
CLEAR t_eventgroup.
DELETE t_group.
CLEAR t_group.
ENDIF.
ENDLOOP.
ELSE.
w_flag = 1.
ENDIF.
IF NOT t_eventgroup[] IS INITIAL.
*To get the second level of business groups and business event type
SELECT objid sobid sclas
FROM hrp1001
INTO TABLE t_group
FOR ALL ENTRIES IN t_eventgroup
WHERE objid = t_eventgroup-objid
AND plvar = '01'
AND rsign = 'B'
AND relat = '003'
AND endda = '99991231'
AND ( sclas = 'L' OR sclas = 'D' ).
CLEAR t_eventgroup.
REFRESH t_eventgroup.
ENDIF.
ENDFORM. " GET_OBJIDS
Start of Selection *
START-OF-SELECTION.
*Pass the Event Type and fetch the Related Id
*for the Qualification imparted by the Event
SELECT objid sobid
FROM hrp1001
INTO TABLE t_objid
WHERE objid IN s_btyp AND
otype = 'D' AND
plvar = '01' AND
relat = '028' AND
rsign = 'A' AND
sclas = 'Q'.
IF sy-subrc EQ 0.
*Pass the Qualification Id and fetch Object Id of the
*person who fulfills this Qualification
SELECT objid sobid adatanr
FROM hrp1001
INTO TABLE t_sobid FOR ALL ENTRIES IN t_objid
WHERE sobid = t_objid-sobid AND
otype = 'P' AND
plvar = '01' AND
relat = '032' AND
rsign = 'A' AND
sclas = 'Q' .
IF sy-subrc = 0.
*Fetch only the Person along with the skillrating
*who has skill rating as '0001' or '0003'
SELECT adatanr chara
FROM hrpad31
INTO TABLE t_prof
FOR ALL ENTRIES IN t_sobid
WHERE adatanr = t_sobid-adatanr AND
( chara = '0001' OR chara = '0003' ).
IF sy-subrc NE 0.
MESSAGE s999 WITH text-s01.
EXIT .
ELSE .
*Fetch only Employee Id's who meets the required skill rating
*which inturn has the EMPID who are all are Certified Instructors
LOOP AT t_sobid.
READ TABLE t_prof WITH KEY adatanr = t_sobid-adatanr.
IF sy-subrc NE 0.
DELETE t_sobid .
ENDIF.
ENDLOOP.
SORT t_sobid BY objid.
DELETE ADJACENT DUPLICATES FROM t_sobid.
ENDIF.
ENDIF.
ENDIF.
IF NOT t_sobid[] IS INITIAL.
data: begin of it_trgpernr occurs 0,
objid type hrp1000-objid,
sobid type hrp1001-sobid,
end of it_trgpernr.
select objid sobid
from hrp1001
into table it_trgpernr for all entries in t_sobid
where otype ='P' and
objid = t_sobid-objid and
sclas = 'D' and
sobid = '50008220'.
*Fetch Grade of the Certified Instructors by passing their EmpId's
SELECT pernr yysalgr
FROM pa0008
INTO TABLE t_grade
FOR ALL ENTRIES IN t_sobid
WHERE pernr = t_sobid-objid AND endda = '99991231'.
ENDIF.
For Heading in the Output Display Layout
PERFORM heading USING gt_list_top_of_page[].
End of Selection *
END-OF-SELECTION.
Populating data into Final Table which contains all information aboutthe Certified Instructors
*Retrieve Employee Id for the Certified Instructors only if he is active
LOOP AT t_sobid.
SELECT SINGLE *
FROM pa0000
WHERE pernr = t_sobid-objid AND
begda <= sy-datum AND
endda >= sy-datum AND
stat2 ='3'.
IF sy-subrc = 0.
t_final-empid = t_sobid-objid.
SELECT SINGLE *
FROM hrp1001
WHERE otype = 'P' AND
objid = t_sobid-objid AND
rsign = 'B' AND
relat = '25' AND
sclas = 'D' AND
sobid = '50008220'.
*DATA:W_SOBID TYPE HRP1001-SOBID.
*W_SOBID = t_sobid-objid. .
SELECT SINGLE *
FROM hrp1001
WHERE otype = 'D' AND
objid = '50008220' AND
rsign = 'B' AND
relat = '25' AND
sclas = 'P' AND
sobid = W_SOBID.
IF sy-subrc EQ 0.
t_final-atndttt = 'YES'.
ELSE.
t_final-atndttt = 'NO'.
ENDIF.
*Retrieve Employee SkillRating for the Certified Instructors
*by passing the adatanr value which inturn is fetched based on the empid
READ TABLE t_prof WITH KEY adatanr = t_sobid-adatanr.
IF sy-subrc EQ 0.
t_final-sklrate = t_prof-chara.
ENDIF.
*Retrieve Employee Grade for the given id
READ TABLE t_grade WITH KEY pernr = t_sobid-objid.
IF sy-subrc EQ 0.
t_final-grade = t_grade-yysalgr.
ENDIF.
REFRESH t_projdetails.
CLEAR t_projdetails.
*function which fetches the name project name account and
*vertical name of the person for the given empid
CALL FUNCTION 'ZBAPI_PROJDETAILS'
EXPORTING
pernr = t_sobid-objid
TABLES
it_finaltab = t_projdetails.
IF NOT t_projdetails[] IS INITIAL.
SHIFT t_sobid-objid LEFT DELETING LEADING '0'.
READ TABLE t_projdetails WITH KEY pernr = t_sobid-objid.
IF sy-subrc EQ 0.
t_final-empname = t_projdetails-ename.
IF NOT t_projdetails-proj IS INITIAL.
t_final-pgmng = t_projdetails-pmname.
ELSE.
t_final-pgmng = t_projdetails-gmname.
ENDIF.
t_final-accname = t_projdetails-accname.
t_final-vertname = t_projdetails-vertname.
ENDIF.
ENDIF.
APPEND t_final.
ENDIF.
CLEAR t_final.
ENDLOOP.
SORT t_final BY empid.
DELETE ADJACENT DUPLICATES FROM t_final.
*Enabling Sort by PERNR & Global ID in ALV display
PERFORM sub_sort_info.
*Form to Populate Field Catalog
PERFORM populate_fieldcatalog.
For the ALV ROW Optimize Width
gs_layout-colwidth_optimize = 'X' .
*perform alv_display tables final fieldcatalog.
IF NOT t_final[] IS INITIAL.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_callback_program = w_repid
is_layout = gs_layout
it_fieldcat = t_fieldcatalog[]
it_sort = w_sort
i_save = 'A'
it_events = gt_events[]
TABLES
t_outtab = t_final
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
ELSE.
MESSAGE s000(vz) WITH 'No Records found for Given Input Criteria'.
ENDIF.
TOP OF PAGE *
*Outputs formatted simple header information at TOP-OF-PAGE.
TOP-OF-PAGE.
PERFORM top_of_page.
Subroutines *
*& Form eventtab_build
text`
-->P_GT_EVENTS[] text
FORM eventtab_build USING rt_events TYPE slis_t_event.
DATA: ls_event TYPE slis_alv_event.
DATA: g_top_of_page TYPE slis_formname VALUE 'TOP_OF_PAGE'.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = rt_events.
READ TABLE rt_events WITH KEY name = slis_ev_top_of_page
INTO ls_event.
IF sy-subrc = 0.
MOVE g_top_of_page TO ls_event-form.
APPEND ls_event TO rt_events.
ENDIF.
ENDFORM. " eventtab_build
*& Form HEADING
text
FORM heading USING lt_top_of_page TYPE slis_t_listheader.
DATA: ls_line TYPE slis_listheader.
*Layout Display Text - "Caritor ( India ) Pvt.Ltd "
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = text-h01.
APPEND ls_line TO lt_top_of_page.
*Layout Display Text - "Certified Instructor Eligibility List "
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = text-h02.
APPEND ls_line TO lt_top_of_page.
ENDFORM. " HEADING
*& Form top_of_page
text
--> p1 text
<-- p2 text
FORM top_of_page.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = gt_list_top_of_page.
ENDFORM. " top_of_page
*& Form sub_sort_info
text
--> p1 text
<-- p2 text
FORM sub_sort_info.
DATA : l_sort TYPE slis_sortinfo_alv .
CLEAR l_sort.
Employee ID
l_sort-fieldname = 'EMPID'.
l_sort-up = 'X'.
APPEND l_sort TO w_sort.
ENDFORM. " sub_sort_info
*& Form populate_fieldcatalog
text
--> p1 text
<-- p2 text
FORM populate_fieldcatalog.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'EMPID' ' ' text-011 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'EMPNAME' ' ' text-002 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'GRADE' ' ' text-003 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'ATNDTTT' ' ' text-004 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'PGMNG' ' ' text-006 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'ACCNAME' ' ' text-007 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'VERTNAME' ' ' text-008 20 w_pos.
PERFORM fill_fields_of_fieldcatalog
TABLES t_fieldcatalog
USING 'T_FINAL' 'SKLRATE' ' ' text-005 20 w_pos.
ENDFORM. " populate_fieldcatalog
*& Form FILL_FIELDS_OF_FIELDCATALOG
text
-->P_T_FIELDCATALOG text
-->P_0870 text
-->P_0871 text
-->P_0872 text
-->P_TEXT_001 text
-->P_20 text
-->P_W_POS text
FORM fill_fields_of_fieldcatalog TABLES fp_t_fieldcatalog STRUCTURE
t_fieldcatalog
USING fp_table
fp_field
fp_key
fp_text
fp_out_len
fp_pos.
fp_t_fieldcatalog-tabname = fp_table.
fp_t_fieldcatalog-fieldname = fp_field.
fp_t_fieldcatalog-seltext_l = fp_text.
fp_t_fieldcatalog-key = fp_key.
fp_t_fieldcatalog-outputlen = fp_out_len.
fp_t_fieldcatalog-col_pos = fp_pos.
APPEND fp_t_fieldcatalog.
CLEAR: fp_t_fieldcatalog.
fp_pos = fp_pos + 1.
ENDFORM. " FILL_FIELDS_OF_FIELDCATALOG
10.249.11.136\SAP-StudyMaterial -
Send report output as pdf attachment (without collecting spool )
I used to do this requirement by collecting the spool and then convert it to pdf. But in this case we should use the report output ( NOT FROM SPOOL ) and convert it to PDF and send it as email attachment.
Please help.
Thanks!Hi,
I can think of these options. Please explore on the possibilities.
1) Create one MAIN Report , which will submit your report. Get the List output from memory. Convert the Data to PDF and send the PDF as attachment in mail.
2) Create a smartform which will be called in your report. Convert the returned data to PDF and then send the PDF as attachment in mail.
3) Create one MAIN Report , which will submit your report thorugh a JOB. Wait for the JOB to be completed. Convert the ABAP Spool data to PDF and send the PDF as attachment in mail.
Regards,
Abhishek -
Hi,
i developed one report.My Requirement is i have to send that report output to spool and aswell as i have to display the output in the output screen.At present i am using GET_PRINT_PARAMETERS function module.
Regards,
Kiran Kumar.G.AHi
FORM GET_PRINTER_PARAMETERS .
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
DESTINATION = GV_SPLD
COPIES = 1
LIST_NAME = 'TEST'
LIST_TEXT = 'Test NEW-PAGE PRINT ON'
IMMEDIATELY = ' '
RELEASE = ' '
NEW_LIST_ID = 'X'
EXPIRATION = DAYS
LINE_SIZE = 255
LINE_COUNT = 65
LAYOUT = 'Y_PAPER'
SAP_COVER_PAGE = 'X'
RECEIVER = 'SAP*'
DEPARTMENT = 'System'
SAP_OBJECT = 'RS'
AR_OBJECT = 'TEST'
ARCHIVE_ID = 'XX'
ARCHIVE_INFO = 'III'
ARCHIVE_TEXT = 'Description'
NO_DIALOG = 'X'
IMPORTING
OUT_PARAMETERS = PARAMS
OUT_ARCHIVE_PARAMETERS = ARPARAMS
VALID = VALID.
NEW-PAGE PRINT ON
NEW-SECTION
PARAMETERS PARAMS
ARCHIVE PARAMETERS ARPARAMS
NO DIALOG.
LOOP AT GT_FINAL_ABAP_TABLE INTO GS_FINAL_ABAP_TABLE.
*To print each ABAP spool in new page
IF GS_FINAL_ABAP_TABLE = 'NEW-PAGE'.
NEW-PAGE.
ENDIF.
IF GS_FINAL_ABAP_TABLE <> 'NEW-PAGE'.
WRITE / GS_FINAL_ABAP_TABLE.
ENDIF.
ENDLOOP .
NEW-PAGE PRINT OFF .
SELECT RQIDENT
RQCLIENT
RQO1NAME
INTO TABLE GT_TSP01
FROM TSP01
WHERE RQOWNER = SY-UNAME
AND RQ2NAME = 'TEST' .
IF SY-SUBRC = 0 .
SORT GT_TSP01 BY RQIDENT DESCENDING.
READ TABLE GT_TSP01 INTO GS_TSP01 INDEX 1.
FREE GT_TSP01.
ENDIF
Reward if useful
narendra -
Sending report output to Excel
Dear buddies
I'm using OLE Object in my report to send its output to excel. I find this way from an example at the same forum. But I feel that this example is for very small sized reports which have to send a few cells to excel because in this method we've to map each boiler plate and data field to excel like this.
function B_DEPTNOFormatTrigger return boolean is
begin
RPT2XLS.put_cell(1, 'DEPTNO', FontColor => 10, FontSize => 8, FontStyle => RPT2XLS.BOLD);
RPT2XLS.new_line;
return (TRUE);
end;
In this way its very hard to map large reports to excel which have more than 50 or 60 data fields and labels. So is there any short way to send its output to excel. Be careful that I also dont wanna use Delimited option coz Delimited file has also to be formatted while importing to Excel. Is there anyway that OLE Object should automatically detect all my Report Labels and fields or some other solution in yours minds???If you are using 10g reports you can use the latest parameter desformat=spreadsheet
Rajesh Alex -
Printing issue of report output list display
Dear All,
I need to print the report output display list. So, for this I have used the following code. But it's not printing.
Will you please check the below code and kindly let me where should I change/modify in the code.
START-OF-SELECTION.
SET PF-STATUS 'ZGUI_STATUS1'.
END-OF-SELECTION.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'PRNT'.
DATA: l_params TYPE pri_params,
l_valid TYPE c,
l_arc_params TYPE arc_params.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = l_v_usr01-spld
copies = 1
list_name = 'TEST'
list_text = 'Test NEW-PAGE PRINT ON'
immediately = 'X'
line_size = 220
release = 'X'
mode = 'CURRENT'
no_dialog = 'X'
IMPORTING
out_archive_parameters = l_arc_params
out_parameters = l_params
valid = l_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
NEW-PAGE PRINT ON PARAMETERS l_params ARCHIVE PARAMETERS
l_arc_params NO DIALOG.
PERFORM display_data.
NEW-PAGE PRINT OFF.
ENDCASE.
Many Thanks,
RanjanDear Amit,
The font size is not increasing, in-fact, if I use the code like the below, it's not even printing, I am checking different ways,
DATA: lay TYPE pri_params-paart,
lines TYPE pri_params-linct,
rows TYPE pri_params-linsz.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'PRNT'.
lay = 'X_60_85'.
lines = 60.
rows = 85.
DATA: l_params TYPE pri_params,
l_valid TYPE c,
l_arc_params TYPE arc_params.
CALL FUNCTION 'GET_PRINT_PARAMETERS'
EXPORTING
destination = l_v_usr01-spld
destination = 'LPIN'
copies = 1
list_name = 'TEST'
list_text = 'Test NEW-PAGE PRINT ON'
immediately = 'X'
layout = lay
line_count = lines
line_size = rows
line_size = 220
release = 'X'
mode = 'CURRENT'
no_dialog = 'X'
IMPORTING
out_archive_parameters = l_arc_params
out_parameters = l_params
valid = l_valid
EXCEPTIONS
archive_info_not_found = 1
invalid_print_params = 2
invalid_archive_params = 3
OTHERS = 4.
NEW-PAGE PRINT ON PARAMETERS l_params NO DIALOG.
PERFORM display_data.
NEW-PAGE PRINT OFF.
ENDCASE.
Kindly let me know if you have some new answer?
Kind Regards,
Ranjan
Maybe you are looking for
-
Simple LIMIT Clause Impossible?
Is the simple LIMIT clause available in other databases simply impossible in Oracle? This is driving me nuts and I'm just not finding a good answer. For example, the query: SELECT * FROM MYUSER ORDER BY LOGIN LIMIT 41, 20 This would return up to 20 r
-
So there is a lot of white space at the top and bottom of the page when I print off poster. When I see the poster on the canvas on cs2 it looks how I want it to! I am confused! Help pls. Also I am new to photoshop. When I sent the finished poster
-
Hi I've got Mac OS X 10.5.8 Do i need to buy first Mac OS X 10.6 to get the OS X Lion ? thanks
-
I've just got an X-Fi Elite Pro, i slotted it into a spare PCI slot and booted into Windows XP. Windows loaded fine, I inserted the driver disk and installed all the software on it. I restarted. I get a window pop up saying "Multimedia Audio Controll
-
ok so i accidentally bought a song i thought was one thing but ended up being horrible and i paid 0.99 for it. i also have tv episodes that are downloaded onto my ipod that ive never seen before it was $5.99 and i want my money back for both of them.