Exception (colouring cells) in report output based on formula.
Hi Gurus,
I want to colour my cells in report output. But this coloring is not so simple. It has to be done based on a formula.
Lets say i have material in rows and sales value by period in columns.
.......................Jan'08......Feb'08.......Mar'08.....Apr'08
Material A...........100..........120............105.........140
If Feb'08 values is greater than 0,02*Jan'08 value than ---> Feb'08 has to be coloured as green. etc.
Is it possible to define such a rule for the exception?
Thanks
S.P.
Hi Reddy,
I am using bex 7.0.
I tried that also.
I created another formula in columns with name "Difference" and it calculates the difference.
Report looks like as below:
Material.....Jan'08.......Feb'08.....Difference
ABC............100............120.............0,2
Now, I have to colour Feb'08 column, based on the value under Difference column. But it does not work.
In Exception settings; from Definition tab, I selected Difference column (exception is based on).
In Display tab, I select Feb'08 column.
But it does not work.
Any idea?
Thanks
S.P.
Similar Messages
-
Different Report Output based on different tabstrips on selection screen
Hi all,
I have a selection screen which has 3 tabstrips.
The screen nos are 101,102 and 103.
Now in each tab there are different input parameters and based on each tab there will be 3 different outputs.
i.e when I click on tab1 and give the required inputs i will get 1 report output.
similarly I will get different ouput in the other 2 tabs.
Can any one suggest some solution how to achieve this.
Thanks and Regards
Nazmul AzadLook for documentation at [SELECTION-SCREEN - TABBED BLOCK |http://help.sap.com/abapdocu/en/ABAPSELECTION-SCREEN_TABBED.htm]
Adapgt the sample provided, and in the START-OF-SELECTON event add a CASE/WHEN to execute whichever report you want based on mytab-dynnr value.
Regards,
Raymond -
Controlling report output based on current user
Hi all,
I am building a small app with APEX for a sales team.
We have the site and app hosted by another company.
I have built a report showing sales summary for the company. The problem is that the report is showing all sales for all sales people.
What I want is for the report to show data based on the user that is logged in, so that the user only sees his items.
In fact, this would be a useful thing to learn for me, because I could use this functionality on several other pager, so this will be a good example for other situations.
So far I have:
I have a database table that keeps track of the sales reps.
Each sales rep in that table is assigned a unique EMP_id, which is an autonumber column of that table, and is also the primary key.
The table also contains a column named: "User login Name" which is their login ID (the one they use to log into the application.
Possible solution (I think):
when user logs into APEX, retrieve their EMP_id from the EMP table based on their login name,
Hold the EMP_id in a variable for the duration of the session,
pass the variable to the SQL query for the report in the where clause.
Is this a good solution? or is there a better way to do this?
Can anyone advise on how to get this done please,
Thank you.Hi,
Sorry - I guess I should have said where to create the function!
You can keep those steps or keep with your own method as both should return the value you need. I usually store the result of that value in G_USER - similar to Tyson's method - when the user logs in and then use :G_USER wherever I want to use it in filters etc. However, if I need to create SQL Views, I have to use the GETCURRENTUSERID() function instead.
Andy
ps - I used MIN() in the function to ensure that I only get one value returned. The method SELECT .... INTO .... only allows us to set a variable to one value and, sometimes, more than one value is returned by the SELECT statement and this would generate an error. Of course, there should be just the one value that matches the current user, but I always assume the worst! The statementS:
SELECT MIN(EMP_ID) into user_id FROM S_USERS WHERE UPPER(LOGIN_ID) = UPPER(v('APP_USER'));
user_id := CASE WHEN user_id IS NULL THEN 9999999999 ELSE user_id END;could also be written as:
SELECT EMP_ID into user_id FROM S_USERS WHERE UPPER(LOGIN_ID) = UPPER(v('APP_USER')) AND ROWNUM = 1;
user_id := CASE WHEN user_id IS NULL THEN 9999999999 ELSE user_id END;or
SELECT NVL(MIN(EMP_ID), 9999999999) into user_id FROM S_USERS WHERE UPPER(LOGIN_ID) = UPPER(v('APP_USER')); -
Report output order by formula column value? pls.urgent
hi.
i have one query select empno,ename, sal from emp. in report layout i created a formula column named as net_sal(in which am doing some calculation based on some criteria). now i want to print the report order by net_sal desc.
how can i solve it? since the calculation is being done on runtime only/
pls. help me. urgentPuedes hacer lo sigte.:
En el SQL QUERY STAMENT
select empno, ename, sal, :net_sal
from emp
order by 4 asc/desc -
Dynamically Colour Cells in an Interactive Report
My application requires an interactive report where cells are colour coded and the cell may, or may not have a value, but the value doesn't relate to the colour.
The report is based on a view which returns a result set as follows:
rn col1_value col1_colour col2_value col2_colour col3_value col3_colour col4_value col4_colour
1 null grey 3 null null null null red
2 null null 3 grey null null 4 red
3 null grey null null 3 null null redIn the results, each cell to be displayed has two columns per row, one with the colour and one with the value to display where null is the default colour (white)/no value.
In Apex 4.1 I can set the colour based on the values using the dynamic actions on the report display, but I can't work out how to set the colour of col1_value based on the results of col1_colour. I am hoping there is a way to set the colour of the cell col1_value and hide col1_colour from the report.
If you know of any posts providing an example of how this may work, or if you are able to explain it to me I would really appreciate your time.
I appreciate it may not be simple to see what I am aiming for given the text restriction and no images/tables available on the forum, hopefully you get the idea, but if not, ask and I will try and explain further.
I have seen Blog posts about 3-4 years old on how you do this in Apex 3.0 or older, but can't work out how to get this to work in Apex 4.0 or Apex 4.1.I have solved this using Javascript in a Dynamic Action, javascript something like:
$("td[headers='COL1_COLOUR']").each(function(){
switch($(this).text())
case "grey":
$(this).parent().children("td[headers='COL1_VALUE']").css({"background-color":"#999"});
break;
case "green":
$(this).parent().children("td[headers='COL1_VALUE']").css({"background-color":"green"});
break;
case "blue":
$(this).parent().children("td[headers='COL1_VALUE']").css({"background-color":"blue"});
break;
case "orange":
$(this).parent().children("td[headers='COL1_VALUE']").css({"background-color":"orange"});
break;
case "yellow":
$(this).parent().children("td[headers='COL1_VALUE']").css({"background-color":"yellow"});
break;
default:
break;
$(this).css({"visibility":"hidden"});
$("th[id='COL1_COLOUR']").css({"visibility":"hidden"});
}); -
Hi, I'm writing a report that produces approximately 15000 pages of output. When running the report on the server, it fails with the error "Memory failure - core dumped". I believe that it is due to the size of the output (~20mb).
Is there a way to split the report output based on the number of records? I've investigated distribution (both in the report builder and using the 9i .xml distribution) and can't seem to find an adequate solution.
Any comments/suggestions would be greatly appreciated.
Ta.
Nick.Nicholas,
I am sure that you will find a better answer of the Reports forum here on OTN, but what about using the bursting output feature in Reports (since 9i). E.g. if you have data that can be separated by a mster record (like departments) you can print the data for each master record in a separate file.
Maybe this is a known issue that I am not aware of, but this is what the folks on the Reports forum can tell you.
Frank -
Hi, I'm writing a report that produces approximately 15000 pages of output. When running the report on the server, it fails with the error "Memory failure - core dumped". I believe that it is due to the size of the output (~20mb).
Is there a way to split the report output based on the number of records? I've investigated distribution (both in the report builder and using the 9i .xml distribution) and can't seem to find an adequate solution.
Any comments/suggestions would be greatly appreciated.
Ta.
Nick.Hi Nick,
What is the problem you see with distribution? I think it can be a valid solution. The only difference is that distribution cuts the report output based on a logical grouping (eg, different departments), while you want the report to be cut based on file size or number of records.
If you don't have alogical grouping, is it not possible for you to define a "dummy" grouping, eg, employee numbers 10,000 to 20,000 = group 1
employee numbers 20,000 to 30,000 = group 2
and so on?
Navneet. -
Add Journal Entries Report - Output to Request Set
Hi All,
I'm trying to create a Request Set for the receivable application
The request set should contains two Programs
1- AR: Journal Entries Report
2- Journal Entries Report - Output
I defined the request set and when i start adding the programs , i selected the first program AR: Journal Entries Report from the list and gave it sequence 10
when i tried to add the other Report "Journal Entries Report - output" i didn't find it in the list and i'm not able to add it
1-Do any one know why this program doesn't appeat in the list ?
2- If i created a copy of this program and gave it other name , this program in the definition doesn't have any parameters although a parameters must be passed to it from the first request AR : Journal Entries report. how to pass parameters from the first program to it
Best Regardsnuppara,
I need to add this report to the request set as it's a workaround to get the output of the AR: Journal Entries Report as Excel - I created a post asking this question also , u already replied to it.
My workaround is like this , the AR: journal Entries Report automatically sumbit the program "Journal Entries Report - Output" based on the parameters that the user select
Print Detail By Account , Print Detail By Category , Print Summary By Account , Print Summary By Category
if i want to to make this report to be an Excel output so i'll have to create 4 templates but won't be able to assign the correct template to it , as the main request AR: journal Entries report calls it automaticcaly, and may run it 4 times
so my workaround was like this
i'll create 4 request sets ,
the first RS will be for example AR: journal Entries Detail By Account, i'll add to it 2 programs the AR: journal Entries Report , and the Journal Entry Report - output -OR a program copied from it with the same design and i'll add parameters to it-
i'll force the parameters of the AR: Journal Entries in this request set to be Print Detail By Account = 'Y' and the other options = 'N' so the report will call Journal Entry Report - output with the parmeter layout= 'Print Detail By Account ' will be displayed as text ... when it finish the request set will run the Journal Entry Report - output -OR the copied program - that i'll assign the correct template and data definition for it, so it'll run and display the output as Excel .
I need to try this solution, but i was not able to add the journal Entries Report - Output to the request set :( and i'm not sure if i'll create a copy from it will be added or not,
and also i'm not sure if this workaround may work , as i know when the AR: Journal Entires report complete it delete the data from the temp table so the 2nd request may work on an empty table , or it'll have a request_id different from the request_id of the temp table so it won't select any row
all of this is just a brain storming to find the solution. :( i'm thinking by a loud voice here :-D
i know it may not work but at least to try it i need to add this report to the request set. -
Hi All!
is it possible to get the report output in HTML based output?
if yes, can anyone send me the details?
thanks in advance
AlankaarHi,
Yes it is possible to do that.
You can go thru the program below. Hope it could help you.
REPORT ZSS_CODE_2_HTML LINE-SIZE 300 .
TABLES: D010INC.
Tabelle für die aufzunehmenden ABAP-Texte
DATA: BEGIN OF SOURCECODE OCCURS 0,
LINE(200),
END OF SOURCECODE.
Tabelle für den erzeugten HTMLCode
DATA: BEGIN OF HTMLCODE OCCURS 5000,
LINE(256),
END OF HTMLCODE.
DATA: BEGIN OF INCLUDETAB OCCURS 0,
NAME LIKE D010INC-INCLUDE,
END OF INCLUDETAB.
DATA: TEXTELEMENTETAB LIKE TEXTPOOL OCCURS 50 WITH HEADER LINE.
DATA: EINRUECK TYPE I, " Soweit im HTML einrücken
CHAR2(2).
Selektionsbild und Verarbeitung -
SELECTION-SCREEN BEGIN OF BLOCK BL1 WITH FRAME.
PARAMETERS: PROGNAME LIKE D010SINF-PROG
DEFAULT 'ZSS_CODE_2_HTML'.
PARAMETERS: HTMLFILE LIKE RLGRAP-FILENAME
DEFAULT 'c: emp est.html'.
PARAMETERS: MITINCLD AS CHECKBOX DEFAULT 'X',
MITTEXTL AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK BL1.
SELECTION-SCREEN BEGIN OF BLOCK BL2 WITH FRAME.
PARAMETERS: MITZEILE AS CHECKBOX DEFAULT 'X',
ONSCREEN AS CHECKBOX DEFAULT 'X',
SAPINCLD AS CHECKBOX DEFAULT 'X'.
SELECTION-SCREEN END OF BLOCK BL2.
Ein subtrivialer Tests
AT SELECTION-SCREEN.
READ REPORT PROGNAME INTO SOURCECODE.
IF SY-SUBRC <> 0.
MESSAGE E159(AT) WITH 'Programm konnte nicht eingelesen werden'.
ENDIF.
Programmanfang -
END-OF-SELECTION.
In der Tabelle sourcecode sollte hier schon der Quelltext stehen.
PERFORM ERZEUGE_KOPF.
PERFORM WRITE_SOURCE.
Includes falls erwünscht
IF MITINCLD = 'X'.
PERFORM WRITE_INCLUDES.
ENDIF.
Textelemente falls erwünscht
Includes falls erwünscht
IF MITTEXTL = 'X'.
PERFORM WRITE_TEXTELEMENTE.
ENDIF.
Und abschließen des Files
PERFORM ERZEUGE_SCHWANZ.
PERFORM ABSPEICHERN TABLES HTMLCODE
USING HTMLFILE.
Unterroutinen -
INCLUDE ZCD_SS_DEBUGROUTINEN.
FORM ABSPEICHERN *
--> FILENAME *
FORM ABSPEICHERN TABLES TEXT_ZU_SCHREIBEN
USING FILENAME LIKE RLGRAP-FILENAME.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
CODEPAGE = 'IBM'
FILENAME = HTMLFILE
FILETYPE = 'ASC'
MODE = ' '
TABLES
DATA_TAB = TEXT_ZU_SCHREIBEN
EXCEPTIONS
FILE_OPEN_ERROR = 1
FILE_WRITE_ERROR = 2
INVALID_FILESIZE = 3
INVALID_TABLE_WIDTH = 4
INVALID_TYPE = 5
NO_BATCH = 6
UNKNOWN_ERROR = 7
GUI_REFUSE_FILETRANSFER = 8
OTHERS = 9.
IF ONSCREEN = 'X'.
LOOP AT TEXT_ZU_SCHREIBEN.
PERFORM SHOW_ANY_STRUC USING TEXT_ZU_SCHREIBEN.NEW-LINE.
ENDLOOP.
ENDIF.
ENDFORM.
*& Form ERZEUGE_KOPF
Erzeugt einen HTML-Rumpf bis zum Body
FORM ERZEUGE_KOPF.
HTMLCODE-LINE = ''.APPEND HTMLCODE.
HTMLCODE-LINE = ' '.APPEND HTMLCODE.
HTMLCODE-LINE = '
CLEAR HTMLCODE-LINE.
HTMLCODE-LINE+3 = PROGNAME.APPEND HTMLCODE.
HTMLCODE-LINE = ' '.APPEND HTMLCODE.
HTMLCODE-LINE = ' '.APPEND HTMLCODE.
CLEAR HTMLCODE-LINE.APPEND HTMLCODE.
HTMLCODE-LINE = ''.APPEND HTMLCODE.
EINRUECK = 2.
ENDFORM. " ERZEUGE_KOPF
*& Form ERZEUGE_SCHWANZ
Erzeugt die abschließenden HTML-Befehle
FORM ERZEUGE_SCHWANZ.
HTMLCODE-LINE = ' </body>'.APPEND HTMLCODE.
HTMLCODE-LINE = '</html>'.APPEND HTMLCODE.
ENDFORM. " ERZEUGE_SCHWANZ
*& Form WRITE_SOURCE
Schreibt den Sourcecode
FORM WRITE_SOURCE.
DATA: ROT.
Erstmal die Überschrift hinstellen
PERFORM ADDZEILE USING '>+' '
PERFORM ZEILEUMB USING '' PROGNAME.
PERFORM ADDZEILE USING '->' '
CLEAR HTMLCODE-LINE.APPEND HTMLCODE.
Link auf Includes
IF MITINCLD = 'X'.
PERFORM ADDZEILE USING '>+' '
PERFORM ZEILEUMB USING '' '[Includes | #Includes]'.
PERFORM ADDZEILE USING '->' '
ENDIF.
Link auf Textelemente
IF MITTEXTL = 'X'.
PERFORM ADDZEILE USING '>+' '
PERFORM ZEILEUMB USING ''
'[Textelemente | #Textelemente]'.
PERFORM ADDZEILE USING '->' '
ENDIF.
Und Linie zum Trennen gegen den Quellcode
PERFORM ADDZEILE USING '>+' ''.
Und jetzt der Quellcode
PERFORM CODELINES.
ENDFORM. " WRITE_SOURCE
*& Form ADDZEILE
Fügt eine Zeile in den HTML-Code ein und korrigiert Einrücktiefe
FORM ADDZEILE USING VALUE(EINRUECKEN) LIKE CHAR2
VALUE(TEXT).
DATA: ER.
ER = EINRUECKEN(1).
IF ER = '+'.
EINRUECK = EINRUECK + 1.
ELSEIF ER = '-'.
EINRUECK = EINRUECK - 1.
ENDIF.
CLEAR HTMLCODE.
HTMLCODE+EINRUECK = TEXT.
APPEND HTMLCODE.
ER = EINRUECKEN+1(1).
IF ER = '+'.
EINRUECK = EINRUECK + 1.
ELSEIF ER = '-'.
EINRUECK = EINRUECK - 1.
ENDIF.
ENDFORM. " ADDZEILE
*& Form SONDERZEICHEN
Sonderzeichen in HTML darstellen
FORM SONDERZEICHEN CHANGING ZEILE.
DATA: S LIKE SY-SUBRC,
LASTHIT LIKE SY-FDPOS,
DUMMY(256).
LASTHIT = 0.
DO.
DUMMY = ZEILE+LASTHIT.
IF DUMMY CA '&'.
REPLACE '&' WITH '&' INTO DUMMY.
ZEILE+LASTHIT = DUMMY.
LASTHIT = SY-FDPOS + LASTHIT + 1.
ELSE.
EXIT.
ENDIF.
ENDDO.
ÄÖÜäöüß<>"
DO.
S = 1.
REPLACE 'Ä' WITH 'Ä' INTO ZEILE. S = S * SY-SUBRC / 4.
REPLACE 'Ö' WITH 'Ö' INTO ZEILE. S = S * SY-SUBRC / 4.
REPLACE 'Ü' WITH 'Ü' INTO ZEILE. S = S * SY-SUBRC / 4.
REPLACE 'ä' WITH 'ä' INTO ZEILE. S = S * SY-SUBRC / 4.
REPLACE 'ö' WITH 'ö' INTO ZEILE. S = S * SY-SUBRC / 4.
REPLACE 'ü' WITH 'ü' INTO ZEILE. S = S * SY-SUBRC / 4.
REPLACE 'ß' WITH 'ß' INTO ZEILE. S = S * SY-SUBRC / 4.
REPLACE '<' WITH '<' INTO ZEILE. S = S * SY-SUBRC / 4.
REPLACE '>' WITH '>' INTO ZEILE. S = S * SY-SUBRC / 4.
REPLACE '"' WITH '"' INTO ZEILE. S = S * SY-SUBRC / 4.
IF S = 1.EXIT.ENDIF.
ENDDO.
ENDFORM. " SONDERZEICHEN
*& Form ZEILEUMB
text
FORM ZEILEUMB USING VALUE(EINRUECKEN) LIKE CHAR2
VALUE(TEXT).
CONCATENATE TEXT '
' INTO TEXT.
PERFORM ADDZEILE USING EINRUECKEN TEXT.
ENDFORM. " ZEILEUMB
*& Form CODELINES
Schiebt die Zeilen aus sourcecode ins HTML-Format
FORM CODELINES.
DATA ZEILE(5).
PERFORM ADDZEILE USING '>+' '
LOOP AT SOURCECODE.
Erst mal die Sonderzeichen ersetzen
PERFORM SONDERZEICHEN CHANGING SOURCECODE-LINE.
Bei einem Kommentar diesen Rot und kursiv darstellen
IF SOURCECODE-LINE(1) = '*'. " roter Kommentar
CONCATENATE '+'
SOURCECODE-LINE
'+'
INTO SOURCECODE-LINE.
ENDIF.
Bei Zeilennummerierung diese in dunkelblau dazustellen
IF MITZEILE = 'X'.
ZEILE = SY-TABIX.
SHIFT SOURCECODE-LINE RIGHT BY 35 PLACES.
CONCATENATE ''
ZEILE
INTO SOURCECODE-LINE(35).
ENDIF.
PERFORM ADDZEILE USING '' SOURCECODE-LINE.
ENDLOOP.
PERFORM ADDZEILE USING '->' '
ENDFORM. " CODELINES
*& Form WRITE_INCLUDES
Die ganzen Includesources anfügen
FORM WRITE_INCLUDES.
DATA: FIRSTTIME.
FIRSTTIME = 'X'.
SELECT * FROM D010INC WHERE MASTER = PROGNAME.
IF SAPINCLD = 'X'
AND D010INC-INCLUDE(1) = '<'.
CONTINUE.
ENDIF.
IF FIRSTTIME = 'X'.
PERFORM ADD_INCLUDES_HEADER.
CLEAR FIRSTTIME.
ENDIF.
Die Namen der Includes merken und nacher am Anfang in den Quellcode
als Navigationspunkte hinzufügen
APPEND D010INC-INCLUDE TO INCLUDETAB.
Namen und Quelltext schreiben
PERFORM ADD_INCLUDE_NAME USING D010INC.
READ REPORT D010INC-INCLUDE INTO SOURCECODE.
PERFORM CODELINES.
ENDSELECT.
ENDFORM. " WRITE_INCLUDES
*& Form ADD_INCLUDES_HEADER
Für den 1. Include eine kleine Sonderbehandlung
FORM ADD_INCLUDES_HEADER.
HTMLCODE-LINE = ''. APPEND HTMLCODE.
ENDFORM. " ADD_INCLUDES_HEADER
FORM ADD_INCLUDE_NAME *
--> UEBERGABE *
FORM ADD_INCLUDE_NAME USING UEBERGABE LIKE D010INC.
HTMLCODE-LINE = ' '. APPEND HTMLCODE.
ENDFORM. " ADD_INCLUDE_NAME
*& Form WRITE_TEXTELEMENTE
Textelemente des Hauptprogramms auch noch ausgeben
FORM WRITE_TEXTELEMENTE.
PERFORM TEXTELEMENTE_HEADER.
READ TEXTPOOL PROGNAME INTO TEXTELEMENTETAB.
PERFORM HTML_TEXTELEMENTE USING 'im Hauptprogramm'.
LOOP AT INCLUDETAB.
READ TEXTPOOL INCLUDETAB-NAME INTO TEXTELEMENTETAB.
CHECK SY-SUBRC = 0.
PERFORM HTML_TEXTELEMENTE USING INCLUDETAB-NAME.
ENDLOOP.
ENDFORM. " WRITE_TEXTELEMENTE
*& Form TEXTELEMENTE_HEADER
FORM TEXTELEMENTE_HEADER.
HTMLCODE-LINE = ''. APPEND HTMLCODE.
ENDFORM. " TEXTELEMENTE_HEADER
*& Form HTML_TEXTELEMENTE
text
FORM HTML_TEXTELEMENTE USING WOHER.
DATA: WOHERNAME(80),
TID(80),
TKEY(80),
TENTRY(80).
WOHERNAME = WOHER.
PERFORM SONDERZEICHEN CHANGING WOHERNAME.
Das Ganze als Tabelle rauswerfen
HTMLCODE-LINE = '
'.APPEND HTMLCODE.
CONCATENATE '
' WOHERNAME '' INTO HTMLCODE-LINE.APPEND HTMLCODE.
HTMLCODE-LINE = '
'.APPEND HTMLCODE.
LOOP AT TEXTELEMENTETAB.
TID = TEXTELEMENTETAB-ID.
TKEY = TEXTELEMENTETAB-KEY.
TENTRY = TEXTELEMENTETAB-ENTRY.
und HTML-Sonderzeichen ersetzen
PERFORM SONDERZEICHEN CHANGING TID.
PERFORM SONDERZEICHEN CHANGING TKEY.
PERFORM SONDERZEICHEN CHANGING TENTRY.
HTMLCODE-LINE = ''.APPEND HTMLCODE.
CONCATENATE '' INTO HTMLCODE-LINE.
APPEND HTMLCODE.
CONCATENATE '' INTO HTMLCODE-LINE.
APPEND HTMLCODE.
CONCATENATE '' INTO HTMLCODE-LINE.
APPEND HTMLCODE.
HTMLCODE-LINE = ''.APPEND HTMLCODE.
ENDLOOP.
HTMLCODE-LINE = '
' TID '
' TKEY '
' TENTRY '
'.APPEND HTMLCODE.
HTMLCODE-LINE = '
'.APPEND HTMLCODE.
ENDFORM. " HTML_TEXTELEMENTE
Regards
Rakesh -
Color report rows based on a value in that row
I would like to Color report rows based on a value in that row.
For examplle with the "EMP" table:
I would like job=MANAGER to be red and job=CLERK to be green etc etc
The other example I found only had the option of one color either the highlight or the default color.
I am looking for a way to do multiple colors.Hi,
In the row template, you can use #1#, #2#, etc to indicate where a field in the report needs to be output. This does not have to be plain text - ie, you can use it within style tags if you like.
So, take a query like:
SELECT EMPNO,
ENAME,
DEPTNO,
DECODE(DEPTNO, 10, 'green', 20, 'red', 30, 'cyan', 'white') BG_COLOUR
FROM EMPYou get columns 1=empno, 2=ename, 3=deptno and 4=bg_colour. In the row template, you can then do:
Before Rows setting (sets up the table):
<table>
<tr><td>ID</td><td>Name</td><td>Dept</td></tr>After Rows setting (closes the table):
</table>Row Template 1 (used for ALL rows):
<tr style="background-color:#4#;"><td>#1#</td><td>#2#</td><td>#3#</td></tr>Then, for every row, the colour that has been calculated using the DECODE function will be used in the style tag to colour the background for the entire row.
How you determine the colours is up to you. I've used DECODE here, but you could use a field on the DEPT table to hold this and use this in your SQL statement.
Andy -
How to merge cells in report designer
Hello BW Experts,
How to merge cells in report designer.
Thanks in advance
BWerHi BWer,
I had to check for some details from Development.
You also need to have FEP 14 for the BI 7.x tools on SAP GUI 6.40, which was just released on Friday. You can find it at service.sap.com/swdc. In the format menu, you will now see a "Link Cells" option.
With the link cells option, you cannot merge across row patterns. That means that you will probably have to make some changes to your report before you can merge the cells, based on what you described.
I imagine that you started out with a report section something like the following (dashes added for formatting purposes):
G0 Header ...
G1 Header -
Controlling Area
Detail -
Func Area
And then moved controlling area to the right to the same column as functional area:
G0 Header ...
G1 Header -
Controlling Area
Detail -
Func Area
Resulting in an output that would look like:
CA1000
FA ABCA
FA ABCB
FA ABCC
CA2000
FA ABCA
FA ABCB
FA ABCC
As shown above, these cells cannot be merged because they cross row patterns. You would instead need to move the controlling area member down to the same row as functional area:
G0 Header ...
G1 Header
Detail -
Controlling Area Func Area
You can now merge these cells, resulting in an output that would look like the following:
CA1000 FA ABCA
CA1000 FA ABCB
CA1000 FA ABCC
CA2000 FA ABCA
CA2000 FA ABCB
CA2000 FA ABCC
To merge the cells, you would simply highligh both cells with your cursor and then select the option from the menu.
Regards,
Katie -
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. -
ABAP Dump while Changing the Layout fields in Report output - RCOPCA02
Hi,
I Copied the Standard Program RCOPCA02 to ZRCOPCA02. I added two new fields(AUART, AUGRU) in the report output. It is executing correctly with default layout, While Changing the layout for displaying new fields it is dumping.
I am not understanding, What should i do...
Here is the Code.
report ZRCOPCA02 no standard page heading message-id km
line-count (2) line-size 81.
type-pools: slis, ecarc.
DDIC-Tabellen *******************************************************
tables: glpca, "Einzelposten / Ist
glu1, "Übergabestruktur FI-SL-Anzeige
t000,
tka01,
sscrfields,
vbak.
Variablen und int. Tabellen *****************************************
data: l_vbeln like vbak-vbeln,
l_auart like vbak-auart,
l_augru like vbak-augru.
data: afield type slis_fieldcat_alv,
sp_group type slis_sp_group_alv,
t_listheader type slis_t_listheader with header line,
t_layout type slis_layout_alv,
t_fieldcat type slis_t_fieldcat_alv,
t_spec_groups type slis_t_sp_group_alv,
event type slis_alv_event,
t_events type slis_t_event,
g_variant like disvariant,
gx_variant like disvariant,
g_exit(1) type c,
g_save(1) type c,
g_repid like sy-repid,
msgtyp like sy-msgty,
lt_dynpread like dynpread occurs 1 with header line,
ls_rpcak like rpcak, "note 0310592
packsize type i value 1000,
text1(60) type c,
text2(60) type c,
oldkokrs like glpca-kokrs,
oldracct like glpca-racct.
data: whr_size type i value 50,"Maximum of single values per MIC 46a
"charact. in the where-clause of the select-statement
lines type i, "number of lines of range table MIC 46a
cnt_rldnr type i, "Zähler Anzahl selektierter Ledger
cnt_kokrs type i, "Zähler Anzahl selektierter KoReKreise
cnt_poper type i, "Zähler Anzahl selektierter Perioden
cnt_ryear type i, "Zähler Anzahl selektierter GeschJahre
cnt_rvers type i, "Zähler Anzahl selektierter Versionen
cnt_bukrs type i, "Zähler Anzahl selektierter BuKreise
empge like dkobr-empge,
ksl_curr like tka01-pcacur,
hsl_curr like t001-waers,
a_rec like rstirec.
data: begin of dim_data.
include structure rgcdi. "data for dimensions
data: end of dim_data.
data: begin of tab_fields occurs 80,
name like dntab-fieldname, "fields in table i_glpca
end of tab_fields.
data: begin of i_glpca occurs 0.
include structure rpca2.
data: racct_ktext like rpcak-ktext,
psppp like prps-posid,
v_auart like vbak-auart,
v_augru like vbak-augru,
end of i_glpca.
data: rw_subrc like sy-subrc, "Flag: Report-Writer-Schnittstelle
re_subrc like sy-subrc, "Flag: Recherche-Schnittstelle
subrc like sy-subrc.
data: set_id like sethier-setid, "Set-ID "RDI_SETS_4.0
set_class like sethier-setclass, "Setklasse "RDI_SETS_4.0
set_sname like sethier-shortname."Setname (24) "RDI_SETS_4.0
data: authorised(1),
s_message(1),
auth_dbcount like sy-tabix,
Hex-Konstanten für Minimum/Maximum-Werte
begin of hex00,
x1(12) type c,
x2(12) type c,
end of hex00,
begin of hexff,
x1(12) type c,
x2(12) type c,
end of hexff.
ranges rclnt for glpca-rclnt.
field-symbols: type ecarc_glpca_curr.
Selektionsoptionen *************************************************
select-options:
rldnr for glpca-rldnr default '8A' no-display,
rassc for glpca-rassc no-display,
rrcty for glpca-rrcty default 0,
rrcty for glpca-rrcty,
rvers for glpca-rvers default '000',
kokrs for glpca-kokrs memory id cac,
bukrs for glpca-rbukrs memory id buk,
poper for glpca-poper default sy-datlo+4(2),
ryear for glpca-ryear default sy-datlo,
poper for glpca-poper,
ryear for glpca-ryear,
prctr for glpca-rprctr matchcode object prct,
pprctr for glpca-sprctr matchcode object prct,
RACCT FOR GLPCA-RACCT MATCHCODE OBJECT KART, "RD_P30K128304
racct for glpca-racct, "RD_P30K128304
drcrk for glpca-drcrk,
activ for glpca-activ,
rhoart for glpca-rhoart,
rfarea for glpca-rfarea,
stagr for glpca-stagr,
rtcur for glpca-rtcur,
runit for glpca-runit,
versa for glpca-versa no-display,
eprctr for glpca-eprctr no-display,
afabe for glpca-afabe no-display,
rmvct for glpca-rmvct no-display,
hrkft for glpca-hrkft no-display, "note 550972
sbukrs for glpca-sbukrs no-display, "note 550972
shoart for glpca-shoart no-display, "note 550972
sfarea for glpca-sfarea no-display, "note 550972
docct for glpca-docct,
docnr for glpca-docnr,
refdocct for glpca-refdocct,
refdocnr for glpca-refdocnr,
werks for glpca-werks,
repmatnr for glpca-rep_matnr matchcode object pca_shlp_rep_matnr,
rscope for glpca-rscope.
parameters: no_rrint no-display default ' '." skip "MICP40K066037
" report-report-interface
display variant ">>MICP40K039857
selection-screen begin of block 0 with frame title text-e01.
parameters: p_vari like disvariant-variant.
selection-screen comment 47(40) varname for field p_vari.
selection-screen end of block 0.
parameters log_grp(4) type c no-display default 'KE5Z'.
"<<MICP40K039857
ranges: v_racct for glpca-racct,
v_prctr for glpca-rprctr,
v_pprctr for glpca-sprctr.
Tabelle mit Werten aus den Berichts-Set vom Report-Writer *
data begin of val_tab occurs 50.
include structure rgciv.
data end of val_tab.
MICP30K166368
feldkatalog und interface für bb-schnittstelle rw MICP30K166368
MICP30K166368
"MICP30K166368
data begin of bbs_fieldtab occurs 20. "MICP30K166368
include structure rstifields. "MICP30K166368
data end of bbs_fieldtab. "MICP30K166368
archiv
type-pools: rsds.
types: begin of ty_archive_objects,
object like arch_obj-object,
end of ty_archive_objects,
ty_t_archive_objects type ty_archive_objects occurs 2.
constants: lc_set type c value 'X',
lc_report type progname value 'KE5Z',
lc_reporttype type reporttype value 'TR'.
tables: admi_files.
select-options lr_files for admi_files-archiv_key no-display.
parameter: read_db type c default 'X' no-display,
read_ar type c no-display,
arc_obj like arch_obj-object no-display,
read_as type c default 'X' no-display.
data : lt_arch_obj type ty_t_archive_objects with header line,
ls_selections type rsds_frange,
lt_selections type rsds_frange_t,
ls_selopt type rsdsselopt,
lt_glpca_archiv type ecarc_t_glpca_curr.
*********************************************************>>MICP40K039857
INITIALIZATION
initialization.
Diverse Initialisierungen
perform init_vars.
g_repid = sy-repid.
Set default values for record type
rrcty-sign = 'I'.
rrcty-option = 'EQ'.
rrcty-low = '0'.
append rrcty.
rrcty-low = '2'.
append rrcty.
Set default values for period and year (if kokrs or bukrs is known)
get parameter id 'BUK' field bukrs-low.
get parameter id 'CAC' field kokrs-low.
if kokrs-low is initial "get contr. area from company code
and not bukrs-low is initial.
call function 'KOKRS_GET_FROM_BUKRS'
exporting
i_bukrs = bukrs-low
importing
e_kokrs = kokrs-low
exceptions
no_kokrs_found = 1
others = 2.
if sy-subrc <> 0.
clear kokrs-low.
endif.
endif.
if not kokrs-low is initial.
call function 'K_KOKRS_READ' "get fiscal year variant
exporting
kokrs = kokrs-low
importing
e_tka01 = tka01
exceptions
not_found = 1
not_found_gjahr = 2
others = 3.
if sy-subrc = 0.
call function 'G_PERIOD_GET'
exporting
date = sy-datlo
variant = tka01-lmona
importing
period = poper-low
year = ryear-low
exceptions
ledger_not_assigned_to_company = 1
period_not_defined = 2
variant_not_defined = 3
others = 4.
if sy-subrc = 0.
poper-sign = 'I'.
poper-option = 'EQ'.
append poper.
ryear-sign = 'I'.
ryear-option = 'EQ'.
append ryear.
endif.
endif.
endif.
Settings for display variants
g_save = 'A'. "Schalter Varianten benutz./allg. speichern
clear g_variant.
g_variant-report = g_repid.
g_variant-log_group = log_grp.
g_variant-username = sy-uname.
Get default variant
gx_variant = g_variant.
call function 'REUSE_ALV_VARIANT_DEFAULT_GET'
exporting
i_save = g_save
changing
cs_variant = gx_variant
exceptions
not_found = 2.
if sy-subrc = 0.
p_vari = gx_variant-variant.
endif.
Set variant
if p_vari is initial.
p_vari = '1SAP'.
move p_vari to gx_variant-variant.
call function 'REUSE_ALV_VARIANT_EXISTENCE'
exporting
i_save = g_save
changing
cs_variant = gx_variant
exceptions
not_found = 1.
if sy-subrc ne 0.
clear p_vari.
clear gx_variant-variant.
endif.
endif.
varname = gx_variant-text.
"<<MICP40K039857
archiv
call function 'KARL_DATA_INPUT_INIT'
exporting
i_report = lc_report
i_reporttype = lc_reporttype
importing
e_xusedb = read_db
e_xusear = read_ar
e_archobj = arc_obj
e_infosys = read_as
tables
t_arch_sel = lr_files.
data: lt_excluding like sy-ucomm occurs 0 with header line.
call function 'RS_SET_SELSCREEN_STATUS'
exporting
p_status = 'SELSCREEN'
p_program = 'RCOPCA02'
tables
p_exclude = lt_excluding.
Initialisieren der Bericht/Bericht-Schnittstellen *
data: ld_no_rrint type boole_d. "note 490484 begin
import rri = ld_no_rrint from memory id 'RCOPCA02_NO_RRI'.
if ld_no_rrint = 'X'.
free memory id 'RCOPCA02_NO_RRI'.
else. "note 490484 end
call function 'G_REPORT_INTERFACE_INIT' "Report-Writer?
exporting "MICP30K166368
table = 'GLPCT' "MICP30K166368
importing
subrc = rw_subrc "MICP30K166368
tables "MICP30K166368
it_fieldr = bbs_fieldtab. "MICP30K166368
call function 'RSTI_APPL_STACK_POP'"oder Recherche?
importing
i_rec = a_rec
exceptions
appl_stack_not_initialized = 1.
re_subrc = sy-subrc.
if re_subrc = 0.
check Receiver is this report
if not ( ( a_rec-rtool = 'RT' and a_rec-ronam = 'RCOPCA02' )
or ( a_rec-rtool = 'TR' and a_rec-ronam = 'KE5Z' ) ) .
re_subrc = 2.
endif.
endif.
endif.
AT SELCTION-SCREEN on value request**********************************
*at selection-screen on value-request for racct-low. "RD "4.6a
"RD "4.6a
call function 'K_RACCT_VALUE_REQUEST' "RD "4.6a
importing "RD "4.6a
e_racct = racct-low. "RD "4.6a
"RD "4.6a
"RD "4.6a
*at selection-screen on value-request for racct-high. "RD "4.6a
"RD "4.6a
call function 'K_RACCT_VALUE_REQUEST' "RD "4.6a
importing "RD "4.6a
e_racct = racct-high. "RD "4.6a
at selection-screen on value-request for p_vari. "MICP40K039857
perform f4_for_variant. "MICP40K039857
at selection-screen on value-request for poper-low. "RD "4.6a
begin of insertion note 522715
call function 'K_KOKRS_READ'
exporting
kokrs = kokrs-low
exceptions
not_found = 1
not_found_gjahr = 2
others = 3.
if sy-subrc = 0.
end of insertion note 522715
call function 'ECPCA_RPMAX_VALUE_REQUEST' "RD "4.6a
exporting "RD "4.6a
i_kokrs = kokrs-low "RD "4.6a
i_ryear = ryear-low "RD "4.6a
importing "RD "4.6a
e_rpmax = poper-low "RD "4.6a
begin of insertion note 522715
exceptions
table_empty = 1.
endif.
end of insertion note 522715
at selection-screen on value-request for poper-high. "RD "4.6a
begin of insertion note 522715
call function 'K_KOKRS_READ'
exporting
kokrs = kokrs-low
exceptions
not_found = 1
not_found_gjahr = 2
others = 3.
if sy-subrc = 0.
end of insertion note 522715
call function 'ECPCA_RPMAX_VALUE_REQUEST' "RD "4.6a
exporting "RD "4.6a
i_kokrs = kokrs-low "RD "4.6a
i_ryear = ryear-low "RD "4.6a
importing "RD "4.6a
e_rpmax = poper-high "RD "4.6a
begin of insertion note 522715
exceptions
table_empty = 1.
endif.
end of insertion note 522715
AT SELCTION-SCREEN ***************************************************
at selection-screen.
perform pai_of_selection_screen.
begin of insertion note 522715
if not kokrs-low is initial.
call function 'K_KOKRS_READ'
exporting
kokrs = kokrs-low
exceptions
not_found = 1
not_found_gjahr = 2
others = 3.
if sy-subrc <> 0.
message e101(ki) with kokrs-low.
endif.
endif.
end of insertion note 522715
archiv
if sy-ucomm = 'FC01' or sy-ucomm = 'UCDS'
or sy-ucomm = 'ONLI' and read_ar = 'X'
and read_as is initial and lr_files[] is initial.
if lt_arch_obj[] is initial.
lt_arch_obj-object = 'PCA_OBJECT'. append lt_arch_obj.
lt_arch_obj-object = 'EC_PCA_ITM'. append lt_arch_obj.
endif.
call function 'KARL_DATA_INPUT_SELECT'
exporting
i_db_and_arc = lc_set
i_infosys_possible = lc_set
i_object_fixed = 'V'
i_documentation = 'KARL_DATA_INPUT_SEL_KE5YZ'
i_report = lc_report
i_reporttype = lc_reporttype
tables
t_objects = lt_arch_obj
t_arch_sel = lr_files
changing
c_xusedb = read_db
c_xusear = read_ar
c_archobj = arc_obj
c_infosys = read_as.
endif.
START-OF-SELECTION **************************************************
start-of-selection.
Default-Werte löschen, falls Aufruf über Recherche
oder Report-Writer erfolgt ist
if no_rrint is initial and ld_no_rrint is initial. "note 490484
if rw_subrc eq 0 or re_subrc eq 0.
refresh: rldnr, rrcty, rvers, kokrs, bukrs, poper, ryear,
racct, prctr, pprctr, drcrk, activ, rhoart, rfarea,
versa, afabe, eprctr,
v_racct, v_prctr, v_pprctr.
clear: rldnr, rrcty, rvers, kokrs, bukrs, poper, ryear,
racct, prctr, pprctr, drcrk, activ, rhoart, rfarea,
versa, afabe, eprctr,
v_racct, v_prctr, v_pprctr.
endif.
Parameter einlesen über Report-Writer-Schnittstelle *
if rw_subrc eq 0.
perform rw_get_parameters.
oder Parameter einlesen über Recherche-Schnittstelle *
elseif re_subrc eq 0.
perform re_get_parameters.
endif.
endif.
if read_db = 'X'. " read from DB (archiv)
Bewegungsdaten einlesen und puffern...................................
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = 'Einzelposten selektieren'(p10).
Use dirty trick to mislead DB-optimizer
call function 'DB_DO_NOT_USE_CLIENT_INDEX'
exporting
value = sy-mandt
tables
mandttab = rclnt.
select (tab_fields) from glpca
client specified
package size packsize
APPENDING CORRESPONDING FIELDS OF TABLE i_glpcaO
into corresponding fields of table i_glpca
where rldnr in rldnr
and rrcty in rrcty
and rvers in rvers
and kokrs in kokrs
and rbukrs in bukrs
and ryear in ryear
and rassc in rassc
and hrkft in hrkft "note 550972
and sbukrs in sbukrs "note 550972
and shoart in shoart "note 550972
and sfarea in sfarea "note 550972
and racct in racct
and rprctr in prctr
and sprctr in pprctr
and poper in poper
and drcrk in drcrk
and activ in activ
and rhoart in rhoart
and rfarea in rfarea
and versa in versa
and eprctr in eprctr
and afabe in afabe
and rmvct in rmvct
and docct in docct
and docnr in docnr
and stagr in stagr
and rtcur in rtcur
and runit in runit
and refdocct in refdocct
and refdocnr in refdocnr
and werks in werks
and rep_matnr in repmatnr "RDIP40K020663
and rscope in rscope "RDIP40K020663
and rclnt in rclnt. "dirty trick to mislead DB-optimizer
if sy-dbcnt > 1.
text1 = sy-dbcnt.
condense text1.
concatenate text1 text-m01 into text2 separated by space.
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = text2. " ... Datensätze gelesen
endif.
endselect.
Entfernt nicht zugehörige Einträge....................................
loop at i_glpca where ( not rprctr in v_prctr )
or ( not sprctr in v_pprctr )
or ( not racct in v_racct ).
delete i_glpca.
endloop.
endif.
*archiv
if read_ar = 'X' and not
( read_as is initial and lr_files[] is initial ).
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = 'Lesen im Archiv'(p12).
define fill_lt_selections.
if not &2[] is initial.
clear ls_selections.
move &1 to ls_selections-fieldname.
loop at &2.
clear ls_selopt.
move-corresponding &2 to ls_selopt.
append ls_selopt to ls_selections-selopt_t.
endloop.
append ls_selections to lt_selections.
endif.
end-of-definition.
fill_lt_selections 'RLDNR' rldnr.
fill_lt_selections 'RRCTY' rrcty.
fill_lt_selections 'RVERS' rvers.
fill_lt_selections 'KOKRS' kokrs.
fill_lt_selections 'RBUKRS' bukrs.
fill_lt_selections 'POPER' poper.
fill_lt_selections 'RYEAR' ryear.
fill_lt_selections 'RPRCTR' prctr.
fill_lt_selections 'SPRCTR' pprctr.
fill_lt_selections 'RACCT' racct.
fill_lt_selections 'DRCRK' drcrk.
fill_lt_selections 'ACTIV' activ.
fill_lt_selections 'RHOART' rhoart.
fill_lt_selections 'RFAREA' rfarea. "note 401961
fill_lt_selections 'STAGR' stagr.
fill_lt_selections 'RTCUR' rtcur.
fill_lt_selections 'RUNIT' runit.
fill_lt_selections 'VERSA' versa.
fill_lt_selections 'EPRCTR' eprctr.
fill_lt_selections 'AFABE' afabe.
fill_lt_selections 'RMVCT' rmvct.
fill_lt_selections 'DOCCT' docct.
fill_lt_selections 'DOCNR' docnr.
fill_lt_selections 'REFDOCCT' refdocct.
fill_lt_selections 'REFDOCNR' refdocnr.
fill_lt_selections 'WERKS' werks.
fill_lt_selections 'REP_MATNR' repmatnr.
fill_lt_selections 'RSCOPE' rscope.
fill_lt_selections 'HRKFT' hrkft. "note 550972
fill_lt_selections 'SBUKRS' sbukrs. "note 550972
fill_lt_selections 'SHOART' shoart. "note 550972
fill_lt_selections 'SFAREA' sfarea. "note 550972
call function 'EC_PCA_SELECT_FROM_ARCHIVE'
exporting
i_selections = lt_selections[]
i_files_sequential_read = lr_files[]
importing
e_glpca = lt_glpca_archiv[]
exceptions
no_infostruc_found = 1.
if sy-subrc = 1.
message id sy-msgid type 'I' number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.
clear i_glpca.
loop at lt_glpca_archiv assigning to i_glpca.
append i_glpca.
endloop.
endif.
if i_glpca[] is initial. "Info,nichts gefunden
message s000.
exit.
endif.
get texts for accounts ...............................................
sort i_glpca by kokrs racct.
loop at i_glpca assigning -racct_ktext = ls_rpcak-ktext.
endloop.
Liste mit Einzelposten geeignet sortieren.............................
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = 'Einzelposten sortieren'(p30).
if show_ref is initial.
sort i_glpca by rldnr ryear rbukrs rrcty rvers
docct docnr docln.
else.
sort i_glpca by rldnr kokrs ryear rbukrs rrcty rvers poper
refdocct refdocnr refdocln.
endif.
Berechtigungsprüfung und gemerkte Belege aufbereiten .................
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = 'Berechtigungsprüfungen'(p40).
clear: cnt_rldnr, cnt_kokrs, cnt_ryear, cnt_rvers, cnt_bukrs.
loop at i_glpca assigning .
Berechtigungscheck
perform check_repo_authority changing authorised.
if authorised is initial.
delete i_glpca.
s_message = 'X'.
zählen der Sätze ohne Berechtigung
auth_dbcount = auth_dbcount + 1.
else. "Weitere Bearbeitung nur für berechtigte Belege...
Zusätzlich merken der Anzahl der Ausprägungen
bestimmter Dimensionen
on change of -rbukrs
ct = '10'
importing
currency = hsl_curr.
endon.
externe Immobilienbezeichnung "ww/kb
on change of i_glpca-imkey.
if ( not -dabrz
I_length = 20
importing
e_empge = -konty.
endif.
CONCATENATE I_GLPCA-KONTY I_GLPCA-EMPGE INTO I_GLPCA-IMBEZ.
endif.
endon.
on change of i_glpca-dabrz.
call function 'REMD_IMKEY_TO_EMPGE'
exporting
i_imkey = i_glpca-imkey
i_dabrz = i_glpca-dabrz
i_length = 20
importing
e_empge = i_glpca-empge
e_konty = i_glpca-konty.
CONCATENATE I_GLPCA-KONTY I_GLPCA-EMPGE INTO I_GLPCA-IMBEZ.
endon.
Konvertierungsproblem mit PSP-Nummer bereinigen
if not -psppp.
endif.
endif.
Währungen in Hilfsfeldern speichern
if -ksl_curr = ksl_curr.
endif.
modify i_glpca.
endif.
endloop.
Nachricht, wenn nicht alle Einzelposten angezeigt werden.
if not s_message is initial.
message s407(km) with auth_dbcount.
endif.
EP ausgeben...........................................................
call function 'SAPGUI_PROGRESS_INDICATOR'
exporting
text = 'Einzelposten ausgeben'(p50).
t_layout-detail_initial_lines = 'X'.
t_layout-detail_popup = 'X'.
t_layout-f2code = 'PIC1'. "MICP40K039857
t_layout-get_selinfos = 'X'.
t_layout-group_change_edit = 'X'. "note 576149
perform fill_listheader.
perform fieldcat_fill.
perform spec_groups_fill.
perform events_fill. "MICP40K039857
">>MICP40K039857
call function 'K_KKB_LIST_DISPLAY'
exporting
i_callback_program = 'RCOPCA02'
i_callback_user_command = 'USR_CMD'
i_callback_top_of_page = 'TOP_OF_PAGE'
I_CALLBACK_END_OF_PAGE =
I_CALLBACK_END_OF_LIST =
i_callback_pf_status_set = 'SET_PF_STATUS'
I_CALLBACK_LAYOUT_SAVE =
I_CALLBACK_FIELDCAT_SAVE =
i_tabname = 'I_GLPCA'
is_layout = t_layout
it_fieldcat = t_fieldcat
I_FCTYPE = 'R'
IT_EXCLUDING =
it_special_groups = t_spec_groups
IT_SORT =
IS_SEL_HIDE =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
tables
t_outtab = i_glpca
exceptions
others = 1.
loop at i_glpca.
select single vbeln auart augru
into (l_vbeln, l_auart, l_augru)
from vbak where vbeln = i_glpca-aubel.
if sy-subrc = 0.
move l_auart to i_glpca-v_auart.
move l_augru to i_glpca-v_augru.
modify i_glpca.
endif.
endloop.
call function 'REUSE_ALV_GRID_DISPLAY'
CALL FUNCTION 'REUSE_ALV_LIST_DISPLAY'
exporting
I_INTERFACE_CHECK = ' '
i_callback_program = 'ZRCOPCA02'
i_callback_pf_status_set = 'SET_PF_STATUS'
i_callback_user_command = 'USR_CMD'
i_structure_name = 'I_GLPCA'
is_layout = t_layout
it_fieldcat = t_fieldcat
IT_EXCLUDING =
it_special_groups = t_spec_groups
IT_SORT =
IT_FILTER =
IS_SEL_HIDE =
i_default = 'X'
i_save = g_save
is_variant = g_variant
it_events = t_events
IT_EVENT_EXIT =
IS_PRINT =
I_SCREEN_START_COLUMN = 0
I_SCREEN_START_LINE = 0
I_SCREEN_END_COLUMN = 0
I_SCREEN_END_LINE = 0
IMPORTING
E_EXIT_CAUSED_BY_CALLER =
ES_EXIT_CAUSED_BY_USER =
tables
t_outtab = i_glpca
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.
"<<MICP40K039857
clear i_glpca.
*& Form CHECK_REPO_AUTHORITY
Check only new auth-object K_PCA *
--> p1 text
<-- p2 text
form check_repo_authority changing authorized like authorised.
fill structure for userexit in K_PCA_RESP_AUTHORITY_CHECK
data: auth like pca_i_auth. "46a MIC check K_PCA and G_GLTP
auth-bukrs = -rrcty.
clear authorized.
check PrCtr/account/activity
call function 'K_PCA_RESP_AUTHORITY_CHECK'
exporting
i_kokrs = -racct
i_vorgn = 'REPP'
i_actvt = '28'
i_auth = auth
i_no_dialog_message = 'X'
exceptions
no_authority = 1
data_missing = 2
others = 3.
if sy-subrc = 0. "ok
check ledger/version/record type
call function 'PCA_G_GLTP_AUTH_CHECK'
exporting
rldnr = -rrcty
exceptions
no_authorisation = 1
others = 2.
if sy-subrc = 0. "ok, User is authorized
authorized = 'X'.
endif.
endif.
endform. " CHECK_REPO_AUTHORITY
*& Form INIT_VARS
Initialisieren diverser Hilfsvariablen und -tabellen *
form init_vars.
data begin of nametab occurs 80. "Tabelle mit Feldern aus der RPCA2
include structure dntab.
data end of nametab.
select single * from t000
client specified
where mandt = sy-mandt.
refresh nametab.
call function 'NAMETAB_GET'
exporting
only = 'T'
tabname = 'RPCA2'
tables
nametab = nametab.
Übernehmen der Feldnamen, die auch in der GLPCA
vorkommen.
loop at nametab where fieldname ne 'KSL_CURR'
and fieldname ne 'HSL_CURR'
and fieldname ne 'EMPGE' "ww/kb
and fieldname ne 'KONTY'. "ww/kb
move nametab-fieldname to tab_fields-name.
append tab_fields.
endloop.
fill Fields of receiver for BBS "MIC46C
call function 'RSTI_REPORT_FIELDS_FIND'
exporting
e_repid = 'RCOPCA02'
e_type = 'R'
tables
it_fields = bbs_fieldtab.
correct fieldnames
read table bbs_fieldtab with key rfield = 'PRCTR'.
if sy-subrc = 0.
bbs_fieldtab-rfield = 'RPRCTR'.
modify bbs_fieldtab index sy-tabix.
endif.
read table bbs_fieldtab with key rfield = 'PPRCTR'.
if sy-subrc = 0.
bbs_fieldtab-rfield = 'SPRCTR'.
modify bbs_fieldtab index sy-tabix.
endif.
read table bbs_fieldtab with key rfield = 'BUKRS'.
if sy-subrc = 0.
bbs_fieldtab-rfield = 'RBUKRS'.
modify bbs_fieldtab index sy-tabix.
endif.
Unicode
class cl_abap_char_utilities definition load.
clear hex00 with cl_abap_char_utilities=>minchar.
clear hexff with cl_abap_char_utilities=>maxchar.
endform. " INIT_VARS
FORM FILL_LISTHEADER *
List-Header in Abhängigkeit der selektierten Daten *
form fill_listheader.
read table i_glpca index 1.
if sy-subrc ne 0.
exit.
endif.
t_listheader-typ = 'S'.
t_listheader-key = 'Ledger '(h01).
if cnt_rldnr <= 1.
t_listheader-info = i_glpca-rldnr.
else.
t_listheader-info = '*'.
endif.
append t_listheader.
t_listheader-typ = 'S'.
t_listheader-key = 'Kostenrechnungskreis'(h02).
if cnt_kokrs <= 1.
t_listheader-info = i_glpca-kokrs.
else.
t_listheader-info = '*'.
endif.
append t_listheader.
t_listheader-typ = 'S'.
t_listheader-key = 'Buchungskreis '(h03).
if cnt_bukrs <= 1.
t_listheader-info = i_glpca-rbukrs.
else.
t_listheader-info = '*'.
endif.
append t_listheader.
t_listheader-typ = 'S'.
t_listheader-key = 'Buchungsperiode '(h04).
if cnt_poper <= 1.
t_listheader-info = i_glpca-poper.
else.
t_listheader-info = '*'.
endif.
append t_listheader.
if cnt_ryear <= 1.
t_listheader-typ = 'S'.
t_listheader-key = 'Geschäftsjahr '(h05).
t_listheader-info = i_glpca-ryear.
append t_listheader.
endif.
t_listheader-typ = 'S'.
t_listheader-key = 'Version '(h06).
if cnt_rvers <= 1.
t_listheader-info = i_glpca-rvers.
else.
t_listheader-info = '*'.
endif.
append t_listheader.
endform. "fill_listheader
*& Form FIELDCAT_FILL
*& Aufbau des Feldkataloges für den K_KKB_LIST_DISPLAY, *
*& bzw REUSE_ALV_LIST_DISPLAY, *
*& weitere Infos enthält die FktBaustein-Doku *
form fieldcat_fill.
data: i type i value 0.
refresh t_fieldcat.
Ledger
if cnt_rldnr > 1.
add 1 to i.
clear afield.
afield-col_pos = i.
afield-fieldname = 'RLDNR'.
afield-no_sum = 'X'.
afield-no_out = 'X'.
afield-key = 'X'.
afield-ref_tabname = 'GLPCA'.
afield-sp_group = '1'.
append afield to t_fieldcat.
endif.
Satzart
add 1 to i.
clear afield.
afield-col_pos = i.
afield-fieldname = 'RRCTY'.
afield-no_sum = 'X'.
afield-ref_tabname = 'GLPCA'.
afield-no_out = 'X'.
afield-sp_group = '1'.
append afield to t_fieldcat.
Version
if cnt_rvers > 1.
add 1 to i.
clear afield.
afield-col_pos = i.
afield-fieldname = 'RVERS'.
afield-no_sum = 'X'.
afield-ref_tabname = 'GLPCA'.
afield-no_out = 'X'.
afield-sp_group = '1'.
append afield to t_fieldcat.
endif.
Periode
if cnt_poper > 1.
add 1 to i.
clear afield.
afield-col_pos = i.
afield-fieldname = 'POPER'.
afield-no_sum = 'X'.
afield-ref_tabname = 'GLPCA'.
afield-no_out = 'X'.
afield-sp_group = '1'.
append afield to t_fieldcat.
endif.
Geschäftsjahr
if cnt_ryear > 1.
add 1 to i.
clear afield.
afield-col_pos = i.
afield-fieldname = 'RYEAR'.
afield-no_sum = 'X'.
afield-ref_tabname = 'GLPCA'.
afield-no_out = 'X'.
afield-sp_group = '1'.
append afield to t_fieldcat.
endif.
Referenzbelegtyp
add 1 to i.
clear afield.
afield-col_pos = i.
afield-fieldname = 'REFDOCCT'.
afield-ref_tabname = 'GLPCA'.
afield-key_sel = 'X'.
afield-no_sum = 'X'.
afield-sp_group = '2'.
afield-seltext_s = 'Typ'(t01).
afield-seltext_m = 'Belegtyp'(t02).
afield-seltext_l = 'Ref.Belegtyp'(t03).
afield-outputlen = 3. "Platz für die Sterne der Zwischensummen
if not show_ref is initial.
afield-key = 'X'.
else.
afield-no_out = 'X'.
endif.
append afield to t_fieldcat.
Referenzbelegnummer
add 1 to i.
clear afield.
afield-col_pos = i.
afield-fieldname = 'REFDOCNR'.
afield-ref_tabname = 'GLPCA'.
afield-key_sel = 'X'.
afield-no_sum = 'X'.
afield-sp_group = '2'.
afield-seltext_s = 'Refbeleg'(t04).
afield-seltext_m = 'Refbelegnr'(t05).
afield-seltext_l = 'Ref.Belegnummer'(t06).
if not show_ref is initial.
afield-key = 'X'.
else.
afield-no_out = 'X'.
endif.
appendHi Prabhu,
You are right, problem is with Field Catalog...
When I use FM 'REUSE_ALV_GRID_DISPLAY' it is dumping...
When i tried with FM 'REUSE_ALV_LIST_DISPLAY' it is working perfectly....
how can i use FM 'REUSE_ALV_GRID_DISPLAY' without dumping????
do i need to pass any thing in FM????
Here is the dump:
Runtime Errors MESSAGE_TYPE_X
Occurred on 12/21/2006 at 01:03:24
The current application triggered a termination with a short dump.
What happened?
The current application program detected a situation which really
should not occur. Therefore, a termination with a short dump was
triggered on purpose by the key word MESSAGE (type X).
Error analysis
Short text of error message:
Technical information about the message:
Message classe...... "0K "
Number.............. 000
User, transaction...
Language key........ "E"
Transaction......... "SE38 "
Program............. "SAPLSLVC "
Screen.............. "SAPLSLVC_FULLSCREEN 0500"
Screen line......... 3
Information on where termination occurred
The termination occurred in the ABAP program "SAPLSLVC " in "LINE_OUT_NEW_2".
The main program was "ZRCOPCA02 ".
The termination occurred in line 918 of the source code of the (Include)
program "LSLVCF01 "
of the source code of program "LSLVCF01 " (when calling the editor 9180).
Source code extract
008880 gs_roid-row_id = rs_row-index * -1.
008890 endif.
008900 gs_roid-sub_row_id = rs_row-rowtype+7(10).
008910 gs_poid-row_id = gs_roid-row_id.
008920 gs_poid-sub_row_id = gs_roid-sub_row_id.
008930 gs_poid-rowtype = rs_row-rowtype.
008940 gs_poid-index = rs_row-index.
008950 insert gs_poid into table rt_poid.
008960 endif.
008970 append gs_roid to rt_roid.
008980
008990 loop at rt_fieldcat assigning <ls_fieldcat> where tech ne 'X' and
009000 no_out ne 'X'.
009010
009020 if gflg_invisible = 'X'.
009030 if <ls_fieldcat>-do_sum is initial.
009040 clear gflg_invisible.
009050 continue.
009060 else.
009070 clear g_col_counter.
009080 clear gflg_invisible.
009090 endif.
009100 endif.
009110
009120 clear gs_lvc_data.
009130 clear g_style.
009140
009150 assign component
009160 <ls_fieldcat>-fieldname of structure rt_data to <g_field>.
009170 if sy-subrc ne 0.
> message x000(0k).
009190 endif.
009200
009210 g_col_counter = g_col_counter + 1.
009220
009230 gs_lvc_data-row_pos = r_row_counter.
009240 gs_lvc_data-col_pos = g_col_counter.
009250 gs_lvc_data-row_id = gs_roid-row_id.
009260 gs_lvc_data-sub_row_id = gs_roid-sub_row_id.
009270
009280 * Endtotal and average
009290 if rs_row-rowtype(1) ca 'T' and <ls_fieldcat>-do_sum = 'C'.
009300 * save the actual grouplevel information
009310 gs_grouplevels = rs_grouplevels.
009320 clear g_lines.
009330
009340 * get number of lines of the collect table
009350 describe table rt_data lines g_lines.
009360 * if there is only one line or the field has no references so
009370 * that only the first line has to be considered
Thanks,
fractal
null -
Product for presenting ABAP report output in Dashboard Presentation
<u>Background</u>
Monash University environment is SAP ERP ECC6 - no BW. The University has undertaken considerable analysis of spend as part of developing a strategic approach to procurement. The data used to undertake this analysis was extracted from SAP MM and FI using a developed ABAP report which collates, categorizes and consolidates all spend information from MM (for our Purchase Order based commitment and expenditure) and FI (for direct invoices and Corporate Credit Card expenditure). This information is then currently exported to MS-Excel to produce a report containing graphs, pie charts etc.
<u>Requirement</u>
To present output from our Spend Analysis Report in a more readable dashboard type presentation. This facility should allow easy manipulation (slice and dice) and drill down of the data.. Our requirement is to have something operating within a very short time-frame, say within a month or two. Although you might suggest Web Dynpro Business Graphic or SEM /BW (as the optimal solution) we understand the set up time for either of these solutions is prohibitive. Visual Composer has been suggested as another option but we have no in-house expertise to determine if this is a viable solution.
Some colleagues visited a conference a couple of weeks ago and saw a demonstration of a product call XenoCube http://www.inlogik.com/downloads/XenoCube_Brochure.pdf
which was proposed as a quick way to present SAP 'raw' report output in a more readable form. Other solutions in this space that have been suggested include:-
Zycus - Actionable Spend Analysis Zycus.com
Emptoris Spend Analysis - emptoris.com
ONIQUA Enterprise Analytics oniqua.com.au
Ariba Buyer ariba.com
SAS Spend Analysis sas.com
Etesius SpendGuardian etesius.com
Can anyone provide advice as to their experience of SAP solution, integrated partner products or any of the about products to satisfy a similar requirement to that which I have outlined? The main selection criteria will include a product which is:
a) quick & easy to implement,
b) presentation and manipulation of ABAP extracted data
c) is scalable and
d) is reasonably priced.
Grateful for any advice regarding a solution .
Thank-youHi,
This development writes to mapped network drive in Unix. The concept will be similar.
[http://wiki.sdn.sap.com/wiki/display/SCM/APOtoMappedNetworkDrive]
cheers
Aveek -
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
Maybe you are looking for
-
Firefox directed an upgrade to 3.6.4. Then said must install new Adobe flash. My Mac Processor is 1.2.Ghz (too small. Firefox said that if I didn't have it could damage my computor. It appears that I now have to dump the installed Adobe and then dump
-
Web dynpro screen with multiple rows with columns that can be edited
Web dynpro screen with multiple rows with columns that can be edited individually: Hi I am busy creating a screen in web dynpro for ABAP which we would like to make available via Portal ESS (Portal 7). I need to add 'n type of table (or almost someth
-
How can I import a XML file into pdf doc and how can I retrieve its data as string, in order to populate a drop down List, without using XML Schema Data Connection. Thank you for your time!
-
Redirect to "can't find the i-web page"/file name change
i published a website thru mobileme (http://www.hale-o-lani-aloha.com). when i type my website address in e-mails and check the link, i sometimes got directed to a page that said "we're sorry but we can't find the i-web page you've requested..." (yes
-
Getting 3rd Local curency from New GL to CO-PA
All, As per the requirement we have the following currency scenario for a given company code. New GL has 3 currencies that can be defined in OB22. LC1 = Company Code Currency - Local currency LC2 = Group Currency - USD - Exhcange rate derived from LC