Report- formatting of output list. -urgent
Hi experts,
i have done report in where i hv to display more than 20 fiedls to display. I report output list is around 300 chacertes when i am prinint the report it is printing only 132 chac per page. Remaring 168 is not printing. How can i do this one. How to print total ouput in page. The max size of print page is 132 chac .
its and urgent requiremnt to me.
<b>useful answers surely awarded with points</b>
regards,
sunil kumar.
Hi ,
At start of the report program add LINE SIZE which will be required for your display examople
REPORT ztest_rep NO STANDARD PAGE HEADING
LINE-SIZE 1023 .
Above id the "ztest_rep program and line size will define the number of the characters that will be output as in this case it will be 1023 char...
Reward points if usefull....
Message was edited by:
SOURABH MALHOTRA
Similar Messages
-
Submit report to get output list
Hi friends,
I have one requirement to take output list of a transaction in one internal table.
As the transaction is very much interactive , that perticular internal table gets populated somewhere in the middle of the standard program...later on that table undergoes further processing to cope up with he interaction...
using SUBMIT report , we can export it to memory
and using FM 'LIST_FROM_MEMORY' we can get it back as following.
list_tab contains data in two fields RFCSIZE and RFCRECORD in numbers only...
Submit report_name with SELECTION-TABLE SELTAB
exporting list to Memory and return.
CALL FUNCTION 'LIST_FROM_MEMORY'
TABLES
listobject = list_tab
EXCEPTIONS
not_found = 1
OTHERS = 2.
BUT , Can we get the same output list (i.e before interaction) in one internal table...
thanksHi,
You can check whether the list is exported in between before the submit.
Supposed it is exported before the interaction den you can import it ..Just check the value is fetched and stored in a temporary table.
Is it a csutom program or standard SAP one..?
Hope this helps.
Regards,
Navin. -
Hi All,
I need burst the report based on the customer number for some customers and burst based on invoice number for some customers in the same bursting program. I have made the changes accordingly and sending email attachments as expected, but when the output sent for as an attachment for each invoice the report does not printing in full format, its completely ignore one child block. Not sure what was the issue. This is very very urgent please help me out.
Following is my bursting code:
<?xml version="1.0" encoding="UTF-8"?>
<xapi:requestset xmlns:xapi="http://xmlns.oracle.com/oxp/xapi" type="bursting">
<xapi:request select="/XXARINVOICE/LIST_G_CUST_HDR/G_CUST_HDR">
<xapi:delivery>
<xapi:email id="123" server="${SMTP_SERVER_NAME}" port="25" from="${XX_EMAIL}" reply-to = "">
<xapi:message id="123" to="${EXCLUDED_BILL_TO_EMAIL}" attachment="true"
subject="Confirmation for your Invoice(s)">
Dear Customer,
Thank you for placing an order with XX cust.
Please review the attached invoice(s).
Regards,
Customer Service
</xapi:message>
</xapi:email>
</xapi:delivery>
<xapi:document output="XX_INVOICE_EMAIL_${CUST_NO}" output-type="pdf" delivery="123">
<xapi:template type="rtf" location="xdo://xxabc.XXARNONEDIINVOICE.en.00/?getSource=true" filter=".//G_INVOICE_HDR[EXCLUDED_BILL_TO_EMAIL!='N']"/>
</xapi:document>
</xapi:request>
<xapi:request select="/XXARINVOICE/LIST_G_CUST_HDR/G_CUST_HDR">
<xapi:delivery>
<xapi:email id="123" server="${SMTP_SERVER_NAME}" port="25" from="${XX_EMAIL}" reply-to = "">
<xapi:message id="123" to="${EXCLUDED_BILL_TO_FAX}" attachment="true"
subject="Confirmation for your Invoice(s)">
Dear Customer,
Thank you for placing an order with XX cust.
Please review the invoice(s).
Regards,
Customer Service
</xapi:message>
</xapi:email>
</xapi:delivery>
<xapi:document output="XX_INVOICE_FAX_${CUST_NO}" output-type="pdf" delivery="123">
<xapi:template type="rtf" location="xdo://xxabc.XXARNONEDIINVOICE.en.00/?getSource=true" filter=".//G_INVOICE_HDR[EXCLUDED_BILL_TO_FAX!='N']"/>
</xapi:document>
</xapi:request>
<!-- START Sending email for each invoice in CR2197-->
<xapi:request select="/XXARINVOICE/LIST_G_CUST_HDR/G_CUST_HDR/LIST_G_INVOICE_HDR/G_INVOICE_HDR">
<xapi:delivery>
<xapi:email id="123" server="${SMTP_SERVER_NAME}" port="25" from="${XX_EMAIL}" reply-to = "">
<xapi:message id="123" to="${BILL_TO_EMAIL}" attachment="true"
subject="Confirmation for your Invoice ${INVOICE_NO}">
Dear Customer,
Thank you for placing an order with XX cust.
Please review the attached invoice.
Regards,
Customer Service
</xapi:message>
</xapi:email>
</xapi:delivery>
<xapi:document output="XX_INVOICE_EMAIL_${INVOICE_NO}" output-type="pdf" delivery="123">
<xapi:template type="rtf" location="xdo://xxabc.XXARNONEDIINVOICE.en.00/?getSource=true" filter=".//G_INVOICE_HDR[BILL_TO_EMAIL!='N']"/>
</xapi:document>
</xapi:request>
<xapi:request select="/XXARINVOICE/LIST_G_CUST_HDR/G_CUST_HDR/LIST_G_INVOICE_HDR/G_INVOICE_HDR">
<xapi:delivery>
<xapi:email id="123" server="${SMTP_SERVER_NAME}" port="25" from="${XX_EMAIL}" reply-to = "">
<xapi:message id="123" to="${BILL_TO_FAX}" attachment="true"
subject="Confirmation for your Invoice ${INVOICE_NO}">
Dear Customer,
Thank you for placing an order with XX cust.
Please review the invoice.
Regards,
Customer Service
</xapi:message>
</xapi:email>
</xapi:delivery>
<xapi:document output="XX_INVOICE_FAX_${INVOICE_NO}" output-type="pdf" delivery="123">
<xapi:template type="rtf" location="xdo://xxabc.XXARNONEDIINVOICE.en.00/?getSource=true" filter=".//G_INVOICE_HDR[BILL_TO_FAX!='N']"/>
</xapi:document>
</xapi:request>
<!-- END Sending email for each invoice in CR2197-->
<xapi:request select="/XXARINVOICE/LIST_G_CUST_HDR/G_CUST_HDR/LIST_G_INVOICE_HDR/G_INVOICE_HDR">
<xapi:delivery>
<xapi:filesystem output="${OUT_DIR}/INV_${SALES_ORDER}_${ORG_ID}_${INVOICE_NO}_${REQUEST_ID}_${INVOICE_DATE}.pdf">
</xapi:filesystem>
</xapi:delivery>
<xapi:document output-type="pdf">
<xapi:template type="rtf" location="xdo://xxabc.XXARNONEDIINVOICE.en.00/?getSource=true" filter=".////XXARINVOICE[P_ATTACH='Y']"/>
</xapi:document>
</xapi:request>
</xapi:requestset>
Thanks in Advance,
JagadishInitialize this:
String pet = "":>
error is H:\JAVA\PetAdvice.java:88: variable pet might not have been initialized
return pet;Geez, the error tells you the source file and the line # at which the problem occurred, in addition to a lucid description. Why couldn't you figure it out for yourself?
% -
Oracle Portal Report - Formatting Excel output
We are using Oracle Portal 10.1.4.1 and we are using the Locally built providers create new report function.
The report data itself is working as expected. You click the report it prompts to open the excel file and it opens.
We are attempting to find a way to better format what is passed to Excel.
When we add header and footer information in the "Additinal PL/SQL" boxes it shows up on the HTML version of the report, but this does not however show up in the excel version. The excel version seems to be pretty much a raw dump of whatever columns and rows you selected.
Is there a way to add a header or footer to what Oracle Portal outputs to excel?
Thanks for the help!I remember seeing a Bug that formating conditions do not get saved for number and Date fields when sent to excel.
That might be the cause.
Thanx,
Chetan. -
Report select options similar to Query output options : Urgent !!!!!
Hi All,
I have developed a custom report . The output options of this report needs to be included in Selection screen like in SQ01 queries, there should be option to output the report results in different formats like List Viewer, ABAP List, Spread Sheet etc.,.
If some variant is selected then user will select whatever the format he want .
the output should display in that format .
How I can acomodate all these options to output a report .
How can I do this ..Pls help me its Urgent !!!!
Points for Sure !!!
Regards,
VarmaHi,
Try this code,
at user-command.
case sy-ucomm.
when 'disp'.
write:....... "abap list
when 'buton1'
call function 'reuse_alv_list_display'.
endcase.
i hope it gives ur answer
Reward if it helps. -
Need to download the report output list to a Excel file.
Hi,
I have a report output list, which i need to download to an Excel file, could any body suggest how to do this with out writing the ws_download.
My report data is coming from two internal tables, one internal table for left side reprt display and another internal table for right side report display, both the internal tables having the same fields.
suggest me how to combine these two internal table data in one internal table.
2 internal table structure is same but data is different.
SunilHi,
in the o/p list use the below menu path.
LIST>SAVE/SEND>FILE,
then a pop-up window with different formates will appear,then choose u r required format.
Thanks,
Anji -
Generate spool req number for report output list
Hi,
How to generate spool request number for report output list while executing the report.Please provide if you have any sample code.
Thanks and Regards,
BSR.HI srinivas,
welcome to sdn.
Exporting the Contents of a Spool Request
Use
You want to export the content of a spool request in one of the following ways:
· As a text file to the SAP GUI working directory
· Unconverted or as a table, RTF, or HTML to a directory of your choice
· As a PDF file to a directory of your choice
Procedure
Follow the procedure below:
Exporting to the SAP GUI Working Directory
If you are exporting large quantities of data, downloading the spool request as a text file to the SAP GUI working directory is a good solution.
Choose Spool Request ® Forward® Export as Text.
The entire text is stored in your SAP GUI working directory in ASCII format.
A file of this type is named using the following pattern:
.txt
Example: ABC0000004327.txt
You require appropriate authorization for this function from your administrator.
Exporting Unconverted or as a table, RTF, or HTML to a Directory of Your Choice
With this method of exporting a spool request, the content of the spool request is first displayed, and you then download the content in the format of your choice to a directory of your choice.
1. Select the spool request to be exported and choose Display Contents.
2. In the case of SAPscript/Smart Forms documents, activate list display by choosing Goto.
3. Choose System ® List ® Save ® Local File.
4. Choose one of the available formats and confirm your choice.
5. Choose a directory and save the spool request.
By default, only the first 10 pages of a spool request are saved in a file. You can increase the number of pages to be saved by choosing Goto ® Display Requests ® Settings and making the desired entries in the Display Area group box.
Exporting as a PDF File
You want to export the contents of a spool request as a PDF file to a directory of your choice, and print the file as required. The PDF file contains the print data in the format in which it would be output by the printer.
The following procedure is irrelevant for the printing of PDF-based forms, since a PDF file is already returned with this method. See also Displaying and Printing PDF-Based Forms.
You also require authorization from your administrator to run this report.
The PDF file is generated as follows with report RSTXPDFT4:
1. Generate a spool request from the document to be printed.
2. In transaction SE38, start report rstxpdft4.
3. In the displayed window, enter the spool request number and the directory in which the PDF file is to be stored.
Leave the Download PDF File option selected.
Choose Execute.
4. In the next window, you can confirm or change the path in which the file is be stored.
Save your entries.
5. The system displays a log from which you can see whether the report was successfully performed.
You can then open the file from the directory and print it as required.
Restrictions for Exporting as a PDF File
· The PDF conversion only supports true bar codes for Smart Forms, which were generated with the new bar code technology as of SAP NetWeaver 04. In all other cases, the bar code is only simulated.
· PDF conversion, especially of ABAP lists, is slower and is therefore not suitable for mass printing. However, you can speed up the conversion to PDF using the FASTLISTCONV option in report RSTXPDF3.
· The font selection for ABAP lists is predefined in the PDF converter and cannot be changed.
For more information about constraints, see SAP Note 323736 in the SAP Service Marketplace
see this links
http://help.sap.com/saphelp_40b/helpdata/en/d9/4a98f351ea11d189570000e829fbbd/content.htm
http://web.mit.edu/SAPR3/docs/webdocs/reports/rpRFprint.html
regards
shankar
reward me if usefull -
Group Membership report script - Modify to change format of output
Hi all,
Slowly getting to grips with Powershell. Such a powerful tool.
I've been tasked to develop a reporting script that will output a list of members of a set of groups and have found one of the scripts here to be a great starting point.
So this is the script:
"Import-Module ActiveDirectory
cd AD:
$MemberList = New-Item -Type file -Force “C:\Scripts\GroupMembers.csv”
Import-Csv “C:\scripts\grps.csv” | ForEach-Object {
$GName = $_.Samaccountname
$group = Get-ADGroup $GName
$group.Name | Out-File $MemberList -Encoding Unicode -Append
foreach ($member in Get-ADGroupMember $group) {$member.SamaccountName | Out-File $MemberList -Encoding Unicode -Append}
$nl = [Environment]::NewLine | Out-File $MemberList -Encoding ASCII -Append
The output lists the group name and the members of said group using Sam account name.
Ideally I would like that the email address of the user be in the output instead of SAMACCOUNTNAME however I realise that this may not easily be achievable due to the output of get-adgroupmember.
I'd also like if the output contained each of the email addresseses of the group members to be on the same line seperated by a semicolon in one cell directly under the group name.
EG:
GROUPNAME1
[email protected];[email protected];[email protected]
GROUPNAME2
user15:mail.com
Etc
Can either of these requirements be achieved from modifying the script above and any help would be much appreciated.
Thanks for any assistance.You're welcome, glad I could help out.
Here's the same code with some comments and syntax links:
# Import the CSV file and process each record
Import-Csv .\grps.csv | ForEach {
# Set the group name as a variable for easy use later
# This really isn't necessary, but I do it for easy reading
$groupName = $_.SamAccountName
# Get the group members of the current group and process each user
# The output of this loop will be stored in a single variable
$groupMembers = Get-ADGroupMember -Identity $groupName -Recursive | ForEach {
# Get the user account and select only the EmailAddress property
Get-ADUser -Identity $_.SamAccountName -Properties EmailAddress |
Select -ExpandProperty EmailAddress
# Create a hashtable from the data above
# The group members are sorted and then joined using ; as a delimiter
$props = @{
GroupName = $groupName
Members = ($groupMembers | Sort) -join ';'
# Create a new object based on the hashtable above
New-Object PsObject -Property $props
} | Select GroupName,Members | Export-Csv .\groupMemberships.csv -NoTypeInformation
# Select is used to ensure the correct column order and then an output CSV is created
http://ss64.com/ps/import-csv.html
http://ss64.com/ps/foreach-object.html
http://ss64.com/ps/get-adgroupmember.html
http://ss64.com/ps/get-aduser.html
http://ss64.com/ps/select-object.html
http://ss64.com/ps/syntax-hash-tables.html
http://ss64.com/ps/new-object.html
http://ss64.com/ps/export-csv.html
Don't retire TechNet! -
(Don't give up yet - 13,085+ strong and growing) -
Need to have an identifier on the Report Output List View (My BIP Reports)
Please help as we need to have an identifier e.a (Quote Id - Report Name) when the BIP
report was generated in Report Output List View, is it possible to customize
this vanilla functionallity or is there a patch we need in order to apply
this requirement?i doubt it is from skype. i havent used skype in 2 days or so.
here are the crash reports IDs from JUST today..
bp-8c7fab55-79c8-4db1-9527-4ba072111013 10/13/2011 4:51 PM
bp-db6bf6c4-cf34-4eae-a742-105842111013 10/13/2011 4:51 PM
bp-f28611cf-3ff0-4658-a843-05da92111013 10/13/2011 4:32 PM
bp-03fa57ef-580d-4f1d-8fb4-52ac72111013 10/13/2011 4:21 PM
bp-d07e0d82-df2a-41c8-a19b-bb99e2111013 10/13/2011 4:19 PM
bp-fafbd8cf-6769-4b76-8153-c17242111013 10/13/2011 4:06 PM
bp-ee9694ab-585b-4963-8b94-e46432111013 10/13/2011 3:47 PM
bp-773242e1-a87d-4e19-90cb-ce4e52111013 10/13/2011 3:37 PM
bp-6bae0db3-895b-4239-8a71-758ce2111013 10/13/2011 3:36 PM
bp-6dfc1b57-5a8f-4244-baa1-8d0642111013 10/13/2011 3:36 PM
bp-9a6589cd-0e2f-4299-b517-a6c862111013 10/13/2011 3:31 PM -
Hello All,
Need solution for my issue in reporting,
This is my Report format
Date A/c number Kf1 Kf2 Kf3
01.06.07 123 10 20 0
234 20 30 30
456 50 0 25
789 0 25 0
Result 80 75 55
01.07.07 124 10 0 10
134 30 30 30
457 40 0 0
788 0 25 10
Result 80 55 50
Now my requirement is to display Count in the result row as
Date A/c number Kf1 Kf2 Kf3
01.06.07 123 10 20 0
234 20 30 30
456 50 0 25
789 0 25 0
Result 3 3 2
01.07.07 124 10 0 10
134 30 30 30
457 40 0 0
788 0 25 10
Result 3 2 3
and to be more precise this is my requirement
Date Kf1 Kf2 Kf3
01.06.07 3 3 2
01.07.07 3 2 3
I made key figure Calculate Result as Count <> 0 and Calculate single value as Supress Result for each key Figure and A/c Number No display I got result like this showing all data as blank, however the rows will exist.
Date Kf1 Kf2 Kf3
01.06.07
3 3 2
01.07.07
3 2 3
But I need my result should be like this
Date Kf1 Kf2 Kf3
01.06.07 3 3 2
01.07.07 3 2 3
How can I Acheive this either by work Book Or by Query ,
Please help me
Thanks for all ur support in advance
Sai.Hello Boujema,
I Created formula variable replacement path in the same way you mentioned but this is irrespective to KF giving the Characteristic Account Number count...
Hello All,
please go through my requirement
this is my report
Date AC no Kf1 Kf2
01.06.07 XXX 10 12
yyy 15 10
zzz 5 0
result 30 22
If I remove Ac no from this it gives me a result as summation
Date Kf1 Kf2
01.06.07 30 22
In the same way the KF should give me count of the accounts
Date Kf1 Kf2
01.06.07 3 2
But I am getting now as If I mention Count<> 0 in KF properties
Date Kf1 Kf2
01.06.07 1 1
If I place Account Number in report which I dont want to Then i will get count
Date AC no Kf1 Kf2
01.06.07 XXX 10 12
yyy 15 10
zzz 5 0
Result 3 2
Hope you understand my requirement and come up with any solution.
Thanks for your help,
Sai. -
T.code FBL5N: a problem with the print of the output list
Hi All,
with reference to the t.code FBL5N, I have a problem with the print of the output list of the report.
When I execute the print, I obtain one customer for each page printed.
I wonder if is possible to obtain more customers for each page printed.
Could anyone help me?
Thanks
Gandalf
Edited by: Umberto Gandalf on Dec 21, 2008 10:36 PMHi,
Though personally i havent tried this option, check the same
Go to Menu: Settings >> Switch List
This will make the value displayed in ALV format and then try taking print outs.
Regards,
Sridevi -
How to select the output list check boxes
Hi ABAP gurus,
I am developing the on report, it display the output list, in that output list first column is Check box,
here i created the 3 Pushbuttons on application tool bar, one pushbutton is SELECT ALL, 2nd one is DESELECT ALL , 3rd one is CREDIT NOT CREATE,
here when i click on the Select all button it will select all the check boxs and click on the credit not button it will create credit memos for all the customers, if i select the one or more than one check boxs, it will not working means (Credit note will not be created for that paricular customer)
plz tell me answer, if u know the any example programs related to this program plz send me.Hi,
refer this sample code.
AT USER-COMMAND.
CASE sy-ucomm.
WHEN 'F2'.
PERFORM selection.
WHEN 'SELECTALL'.
PERFORM selectall.
WHEN 'DESELECTAL'.
PERFORM deselectall.
ENDCASE. " CASE SY-UCOMM
*& Form selection *
Selecting records of basic list and display flight information *
No parameters transferred *
FORM selection .
DO w_lines TIMES.
READ LINE w_lineno FIELD VALUE w_checkbox INTO w_checkbox
fs_spfli-carrid INTO fs_spfli-carrid
fs_spfli-connid INTO fs_spfli-connid
w_mark INTO w_mark.
IF sy-subrc EQ 0.
IF w_checkbox EQ 'X' AND w_mark NE '*'.
w_mark = '*'.
MODIFY CURRENT LINE FIELD VALUE w_mark
FIELD FORMAT w_checkbox INPUT OFF.
SELECT carrid " Airline Code
connid " Flight Connection Number
fldate " Flight date
seatsmax " Maximum capacity
seatsocc " Occupied seats
FROM sflight
INTO CORRESPONDING FIELDS OF TABLE t_sflight
WHERE carrid EQ fs_spfli-carrid AND connid EQ fs_spfli-connid.
IF sy-subrc EQ 0.
LOOP AT t_sflight INTO fs_sflight.
WRITE :/2 fs_sflight-carrid,
10 fs_sflight-fldate,
25 fs_sflight-seatsmax,
45 fs_sflight-seatsocc.
ENDLOOP. " LOOP AT T_SFLIGHT INTO....
ULINE.
CLEAR t_sflight.
ELSE.
MESSAGE text-001 TYPE 'S'.
ENDIF. " IF SY-SUBRC EQ 0
ENDIF. " IF W_CHECKBOX EQ 'X' AND .....
ENDIF. " IF SY-SUBRC EQ 0
ADD 1 TO w_lineno.
CLEAR w_checkbox.
ENDDO. " DO W_LINES TIMES
w_lineno = 3.
ENDFORM. " Selection -
3.0 Shared Component - Report Format - all PDF
Greetings,
Details
I have been working with the REPORTS - REPORT QUERIES section of APEX 3.0
The testing I have been doing is very simple, but I am running into a bit of a stumper.
I have created 4 report queries on the EMP table (SELECT * FROM EMP) that all use the same REPORT LAYOUT. The RTF file which is the template is a very simple - show all columns and rows for the EMP table (14 rows).
I have set each of the 4 report layouts to a different format.
1 - PDF
1 - EXCEL
1 - WORD
1 - HTML
I am NOT using the ITEM to dynamically set the format.
I can TEST each of the reports in the shared component area, and they test OK with a success rate of 75%.
The EXCEL format does not export correctly. (using Excel 2002 on the client) It is a bit of a mess. (Works in the XML publisher template builder on the client.. so the format is not the issue.)
More curious is the behavior when I put this application. I have created a LIST of the 4 report formats. All 4 return the PDF format when used.
To see the Application:
http://apex.oracle.com/pls/otn/f?p=34096
Question Summary:
1 - Has anyone run with and tested the RTF style report layouts out to Excel?
2 - The approach described usees 4 report queries against 1 layout. Is this a VALID use of the report functionality?
3 - Why would all the reports try to use PDF when they test in the correct formats?
Best Regards and Thank You.
-- TimTim,
The Excel output is not strictly XLS, it's actually HTML formatted in a way that Excel understands and through setting the MIME-types we make it open in Excel. I have to try reproducing your specific problem with Excel 2002. If you could send me your RTF layout and the end-result ([email protected]), I can take a look.
Your approach using 4 different queries with the same layout is perfectly fine. Ideally of course, you would not have to replicate them same query four times, so we are considering a shared query concept for future version of Application Express.
You specific problem with the output format being PDF at runtime appears to be a bug, I'll investigate further. Meanwhile one work-around would be to use a report region instead. If you're using the same SQL query as the source, you can associate the same report layout (on the report print attributes page). You could also create a "container" page for that report region, that's never actually called by the end user, and then have a button pointing to the URL below for printing. It would then work just like your report queries, only that you now would get the requested format:
f?p=&APP_ID.:[REPORT PAGE ID]:&SESSION.:FLOW_XMLP_OUTPUT_R[REPORT REGION ID]
so if your app ID is 34096 and your "container" page e.g. 99, and on page 99 your report region ID would be 1234567890, then use this URL as the button target:
f?p=&APP_ID.:99:&SESSION.:FLOW_XMLP_OUTPUT_R1234567890
Hope this helps,
Marc -
Script spol to mail , and report which sends output to spools
Hi All,
Please give me
script spol to mail , and report which sends output to spool.
thaks,
babuHi,
Check the below code:
scripts through email:
*& Report ZRICHA_OTF_PDF
report zricha_otf_pdf
message-id zz.
CONSTANTS *
constants : c_x(1) type c value 'X', " For constant value
c_otf(3) type c value 'OTF', " For format
c_u(1) type c value 'U'. " Mail Option
VARIABLES *
data : v_rqident type tsp01-rqident, " For Spool Number
v_rqclient type tsp01-rqclient, " For Client
v_rqo1name type tsp01-rqo1name, " For Object name
v_spool type tsp01-rqident, " For Spool Number
v_spool1 type tsp01-rqident. " For Spool Number
FLAGS *
data : f_spool type c.
INTERNAL TABLES *
Internal table for sending mails
data: it_pdf like tline occurs 10 with header line,
it_xi_pdf like tline occurs 0 with header line,
it_html like solisti1 occurs 0 with header line,
it_xi_temp like bapiqcmime occurs 0 with header line,
it_xi_mime(255) type c occurs 0 with header line.
For sending mail
data: it_objpack like sopcklsti1 occurs 2 with header line.
Internal table for Single List with Column Length 255
data : it_objbin like solisti1 occurs 10 with header line.
Internal table for Single List with Column Length 255
data : it_objtxt like solisti1 occurs 10 with header line.
Internal table for Structure of the API Recipient List
data : it_reclist like somlreci1 occurs 5 with header line.
Structure of the API Recipient List
data: x_doc_chng like sodocchgi1.
Internal table for storing the variants
data : begin of it_variant1 occurs 0,
variant like varid-variant,
end of it_variant1.
Internal table to store variants for the programs
data: it_variant2 like it_variant1 occurs 0 with header line.
Internal table for storing the selected values
data it_return type ddshretval occurs 0 with header line.
Internal table for storing the mail-ids
data : begin of it_mailid occurs 0,
kokrs like csks-kokrs,
kostl like csks-kostl,
datbi like csks-datbi,
telx1 like csks-telx1,
end of it_mailid.
Internal table for storing the mail-ids
data : it_mailid1 like it_mailid occurs 0 with header line.
SELECTION SCREEN *
data : v_char type char50.
selection-screen begin of block b1 with frame title text-001.
select-options: s_email for v_char no intervals
lower case
no-display.
select-options: s_email1 for v_char no intervals
lower case
no-display.
selection-screen end of block b1.
selection-screen begin of block a1 with frame title text-028.
selection-screen begin of line.
parameters : p_c1 as checkbox.
selection-screen comment 3(66) text-026 for field p_c1.
selection-screen end of line.
parameters : p_set like tsp1d-papart matchcode object zh_tsp1d.
selection-screen skip 1.
parameters : p_vara1 type rs38m-selset.
selection-screen end of block a1.
selection-screen begin of block a2 with frame title text-029.
selection-screen begin of line.
parameters : p_c2 as checkbox.
selection-screen comment 3(56) text-027 for field p_c1.
selection-screen end of line.
parameters : p_set1 like tsp1d-papart matchcode object zh_tsp1d.
selection-screen skip 1.
parameters : p_vara2 type rs38m-selset.
selection-screen end of block a2.
AT SELECTION SCREEN ON VALUE REQUEST
at selection-screen on value-request for p_vara1.
For fetching the variants available for the program
perform fetch_variants.
at selection-screen on value-request for p_vara2.
For fetching the variants available for the program
perform fetch_variants1.
AT SELECTION SCREEN
at selection-screen.
For Validation
perform validation.
START OF SELECTION *
start-of-selection.
To get the output data and mail
perform fetch_data.
END OF SELECTION *
end-of-selection.
if f_spool = c_x.
message e000 with 'Spool Not Generated'(060).
endif.
*& Form fetch_data
To get the output data and mail
form fetch_data .
To send the output to spool
perform generate_spool.
endform. " fetch_data
*& Form generate_spool
To send the output to spool
form generate_spool .
data: l_params like pri_params,
l_days(1) type n value 2,
l_count(3) type n value 1,
l_valid type c,
l_valid1 type c,
l_params1 like pri_params.
data: l_device type usr01-spld.
*Get the printer name for the user
select single spld into l_device from usr01 where bname = sy-uname.
if l_device is initial.
l_device = 'LOCL'.
endif.
For report-1
if p_c1 = 'X'.
Setting the print parameters
call function 'GET_PRINT_PARAMETERS'
exporting
destination = l_device
copies = l_count
list_name = sy-uname
list_text = 'SUBMIT ... TO SAP-SPOOL'(008)
release = c_x
new_list_id = c_x
expiration = l_days
LINE_SIZE = 255
LINE_COUNT = 65
layout = p_set
sap_cover_page = space
cover_page = space
receiver = 'SAP*'(010)
department = 'System'(011)
no_dialog = c_x
importing
out_parameters = l_params
valid = l_valid.
if l_valid <> space.
clear v_spool.
Fetch the spool number b4 submit
perform fetch_recent_spool using v_spool.
Submitting the program to spool
submit rkaep000 to sap-spool
using selection-set p_vara1
spool parameters l_params
without spool dynpro
and return.
clear v_spool1.
Fetch the spool number after submit
perform fetch_recent_spool using v_spool1.
if v_spool = v_spool1.
f_spool = c_x.
if p_c2 is initial.
stop.
endif.
else.
Checking the format ( ABAP/OTF)
perform format_check tables s_email.
endif.
else.
message e000 with 'Problem in print settings'(003).
stop.
endif.
endif.
For Report-2
if p_c2 = 'X'.
Setting the print parameters
call function 'GET_PRINT_PARAMETERS'
exporting
destination = l_device
copies = l_count
list_name = sy-uname
list_text = 'SUBMIT ... TO SAP-SPOOL'(008)
release = c_x
new_list_id = c_x
expiration = l_days
LINE_SIZE = 200
LINE_COUNT = 65
layout = p_set1
sap_cover_page = space
cover_page = space
receiver = 'SAP*'(010)
department = 'System'(011)
no_dialog = c_x
importing
out_parameters = l_params1
valid = l_valid1.
if l_valid1 <> space.
clear v_spool.
Fetch the spool number b4 submit
perform fetch_recent_spool using v_spool.
Submitting the program to spool
submit gp3diehxy88snfj0391v7kf9ek7050 to sap-spool
using selection-set p_vara2
spool parameters l_params1
without spool dynpro
and return.
clear v_spool1.
Fetch the spool number after submit
perform fetch_recent_spool using v_spool1.
if v_spool = v_spool1.
message e000 with 'Spool Not Generated'(060).
stop.
endif.
Checking the format ( ABAP/OTF)
perform format_check tables s_email1.
else.
message e000 with 'Problem in print settings'(003).
stop.
endif.
endif.
endform. " generate_spool
*& Form fetch_recent_spool
Fetch the recent spool number generated
form fetch_recent_spool using p_v_spool type tsp01-rqident .
data: l_user like tsp01-rq2name.
clear : v_rqident,
v_rqclient,
v_rqo1name.
l_user = sy-uname.
Get latest Spool No
select single rqident
rqclient
rqo1name
into (v_rqident , v_rqclient , v_rqo1name)
from tsp01
where rqcretime = ( select max( rqcretime )
from tsp01
where rq2name eq l_user
and rqfinal eq '.' ).
if sy-subrc = 0 .
p_v_spool = v_rqident.
endif.
endform. " fetch_recent_spool
*& Form format_check
Checking the format ( ABAP/OTF)
form format_check tables p_s_email structure s_email.
data : l_objtype like rststype-type.
call function 'RSTS_GET_ATTRIBUTES'
exporting
authority = 'SP01'(019)
client = v_rqclient
name = v_rqo1name
part = 1
importing
objtype = l_objtype
exceptions
fb_error = 1
fb_rsts_other = 2
no_object = 3
no_permission = 4.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
if l_objtype(3) = c_otf.
Convert OTF Spool to PDF
perform convert_otf2pdf tables p_s_email.
else.
Convert ABAP Spool to PDF
perform convert_abap2pdf tables p_s_email.
endif.
endform. " format_check
*& Form convert_otf2pdf
Convert OTF Spool to PDF
form convert_otf2pdf tables p_p_s_email structure s_email .
clear it_pdf.
refresh it_pdf.
data : l_bytecount type i.
Fn. to get the PDF format
call function 'CONVERT_OTFSPOOLJOB_2_PDF'
exporting
src_spoolid = v_rqident
no_dialog = 'X'
importing
pdf_bytecount = l_bytecount
tables
pdf = it_pdf
exceptions
err_no_otf_spooljob = 1
err_no_spooljob = 2
err_no_permission = 3
err_conv_not_possible = 4
err_bad_dstdevice = 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.
For page format
perform page_format tables p_p_s_email.
else.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " convert_otf2pdf
*& Form convert_abap2pdf
Convert ABAP Spool to PDF
form convert_abap2pdf tables p_p_s_email structure s_email.
clear it_pdf.
refresh it_pdf.
data : l_bytecount type i.
Fn. to convert to PDF format
call function 'CONVERT_ABAPSPOOLJOB_2_PDF'
exporting
src_spoolid = v_rqident
no_dialog = 'X'
importing
pdf_bytecount = l_bytecount
tables
pdf = it_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.
For page formatting
perform page_format tables p_p_s_email.
else.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " convert_abap2pdf
*& Form send_mail
For sending mail
form send_mail tables mail structure s_email .
Structures and internal tables for the send data
data: objpack like sopcklsti1 occurs 2 with header line,
objhead like solisti1 occurs 1 with header line,
objbin like solisti1 occurs 0 with header line,
objtxt like solisti1 occurs 10 with header line,
reclist like somlreci1 occurs 5 with header line.
data: doc_chng like sodocchgi1,
tab_lines like sy-tabix.
Data for the status output after sending
data: sent_to_all like sonv-flag.
clear: it_reclist, it_reclist[],
it_objtxt , it_objtxt[],
it_objpack, it_objpack[],
it_objbin , it_objbin[],x_doc_chng.
loop at it_html.
objbin-line = it_html-line.
append objbin.
clear objbin.
endloop.
Create the document which is to be sent
doc_chng-obj_name = 'List'(012).
doc_chng-obj_descr = 'Mail'(013).
Heading
objtxt-line = 'Mail with pdf attachment'(014).
append objtxt.
clear objtxt.
Size
describe table objtxt lines tab_lines.
read table objtxt index tab_lines.
doc_chng-doc_size = ( tab_lines - 1 ) * 255 + strlen( objtxt ).
Fill the fields of the packing_list for the main document:
clear objpack-transf_bin.
The document needs no header (head_num = 0)
objpack-head_start = 1.
objpack-head_num = 0.
Body
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'RAW'(015).
append objpack.
Create the attachment (the list itself)
describe table objbin lines tab_lines.
Fill the fields of the packing_list for the attachment:
objpack-transf_bin = 'X'.
Header
objpack-head_start = 1.
objpack-head_num = 0.
Body
objpack-body_start = 1.
objpack-body_num = tab_lines.
objpack-doc_type = 'PDF'(016).
objpack-obj_name = 'Attachment'(017).
objpack-obj_descr = 'Mail with pdf Attachment'(018).
objpack-doc_size = tab_lines * 255.
append objpack.
*-Fill the mail recipient list
loop at mail.
reclist-receiver = mail-low.
reclist-rec_type = c_u.
append reclist.
clear: reclist,
mail.
endloop.
*-Send the document by calling the SAPoffice API1 module for sending
*-documents with attachments
call function 'SO_NEW_DOCUMENT_ATT_SEND_API1'
exporting
document_data = doc_chng
put_in_outbox = c_x
commit_work = c_x
importing
sent_to_all = sent_to_all
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.
message i000 with 'Mail has been sent successfully'(006).
when others.
message e000 with 'Problem in sending the mail'(023).
endcase.
endform. " send_mail
*& Form page_format
For page foramtting
form page_format tables email structure s_email .
data : l_lines type i,
l_temp(500) type c,
l_offset type p,
l_lineslen(2) type p,
l_mimelen(2) type p,
l_tabix like sy-tabix.
clear : it_xi_pdf,
it_xi_temp.
refresh : it_xi_pdf,
it_xi_temp.
it_xi_pdf[] = it_pdf[].
Reformat the line to 255 characters wide (code from SAP)
clear: l_temp, l_offset, it_xi_temp.
describe table it_xi_pdf lines l_lines.
describe field it_xi_pdf length l_lineslen in character mode.
describe field it_xi_temp length l_mimelen in character mode.
loop at it_xi_pdf.
l_tabix = sy-tabix.
move it_xi_pdf to l_temp+l_offset.
if l_tabix = l_lines.
l_lineslen = strlen( it_xi_pdf ).
endif.
l_offset = l_offset + l_lineslen.
if l_offset ge l_mimelen.
clear it_xi_temp.
it_xi_temp = l_temp(l_mimelen).
append it_xi_temp.
shift l_temp by l_mimelen places.
l_offset = l_offset - l_mimelen.
endif.
if l_tabix = l_lines.
if l_offset gt 0.
clear it_xi_temp.
it_xi_temp = l_temp(l_offset).
append it_xi_temp.
endif.
endif.
endloop.
clear : it_xi_mime,
it_xi_mime[].
loop at it_xi_temp.
it_xi_mime(255) = it_xi_temp-line.
append it_xi_mime.
clear it_xi_mime.
endloop.
Final Data
clear : it_html,
it_html[].
it_html[] = it_xi_mime[].
For sending mail
perform send_mail tables email.
endform. " page_format
*& Form fetch_variants
For fetching the variants available for the program
form fetch_variants .
data : l_program like rs38m-programm value 'RKAEP000',
l_vara1 type dfies-fieldname value 'P_VARA1'.
clear : it_variant1,
it_variant1[].
Get variants
perform get_variants tables it_variant1
using l_program.
F4 Help
if not it_variant1[] is initial.
perform get_f4_help tables it_variant1
using l_vara1
changing p_vara1.
else.
message e000 with 'No variants available for report1'(054).
endif.
endform. " fetch_variants
*& Form validation
For Validation
form validation .
data : l_pro1 like rs38m-programm value 'RKAEP000',
l_pro2 like rs38m-programm value 'GP3DIEHXY88SNFJ0391V7KF9EK7050',
l_c1,
l_c2.
If both check-box are unchecked
if p_c1 is initial
and p_c2 is initial.
message e000 with 'Check any one check-box'(049).
endif.
If checked without varaint
if not p_c1 is initial and p_vara1 is initial.
message e000 with 'Please give any one of the variant for report1'(055).
endif.
If checked without varaint
if not p_c2 is initial and p_vara2 is initial.
message e000 with 'Please give any one of the variant for report2'(061).
endif.
Reading the variant and fetching the mail-ids
if p_c1 = c_x.
l_c1 = '1'.
clear : s_email,
s_email[].
perform read_variants tables it_mailid
s_email
using p_vara1
l_pro1
l_c1.
if s_email[] is initial.
message e000 with 'No Id available for given Cost report1'(066).
else.
sort s_email by low.
delete adjacent duplicates from s_email comparing low.
endif.
endif.
Reading the variant and fetching the mail-ids
if p_c2 = c_x.
clear : s_email1,
s_email1[].
l_c2 = '2'.
perform read_variants tables it_mailid1
s_email1
using p_vara2
l_pro2
l_c2.
if s_email1[] is initial.
message e000 with 'No Id available for given Cost report2'(067).
else.
sort s_email1 by low.
delete adjacent duplicates from s_email1 comparing low.
endif.
endif.
endform. " validation
*& Form GET_VARIANTS
Fetching Variants
form get_variants tables p_it_variant structure it_variant1
using p_v_program type rs38m-programm.
select variant
from varid
into table p_it_variant
where report = p_v_program.
endform. " GET_VARIANTS
*& Form GET_F4_HELP
text
form get_f4_help tables p_it_variant1 structure it_variant1
using p_l_vara1 like dfies-fieldname
changing p_p_vara like p_vara1.
Fn. for Pop-Up
call function 'F4IF_INT_TABLE_VALUE_REQUEST'
exporting
retfield = p_l_vara1
value_org = 'S'
display = ' '
tables
value_tab = p_it_variant1
return_tab = it_return
exceptions
parameter_error = 1
no_values_found = 2
others = 3.
if sy-subrc = 0.
p_p_vara = it_return-fieldval.
else.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
endform. " GET_F4_HELP
*& Form FETCH_VARIANTS1
text
form fetch_variants1 .
data : v_program1 like rs38m-programm value 'GP3DIEHXY88SNFJ0391V7KF9EK7050',
l_vara2 type dfies-fieldname value 'P_VARA2'.
clear : it_variant2,
it_variant2[].
Get Variants
perform get_variants tables it_variant2
using v_program1.
F4 Help
if not it_variant2[] is initial.
perform get_f4_help tables it_variant2
using l_vara2
changing p_vara2.
else.
message e000 with 'No variants available for report2'(050).
endif.
endform. " FETCH_VARIANTS1
*& Form read_variants
Reading the variant and fetching the mail-ids
form read_variants tables p_it_mailid structure it_mailid
p_s_email structure s_email
using p_p_vara1 like p_vara1
p_l_pro1 like rs38m-programm
p_l_c1 type c.
data : l_temp(44),
it_valutab like rsparams occurs 0 with header line.
ranges : r_cocen for csks-kostl.
Function Module to get the variant contents
call function 'RS_VARIANT_CONTENTS'
exporting
report = p_l_pro1
variant = p_p_vara1
tables
valutab = it_valutab
exceptions
variant_non_existent = 1
variant_obsolete = 2
others = 3.
if sy-subrc <> 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
clear : r_cocen,
r_cocen[].
loop at it_valutab where selname = 'KOSTL'
or selname = '_C-CCTR'.
Getting the range of cost centers
if it_valutab-option = 'BT'.
r_cocen-low = it_valutab-low.
For Conversion Routine
perform conversion using r_cocen-low.
r_cocen-high = it_valutab-high.
For Conversion Routine
perform conversion using r_cocen-high.
r_cocen-option = 'BT'.
r_cocen-sign = 'I'.
append r_cocen.
clear r_cocen.
endif.
Getting the single cost centers
if it_valutab-option = 'EQ'.
r_cocen-low = it_valutab-low.
For Conversion Routine
perform conversion using r_cocen-low.
r_cocen-option = 'EQ'.
r_cocen-sign = 'I'.
append r_cocen.
clear r_cocen.
endif.
endloop.
If no cost centers
if not r_cocen[] is initial.
select kokrs
kostl
datbi
telx1
from csks
into table p_it_mailid
where kostl in r_cocen.
if p_it_mailid[] is initial.
if p_l_c1 = '1'.
message e000 with 'No IDs available for report1'(059).
elseif p_l_c1 = '2'.
message e000 with 'No IDs available for report2'(062).
endif.
endif.
Deleting the blank entries
delete p_it_mailid where telx1 = space.
clear l_temp.
read table p_it_mailid index 1.
l_temp = p_it_mailid-telx1.
data : l_check.
loop at p_it_mailid where telx1 <> l_temp.
l_check = c_x.
endloop.
For checking the unique ids
if l_check = c_x.
if p_l_c1 = '1'.
message e000 with 'No unique mail-ids for report1'(058).
elseif p_l_c1 = '2'.
message e000 with 'No unique mail-ids for report2'(065).
endif.
endif.
Populating the IDs for the cost centers
loop at p_it_mailid.
set locale language sy-langu.
translate p_it_mailid-telx1 to lower case.
set locale language space .
concatenate p_it_mailid-telx1 '@allergan.com' into l_temp.
p_s_email-low = l_temp.
p_s_email-sign = 'I'.
p_s_email-option = 'EQ'.
append p_s_email.
clear p_s_email.
endloop.
else.
if p_l_c1 = '1'.
message e000 with 'No Cost Center Available for report1'(057).
elseif p_l_c1 = '2'.
message e000 with 'No Cost Center Available for report2'(063).
endif.
endif.
endform. " read_variants
*& Form CONVERSION
For Conversion Routine
form conversion using p_it_valutab_low type c.
call function 'CONVERSION_EXIT_ALPHA_INPUT'
exporting
input = p_it_valutab_low
importing
output = p_it_valutab_low.
endform. " CONVERSION
REPORT Z_RMTIWARI_SEND_SPOOL_MAIL_ATT .
PARAMETERS : P_SPOOL TYPE TSP01-RQIDENT OBLIGATORY .
PARAMETERS : P_MAIL TYPE char100 OBLIGATORY .
TYPES : TY_LINE type string.
DATA: IT_ATTACHMENT TYPE soli OCCURS 0 WITH HEADER LINE.
DATA: IT_ATTACHMENT_LONG TYPE TY_LINE OCCURS 0 WITH HEADER LINE.
DATA: LV_PDF_SIZE type i.
DATA: LT_PDF type standard table of tline with header line.
PERFORM SEND_EMAIL USING P_SPOOL P_MAIL.
FORM send_email
--> X_SPOOL_ID
--> X_EMAIL
FORM send_email USING X_SPOOL_ID X_EMAIL.
DATA: LT_OBJPACK LIKE sopcklsti1 OCCURS 2 WITH HEADER LINE,
LT_OBJHEAD LIKE solisti1 OCCURS 1 WITH HEADER LINE,
LT_OBJBIN LIKE solisti1 OCCURS 10 WITH HEADER LINE,
LT_OBJTXT LIKE solisti1 OCCURS 10 WITH HEADER LINE,
LT_RECLIST LIKE somlreci1 OCCURS 5 WITH HEADER LINE,
LV_DOCUMENT_DATA TYPE sodocchgi1.
DATA: L_ATT_LINES TYPE i.
DATA : LV_SPOOL_DESC(68) type c.
CHECK NOT ( X_EMAIL IS INITIAL ).
CLEAR: LT_RECLIST, LT_RECLIST[],
LT_OBJHEAD, LT_OBJHEAD[],
LT_OBJTXT, LT_OBJTXT[],
LT_OBJBIN, LT_OBJBIN[],
LT_OBJPACK, LT_OBJPACK[].
CLEAR LV_DOCUMENT_DATA.
Read spool and get the pdf internal table and name of spool
PERFORM READ_SPOOL USING X_SPOOL_ID LV_SPOOL_DESC.
CHECK NOT ( LT_PDF[] IS INITIAL ).
Convert pdf itab to 255 line itab.
data :LV_COUNTER type i.
data :LV_FROM type i.
loop at LT_PDF.
translate LT_PDF using ' ~' .
concatenate IT_ATTACHMENT_LONG LT_PDF into it_attachment_long.
endloop.
translate IT_ATTACHMENT_LONG using '~ ' .
append IT_ATTACHMENT_LONG.
clear : LV_COUNTER.
DO.
LV_COUNTER = strlen( IT_ATTACHMENT_LONG ).
if LV_COUNTER ge 255.
IT_ATTACHMENT = IT_ATTACHMENT_LONG(255).
append IT_ATTACHMENT.
SHIFT IT_ATTACHMENT_LONG by 255 places.
else.
IT_ATTACHMENT = IT_ATTACHMENT_LONG(lv_counter).
append IT_ATTACHMENT.
exit.
endif.
ENDDO.
Body of email
MOVE 'Email sent to you from SAP' TO LT_OBJTXT.
APPEND LT_OBJTXT.
LV_DOCUMENT_DATA-obj_name = 'SpoolMail'.
Title of the email as spool name
LV_DOCUMENT_DATA-obj_descr = LV_SPOOL_DESC.
LV_DOCUMENT_DATA-sensitivty = 'O'.
LV_DOCUMENT_DATA-expiry_dat = SY-datum + 15.
LV_DOCUMENT_DATA-doc_size = STRLEN( LT_OBJTXT ).
e-mail body
CLEAR LT_OBJPACK.
LT_OBJPACK-head_start = 1.
LT_OBJPACK-head_num = 0.
LT_OBJPACK-body_start = 1.
LT_OBJPACK-body_num = 1.
LT_OBJPACK-doc_type = 'RAW'.
LT_OBJPACK-doc_size = STRLEN( LT_OBJTXT ).
APPEND LT_OBJPACK.
For e-mail attachment
DESCRIBE TABLE IT_ATTACHMENT LINES L_ATT_LINES.
READ TABLE IT_ATTACHMENT INDEX L_ATT_LINES.
CLEAR LT_OBJPACK.
LT_OBJPACK-transf_bin = 'X'.
LT_OBJPACK-head_start = 1.
LT_OBJPACK-head_num = 1.
LT_OBJPACK-body_start = 1.
LT_OBJPACK-body_num = L_ATT_LINES.
LT_OBJPACK-doc_type = 'PDF'.
LT_OBJPACK-obj_name = 'email'.
LT_OBJPACK-obj_descr = LV_SPOOL_DESC.
LT_OBJPACK-doc_size = ( 255 * ( L_ATT_LINES - 1 ) ) + STRLEN( IT_ATTACHMENT-line ).
APPEND LT_OBJPACK.
make recipient list
LT_RECLIST-receiver = X_EMAIL.
LT_RECLIST-rec_type = 'B'. "To external email id
APPEND LT_RECLIST.
send mail with attachment
CALL FUNCTION 'SO_NEW_DOCUMENT_ATT_SEND_API1'
EXPORTING
document_data = LV_DOCUMENT_DATA
put_in_outbox = 'X'
TABLES
packing_list = LT_OBJPACK
object_header = LT_OBJHEAD
contents_bin = IT_ATTACHMENT
contents_txt = LT_OBJTXT
receivers = LT_RECLIST
EXCEPTIONS
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
OTHERS = 8.
If SY-subrc = 0.
write:/ 'Message sent'.
else.
write:/ 'Error encountered'.
endif.
ENDFORM. " send_email
*& Form read_spool
FORM read_spool USING X_SPOOL_ID Y_SPOOL_DESC.
DATA : LV_SPOOL_TYPE TYPE TSP01-RQDOCTYPE.
SELECT SINGLE RQDOCTYPE RQTITLE
INTO (lv_spool_type, y_spool_desc)
FROM TSP01
WHERE RQIDENT eq X_SPOOL_ID.
IF Y_SPOOL_DESC IS INITIAL.
concatenate 'Spool-' X_SPOOL_ID into Y_SPOOL_DESC.
ENDIF.
IF LV_SPOOL_TYPE eq 'LIST'. " If spool is a list
CALL FUNCTION 'CONVERT_ABAPSPOOLJOB_2_PDF'
EXPORTING
SRC_SPOOLID -
hai tell me how can we mail an output list or take printouts of output of a report.
Here is a sample program which does the same.
report zrich_0003 .
data: list type table of abaplist with header line.
data: htmllines type table of w3html with header line.
data: maildata like sodocchgi1.
data: mailtxt like solisti1 occurs 10 with header line.
data: mailrec like somlrec90 occurs 0 with header line.
start-of-selection.
Write the list
do 100 times.
write:/ sy-index, at 30 sy-index, at 50 sy-index.
enddo.
Save the list
call function 'SAVE_LIST'
tables
listobject = list
exceptions
list_index_invalid = 1
others = 2.
Convert to HTML
call function 'WWW_LIST_TO_HTML'
tables
html = htmllines.
perform build_text_message.
perform build_receivers.
perform send_mail_nodialog..
Form BUILD_TEXT_MESSAGE
form build_text_message.
maildata-obj_name = 'TEST'.
maildata-obj_descr = 'Test Subject'.
loop at htmllines.
mailtxt = htmllines.
append mailtxt.
endloop.
endform.
Form BUILD_RECEIVERS
form build_receivers.
mailrec-receiver = '[email protected]'.
mailrec-rec_type = 'U'.
append mailrec.
endform.
Form SEND_MAIL_NODIALOG
form send_mail_nodialog.
call function 'SO_NEW_DOCUMENT_SEND_API1'
exporting
document_data = maildata
document_type = 'HTM'
put_in_outbox = 'X'
tables
object_header = mailtxt
object_content = mailtxt
receivers = mailrec
exceptions
too_many_receivers = 1
document_not_sent = 2
document_type_not_exist = 3
operation_no_authorization = 4
parameter_error = 5
x_error = 6
enqueue_error = 7
others = 8.
if sy-subrc 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
endform.
Code Formatted by: Alvaro Tejada Galindo on Jan 11, 2008 3:06 PM
Maybe you are looking for
-
How Many computers can I install the same product on?
For example If I had purchased the creative cloud membership and my computer has been smashed, when I by a new one will I be able to use the creative cloud on that one and install my applications again and again if my computer keeps breaking because
-
when asking siri for directions home it gives us someone elses contact info. How can i change this?
-
Uploading multiple documents using file upload option
Hi, I am new to BSP in file upload.Here i am trying to upload documents and Archiving the documents.At one time i am able to uplaod one document.Is there anyway of uploading of multiple documents from the same File upload control in the same sessio
-
CC&B UI Map: repeating header & page nos.
We are looking at creating a report from a query zone in CC&B. The ask is to replicate a legacy report format which will have a header box at top that will show same information from page to page and also the page nos. at bottom will change. Does any
-
A window doesn't know the window which has createdit.