Showing 'potential' records returned
Hi
I'm wondering what is the most efficient way to show the number of records available when a link is clicked on. eg.
Hotels (32)
Lodges (12)
Camping (1)
As you can see from this link
http://www.iknow-yorkshire.co.uk/north_yorkshire/pickering/all_prices/guest_houses/eco_fri endly/
they actually disable links where no records are available. This seems quite complex - they dim/disable links for a variety of categories where a click would render no results.
My question is this: What is the most efficient way of achieving this - query of queries? stored procedures? neither?
Thanks
Shaggy
Thanks
There are so many variables though and permutations, I will have to run quite an extensive query for each link - won't the overhead be very high?
Thinking about the link provided - would it be less overhead to store the number of records available in the database.
So for example, everytime a page is visited it stores the url and the count of the number of records returned in a separate table. Then we retrieve this value through a quick query for each link? is this any better than the solutions provided in terms of efficiency? or is left join count still the way to go?
Similar Messages
-
How to show all records by default on search result page?
Hi
I am trying to make a search page that would execute the search in the database based on one or more field constraints.
(Using MySQL,PHP)
I have 2 columns in the database "vm_ip" (primary key) <IP address>, "Operating_System" <Any, Windows, Solaris, AIX>
need to search vm_ip based on other two fields.
PROBLEM: Need to show all the record when I select "Any" in the Operating_System drop down menu.
<p>Operating System:
<select name="os_select" id="os_select">
<?php
$os_count=1;
foreach($os_type as $value) //(os_type is array with possible values of OS)
echo "<option value=".$os_count.">".$value."</option>";
$os_count++;
?>
<option value=" " selected="selected">Any</option>
</select>
</p>
this code POSts NULL value to the search page.
Below code is of recordset on search page
$varOS_virtual = "Operating_System"; // recordset variable set to same as column name (default value)
if (isset($_POST['os_select'])) //this should not be true
$varOS_virtual = $_POST['os_select'];
mysql_select_db($database_xyz_db, $xyz_db);
$query_virtual = sprintf("SELECT table.VM_IP FROM table
WHERE table.Operating_System=%s", GetSQLValueString($varOS_virtual, "int"));
$virtual = mysql_query($query_virtual, $xyz_db) or die(mysql_error());
$row_virtual = mysql_fetch_assoc($virtual);
$totalRows_virtual = mysql_num_rows($virtual);
I expected the 'os_select' field to be null and default value of Operating_System to be "Operating_System" so that the Query shows all records.
But instead the value being passed in the Query is "0". and no records are shown.
What can I do to show all records?
As probably obvious I am new to php/MySQL so all the help is most welcomed .
ThanksHi
Thanks for the prompt reply but this does not solve my problem.
First thing I appologise for giving you incorrect info. Actually I have many more constraints on the search apart from OS.
Didn't think I would get single constraint specific ans.
Here is what all i tried and problems I faced:
1. I cannot use seperate queries cause I have around 7-8 other constraints on the search.
2. I cannot play around with the Record set code. For some reason even if I mess with it a little bit Dreamweaver stops recognising the recordset. for eg i tried the below code:
$query_virtual = sprintf("SELECT table.VM_IP FROM table WHERE
table.Operating_System=%s ,($_POST['os_select']=="")? TRUE:GetSQLValueString($varOS_virtual, "int"));
this ran well for the first time, and then the record set was screwed up. kept on asking me to "Discover" the links, which it couldn't do.
3. take a look at this code:
$varOS_virtual = "Operating_System";
if (isset($_POST['os_select'])) {
$varOS_virtual = $_POST['os_select'];
$varState_virtual = "State"; //second constraint
if (isset($_POST['state_select'])) {
$varState_virtual = $_POST['state_select'];
mysql_select_db($database_xyz, $xyz);
$query_virtual = sprintf("SELECT table.VM_IP FROM table AND table.Operating_System=%s AND State=%s",
GetSQLValueString($varOS_virtual, "int"),GetSQLValueString($varState_virtual, "int"));
$virtual = mysql_query($query_virtual, $xyz) or die(mysql_error());
$row_virtual = mysql_fetch_assoc($virtual);
$totalRows_virtual = mysql_num_rows($virtual);
here on passing NULL value for "Any" GetSQLValueString($varOS_virtual, "int") functions returns NULL and though the Default value of
varOS is set to 'Operating_System" query takes NULL value only which when executed shows no records.
My problem majorly revolves around how to put something like "WHERE Operating_System= Operating_System" OR "WHERE Operating_System= TRUE" in the query, when passed through variable they are sent as Strings or NULL.
Thats why WHERE 1=1 also doesnt work, because it has "WHERE Operating_System= NULL" in AND.
Logically when NULL is passed default value of variable should comeinto picture, but tha isnt happening.
Thanks again for answering. hope I was able to explain my problem. -
Could not show multiple records while could show only one record
Hi, all
I have an oracle 10g db running on a Linux E3 server.
I have two tables:
CREATE TABLE "IMMUNODATA"."DEMOGRAPHICS" (
"SUBJECTID" INTEGER NOT NULL,
"WORKID" INTEGER,
"OMRFHISTORYNUMBER" INTEGER,
"OTHERID" INTEGER,
"BARCODE" INTEGER,
"GENDER" VARCHAR2(1),
"DOB" DATE,
"RACEAI" INTEGER,
"RACECAUCASIAN" INTEGER,
"RACEAA" INTEGER,
"RACEASIAN" INTEGER,
"RACEPAC" INTEGER,
"RACEHIS" INTEGER,
"RACEOTHER" VARCHAR2(50),
"SSN" VARCHAR2(11),
PRIMARY KEY("SUBJECTID") VALIDATE
CREATE TABLE "IMMUNODATA"."MEDICATION" (
"ID" INTEGER NOT NULL ,
"THEDATE" DATE ,
"SUBJECTID" INTEGER NOT NULL,
"MED_PAGENOTCOMPLETED" VARCHAR2(500) ,
"MEDICATION_NAME" VARCHAR2(100),
"MEDICATION_CLASSIFICATION" VARCHAR2(100),
"MEDICATION_DOSENUM" VARCHAR2(50),
"MEDICATION_DOSEMEASURE" VARCHAR2(100),
"MEDICATION_ROUTE" VARCHAR2(100),
"MEDICATION_FREQ" VARCHAR2(100),
"MEDICATION_BEGIN" DATE,
"MEDICATION_END" DATE,
"BARCODE" INTEGER,
"DATASOURCE" VARCHAR2(50),
"NOCHANGE" INTEGER,
PRIMARY KEY("ID") VALIDATE,
FOREIGN KEY("SUBJECTID") REFERENCES "IMMUNODATA"."DEMOGRAPHICS" ("SUBJECTID") VALIDATE
I want to show an output to combine all medication records of one person into one, and I created a function.
CREATE OR REPLACE FUNCTION COMMEDICATION(p_subjectid IN immunodata.medication.subjectid%TYPE ) RETURN VARCHAR2 IS
v_medication VARCHAR2(1000);
BEGIN
FOR c IN (SELECT THEDATE, MED_PAGENOTCOMPLETED, MEDICATION_NAME, MEDICATION_CLASSIFICATION, MEDICATION_DOSENUM, MEDICATION_DOSEMEASURE,MEDICATION_ROUTE,MEDICATION_FREQ,MEDICATION_BEGIN,MEDICATION_END,DATASOURCE,NOCHANGE FROM immunodata.medication WHERE subjectid = p_subjectid)
LOOP
IF v_medication IS NULL THEN
v_medication := c.THEDATE||' '||c.MED_PAGENOTCOMPLETED||' '||c.MEDICATION_NAME||' '||c.MEDICATION_CLASSIFICATION||' '||c.MEDICATION_DOSENUM||' '||c.MEDICATION_DOSEMEASURE||' '||c.MEDICATION_ROUTE||' '||c.MEDICATION_FREQ||' '||c.MEDICATION_BEGIN||' '||c.MEDICATION_END||' '||c.DATASOURCE||' '||c.NOCHANGE;
ELSE
v_medication := v_medication||','||c.THEDATE||' '||c.MED_PAGENOTCOMPLETED||' '||c.MEDICATION_NAME||' '||c.MEDICATION_CLASSIFICATION||' '||c.MEDICATION_DOSENUM||' '||c.MEDICATION_DOSEMEASURE||' '||c.MEDICATION_ROUTE||' '||c.MEDICATION_FREQ||' '||c.MEDICATION_BEGIN||' '||c.MEDICATION_END||' '||c.DATASOURCE||' '||c.NOCHANGE;
END IF;
END LOOP;
RETURN v_medication;
END;
and I performed this selection statement:
SQL> select subjectid, barcode, COMmedication(subjectid) from immunodata.demographics where barcode=500135;
SUBJECTID BARCODE
COMMEDICATION(SUBJECTID)
33 500135
15-SEP-00 Cyclophosphamide Immunosuppresant .7 MG IV MONTLY FORM1 ,15-SEP-00 Hydroxychloroquine (Plaquenil) Immunosuppresant 400 MG DAILY FORM1
It is exactly what I need, so I want to show all records in the tables.
SQL> select subjectid, barcode, COMmedication(subjectid) from immunodata.demographics;
ERROR:
ORA-06502: PL/SQL: numeric or value error: character string buffer too small
ORA-06512: at "SYS.COMMEDICATION", line 9
no rows selected
It seems that one record could be shown, but multiple could not.
Is there anything wrong with my code or other things?
Thanks!
QianIt seems that one record could be shown, but multiple could not.
Is there anything wrong with my code or other things?
It means that there is at least one subjectid in your table for which the value of v_medication in the function exceeds 1000 characters.
You may want to increase the size of v_medication to 4000, which would be the upper limit for the function's return value.
pratz -
How-To Display the Number of Records Returned from a List to the User?
We currently are using lists to identify accounts that meet various criteria. Because the territories vary from 4k to 60k customers the users have stated that they don't know the size of the list and therefore don't know if they need to refine the list. Currently they are exporting to Excel to look at the row count to see if they need to further refine their searches. This takes quite a while and while shuffling through many lists is a bit painful. Isn't there a way to just show the total records returned from the list down at the bottom of the screen where it allows you to see 25/50/75/100 records at a time?
There is probably a simple way to do this but it is a large user dissatisfier at the time because we simply don't know how to make this show up. Again we are using lists and not analytics for simple lists at this time.
- john
Edited by: user11286597 on Jun 19, 2009 11:02 AMThanks Bobb. I can't believe that one wasn't in R1 :)
Is there a link to the items being worked in the next release by any chance?
- john -
Getting Records Returned When Criteria Doesn't Match (Using One Query)
I have made two queries which I would like to fold into one query if possible. The first query includes all grp_id's. The second query updates grp_id's with an (active) member count. This second query has criteria in it that grabs only grp_id's that have active members. This would be similar to say, for example, a left join situation where everything is returned from table A and only those matching from table B.
The problem is that if I put these together, they have to be linked by grp_id, so obvioulsy, if I put these queries together, the only grp_id's I will get back are the ones that have active members in them, but as I mentioned, I need all grp_id's to be shown regardless of any active membership.
So, here is the code that doesn't work to give a better idea of what I want.
select g00.grp_id,
count(m06.subs_ssn)
from gmaster g00
join m_elig m06 on
g00.grp_id = m06.grp_id
and m06.eff_date < sysdate
and m06.exp_date > sysdate
and m06.stat_code = 'ACTIVE'
group by g00.grp_id
Again, this will only give me counts for grp_id's with active members in them, whereas I want all grp_id's shown and those grp_id's without active members to have a zero next to the count..
m06 gives the member data and g00 gives the grp_id data. The m06 eff_date and exp_date and stat_code as shown above determine active members..
Thanks for any suggestions..I don't know why its not working. I did make an error in the intial posting of the data which was to put NOAM in grpid 'C'. I thought this might be my error, but I corrected it and am still getting the same results.
I have repasted the DDL statements, the query I'm using, the results and also the data as it shows when I query the two tables. (my query is based off the tables created using the posted DDL).
I also posted QUERY B. Which shows that the removal of the eff_dt and exp_dt criteria allows grp_id to be posted in the results, obviously showing 1 record as I no longer am defining an ACTIVE member by having criteria as posted in QUERY A.
Is my LEFT OUTER JOIN statement written correctly?
Also of note: I could not insert the data without the apostrophes in the dates. It gave me an error (Column not allowed here). Using the apostrophes eliminates this message and allows the data insertion. At least for now its not causing an issue as the data shows correct when I query it based a simple query of the dates.
Using PL/SQL don't know if that makes a difference..?
=======================================================
DATA IN TBL: GRP_ID:
1 A
2 B
3 C
4 D
DATA IN TBL: MBR
1 MARK A Y 1/1/2011 7/1/2011
2 MARK A Y 7/1/2011 1/1/2012
3 MARTY A Y 1/1/2011 7/1/2011
4 MARTY A Y 7/1/2011 1/1/2012
5 FRANK B Y 1/1/2011 7/1/2011
6 FRANK B Y 7/1/2011 1/1/2012
7 MARY B Y 1/1/2011 7/1/2011
8 MARY B Y 7/1/2011 1/1/2012
9 JEAN C Y 1/1/2011 7/1/2011
10 JEAN C Y 7/1/2011 1/1/2012
11 NOAM D Y 1/1/2011 7/1/2011
As you can see, Mark, Marty should have 1 active record in grp_id 'A' (total 2), Frank and Mary should have 1 active record each 'B' (total 2), Jean should have 1 active record in 'C' grp_id, total 1) and Noam should have no active records.
====================================
QUERY A:
SELECT
g00.grpid,
count(m00.grpid) mbr_count
FROM
grp_id g00
left outer join mbr m00 on
g00.grpid = m00.grpid
WHERE
m00.eff_dt < sysdate
AND
m00.exp_dt > sysdate
GROUP BY
g00.grpid
QUERY A RESULTS
1 A 2
2 B 2
3 C 1
QUERY B
SELECT
g00.grpid,
count(m00.grpid) mbr_count
FROM
grp_id g00
left outer join mbr m00 on
g00.grpid = m00.grpid
GROUP BY
g00.grpid
QUERY B RESULTS:
1 A 4
2 B 4
3 C 2
4 D 1
=================================================
DDL STATEMENTS
create table mbr (mbr_name varchar(10), grpid varchar(1), stat varchar(1), eff_dt date, exp_dt date)
insert into mbr values ('MARK', 'A','Y', '01-jan-2011', '01-jul-2011')
insert into mbr values ('MARK', 'A','Y','01-jul-2011', '01-jan-2012')
insert into mbr values ('MARTY', 'A','Y','01-jan-2011', '01-jul-2011')
insert into mbr values ('MARTY', 'A','Y', '01-jul-2011', '01-jan-2012')
insert into mbr values ('FRANK', 'B','Y','01-jan-2011', '01-jul-2011')
insert into mbr values ('FRANK', 'B','Y','01-jul-2011', '01-jan-2012')
insert into mbr values ('MARY', 'B','Y','01-jan-2011', '01-jul-2011')
insert into mbr values ('MARY', 'B','Y','01-jul-2011', '01-jan-2012')
insert into mbr values ('JEAN', 'C','Y','01-jan-2011', '01-jul-2011')
insert into mbr values ('JEAN', 'C','Y','01-jul-2011', '01-jan-2012')
insert into mbr values ('NOAM', 'D','Y','01-jan-2011', '01-jul-2011')
commit -
Date based report with multiple record return
Hello all,
Here is the situation. Running MAS 4.1 and using Crystal 10 for doing reports. I currently have a custom report that shows all invoices that have been paid for any given date range. This works great except when there is a "credit Memo" against an invoice. The way I'm getting all paid invoices is via a formula. The record set I have to pull against lists the invoice amount, date paid and amount paid. Simple calculation on the returned record will tell you if it has been paid off or not. The problem I'm having is those invoice records that also have a credit memo against them. The credit memo entries do not have a "paid date" and since that is my main selection criteria those records will not pull into my report, and therefor those invoices will not be showed as being paid. What I need to happen (and I don't know how to do it). Is for the report to run based upon the date range specified, and pull in related records even if there is no "paid date" on them. The way MAS stores it's invoice/credit memo records is the same for both. The main difference is that invoice has the "type" field set to "IN" and a credit memo has the "type" field set to "CM". So the actual "invoice number" is the same for both kinds of records. I hope my request makes sense, if not let me know and I will try to explain what does not make sense. Thanks in advance. BillJason,
You've been very helpful, but I guess I'm just not explaining myself that well. The Credit Memo's throw things off because they do not contain a "Paid Date" value. That field in the record is blank. Since it is blank the report query ignores them. Therefore when the report query returns all records that have a "Paid date" range of "x to y" they are never returned. This is a problem whenever a credit memo exists for an invoice because the "invoice total" never changes. So when a customer pays on their account for a particular invoice, they only pay what is due which is the "invoice total" minus any "credit" from the "Credit Memo". So when my A/R person receives payment they are showing the invoice paid in full because MAS automatically includes all invoices and credit memo's. My report does not because there is no data in the "Paid Date" field of the record for Credit Memos.
I've been doing alot research in trying to resolve this "exception" to my report. I think I may be on to something, but my knowledge of arrays is extremely limited. My resolution involves populating an array with the "invoice numbers" that are returned from the initial query from the supplied date range. Then using the "invoice numbers" from the array have it then populate my details section of the report with all of "invoice records" both the actual invoice record and any "credit memo" records. I can then group the records returned based upon the "invoice number". then within that grouping I can performing my calculations to show whether or not the invoice has been paid in full. What do you think? I've been able to populate an array with the invoice numbers based upon my date search range, but I have yet to figure out how to take that information and perform another lookup to pull in the rest of the data I need. Do you have any ideas?
Thanks. Bill -
Which system field returns the number of records returned after a select?
Which system field returns the number of records returned after a select?
a) sy-index
b) sy-recno
c) sy-lncnt
d) sy-dbcnt
e) sy-tabixHi,
SY-DBCNT
Regards,
Prashant -
How to show 'No Records Found' and 'Employee Name Unknown' in oracle report
Hello,
I'm using 6i and building a report to show employees who have incorrectly input their time. I have an input parameter so a user can select a specific employee by emp_id or can leave it empty to show all. That part works. I also have date parameters that are required. That works too. However I am having trouble displaying 'NO Records Found' if the date parameters have no late or rejected employee time records. I currently have it as a text field arranged behind the emp_name field which i filled white. It works...however i have a pretty good feeling there is a better way to do this. Also, I have some data that is null since i am using two tables. There are time stamps with no emp_name or emp_number. I still need to show these records but want them to show up as "Employee Name Unknown" that way the user doesnt get confused and thinks the emp_name in the row above also includes this row.
select e.location "Clock Location",
e.emp_no "Emp No",
l.first_name ||' ' || last_name "Name",
e.time_stamp "Time",
from emp_time e, master_all l
where e.emp_no (+) = l.emp_no
and e.status = 'rejected'
--and e.emp_no = nvl (:p_emp_no, emp_no)
--and e.time_stamp between :p_start_date and :p_end_dateHi,
So, when the join between emp_time and master_all produces no rows, you still want one row of output, saying 'No Records Found'; is that right?
If so, you can outer-join the result set to dual, with some join condition that accepts anything.
Use CASE (or equivalents) to get special values (like 'No Record Found' or 'Employee name unknown') when certain columns are NULL.
For example:
SELECT j.location AS "Clock Location"
, j.emp_no AS "Emp No"
, CASE
WHEN j.name IS NULL
THEN 'No Records Found'
ELSE j.name
END AS "Name"
, time_stamp AS "Time"
FROM dual d
, ( -- Begin in-line view j, join of emp_time and master_all
SELECT e.location
, e.emp_no
, CASE
WHEN l.first_name IS NULL
AND last_name IS NULL
THEN 'Employee name unknown'
ELSE l.first_name || ' ' || last_name
END AS name
FROM emp_time e
, master_all l
WHERE e.emp_no (+) = l.emp_no
AND e.status (+) = 'rejected'
-- AND e.emp_no (+) = NVL (:p_emp_no, emp_no)
-- AND e.time_stamp (+) BETWEEN :p_start_date
AND :p_end_date
) j -- End in-line view j, join of emp_time and master_all
WHERE d.dummy != j.name (+)
;In an outer join, all conditions involiving the optional table need a + sign; otherwise, the effect is the same as an inner join.
The message 'No Records Found' is a string, so it has to go in a string column.
I put it in the "Name" column, just because I knew that "Name" was a string.
You can put in in any other column if you wish. If that column is not already a string, then use TO_CHAR to make it a string.
You could also have a column just for this message.
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only) for all tables, and also post the results you want from that data.
DOUBLE U wrote:
I've tried nvl in the select statement but since emp_name is a concatination of first and last name it doesnt work. This is what i have tried
nvl(l.first_name|' '||l.last_name,'NO EMPLOYEE RECORD FOUND') "Employee",I assume you meant to have two | characters, not just one, after first_name.
The first argument to NVL will never be NULL in that case; it will always contain at least a space, whether or not the other columns are NULL. You could say:
NVL ( NULLIF ( l.first_name || ' ' || l.last_name
, 'NO EMPLOYEE RECORD FOUND'
) "Employee",bujt I find it less confusing to use CASE, as shown above. -
ALV GRID Report is not showing all records which is in internal table
hi all,
have one doubt. please clarify me. ALV Report is working fine since long tiem. But suddenly this report is showing few records only for the given input. Example: it_main table have 50 records, but output is showing only 10 records only. (we have not made any modifications in this report).
temporarily i have given excel output file from it_main table. excel file is showing all records.
here it_main have all the records. but output is showing few records only. it is not showing any error. i have tested with REUSE_ALV_LIST_DISPLAY function also. but it also showing same results(few records only.)
please give me some idea.
FORM display_alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
is_layout = wa_layout
it_fieldcat = it_fcat
it_events = it_events
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_main
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE text-204 " 'Error in Display the list'
TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
ENDFORM. . "DISPLAY_ALV_REPORT
Best Regards,
Srinivashi
Please study this program and give me suggestions.
ALV Declaration
DATA : it_events TYPE slis_t_event, "ALV event
it_fcat TYPE slis_t_fieldcat_alv, "Field catalog
it_list_top_of_page TYPE slis_t_listheader,
c_tabname TYPE slis_tabname VALUE 'IT_MAIN'.
DATA : wa_layout TYPE slis_layout_alv,
wa_event TYPE slis_alv_event,
wa_fcat TYPE slis_fieldcat_alv,
wa_variant TYPE disvariant.
START-OF-SELECTION.
PERFORM material_pass.
PERFORM data_retrieval.
END-OF-SELECTION.
PERFORM sub_display_report.
FORM sub_display_report .
DATA status(1).
IF r1 = 'X'.
PERFORM build_fieldcatalog USING :
'1' 'ERDAT' 'S.O DATE' '' '10' 'X',
'2' 'VBELN' 'SALE ORDER' '' '10' 'X',
'3' 'POSNR' 'SALE ITEM' '' '6' '',
'4' 'BSTKD' 'CUSTOMER PO' '' '35' '',
'5' 'BEZEI' 'REASON FOR REJECTION' '' '40' '',
'6' 'PLNUM' 'PLANNED ORDER' '' '10' '',
'7' 'AUFNR' 'PROD.ORDER.' '' '12' '',
'8' 'MATNR' 'MATERIAL NUMBER' '' '18' '',
'9' 'MAKTX' 'MATERIAL DESCRIPTION' '' '40' '',
'10' 'WERKS' 'PLANT' '' '4' '',
'11' 'KWMENG' 'SALE ORDER QTY' '' '15' '',
'12' 'VRKME' 'UNIT' '' '4' '',
'13' 'GAMNG' 'PROD.ORDER QTY' '' '13' '',
'14' 'IGMNG' 'CONFIRMED ORDER QTY' '' '13' '',
'15' 'GMEIN' 'UNIT' '' '4' '',
'16' 'MENGE' 'G.R QUANTITY' '' '13' '',
'17' 'SOBAL' 'S.O BALANCE' '' '13' '',
'18' 'PRDBAL' 'PROD.BALANCE' '' '13' '',
'19' 'GSM' 'GSM' '' '4' '',
'20' 'SIZE1' 'SIZE1' '' '10' '',
'21' 'SIZE2' 'SIZE2' '' '10' ''.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = pathname
filetype = ftype
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = it_mains
EXCEPTIONS
file_write_error = 1.
IF sy-subrc = 0.
status = 'S'.
ELSE.
status = 'E'.
ENDIF.
ELSEIF r2 = 'X' OR r3 = 'X'.
PERFORM build_fieldcatalog USING :
'1' 'ERDAT' 'S.O DATE' '' '10' 'X',
'2' 'VBELN' 'SALE ORDER' '' '10' 'X',
'3' 'POSNR' 'SALE ITEM' '' '6' '',
'4' 'BSTKD' 'CUSTOMER PO' '' '35' '',
'5' 'BEZEI' 'REASON FOR REJECTION' '' '40' '',
'6' 'PLNUM' 'PLANNED ORDER' '' '10' '',
'7' 'AUFNR' 'PROD.ORDER.' '' '12' '',
'8' 'MATNR' 'MATERIAL NUMBER' '' '18' '',
'9' 'MAKTX' 'MATERIAL DESCRIPTION' '' '40' '',
'10' 'WERKS' 'PLANT' '' '4' '',
'11' 'KWMENG' 'SALE ORDER QTY' '' '15' '',
'12' 'VRKME' 'UNIT' '' '4' '',
'13' 'GAMNG' 'PROD.ORDER QTY' '' '13' '',
'14' 'IGMNG' 'CONFIRMED ORDER QTY' '' '13' '',
'15' 'GMEIN' 'UNIT' '' '4' '',
'16' 'MENGE' 'G.R QUANTITY' '' '13' '',
'17' 'SOBAL' 'S.O BALANCE' '' '13' '',
'18' 'PRDBAL' 'PROD.BALANCE' '' '13' '',
'19' 'GSM' 'GSM' '' '4' '',
'20' 'SIZE1' 'SIZE1' '' '10' '',
'21' 'CUT1' 'CUT1' '' '11' '',
'22' 'SIZE2' 'SIZE2' '' '10' '',
'23' 'CUT2' 'CUT2' '' '11' '',
'24' 'SIZE3' 'SIZE3' '' '10' '',
'25' 'CUT3' 'CUT3' '' '11' '',
'26' 'SIZE4' 'SIZE4' '' '10' '',
'27' 'CUT4' 'CUT4' '' '11' '',
'28' 'SIZE5' 'SIZE5' '' '10' '',
'29' 'CUT5' 'CUT5' '' '11' '',
'30' 'SIZE6' 'SIZE6' '' '10' '',
'31' 'CUT6' 'CUT6' '' '11' ''.
CALL FUNCTION 'GUI_DOWNLOAD'
EXPORTING
filename = pathname
filetype = ftype
append = 'X'
write_field_separator = 'X'
TABLES
data_tab = it_mainall
EXCEPTIONS
file_write_error = 1.
IF sy-subrc = 0.
status = 'S'.
ELSE.
status = 'E'.
ENDIF.
ENDIF.
PERFORM build_layout.
PERFORM build_events.
PERFORM sub_comment_build USING it_list_top_of_page.
PERFORM sub_set_variant.
PERFORM display_alv_report.
IF status = 'S'.
MESSAGE 'Excel Output file Downloaded to Given Path' TYPE 'I'.
ELSE.
MESSAGE 'Download Not Possible' TYPE 'I'.
ENDIF.
ENDFORM. " SUB_DISPLAY_REPORT
FORM BUILD_FIELDCATALOG
FORM build_fieldcatalog USING p_col_pos
p_fieldname
p_text
p_datatype
p_outputlen
p_col_freez.
wa_fcat-row_pos = '1'.
wa_fcat-col_pos = p_col_pos.
wa_fcat-fieldname = p_fieldname.
wa_fcat-tabname = c_tabname.
wa_fcat-reptext_ddic = p_text.
wa_fcat-datatype = p_datatype.
wa_fcat-ddic_outputlen = p_outputlen.
wa_fcat-key = p_col_freez.
APPEND wa_fcat TO it_fcat.
CLEAR wa_fcat.
ENDFORM. " BUILD_FIELDCATALOG
*& Form BUILD_LAYOUT
FORM build_layout.
CLEAR: wa_layout.
wa_layout-window_titlebar = 'LIST OF GSM WISE OPEN SALE ORDERS'.
wa_layout-colwidth_optimize = 'X'.
wa_layout-totals_text = 'CUMULATIVE'.
ENDFORM. "BUILD_LAYOUT
*& Form BUILD_EVENTS
FORM build_events.
CLEAR wa_event.
REFRESH it_events.
CALL FUNCTION 'REUSE_ALV_EVENTS_GET'
EXPORTING
i_list_type = 0
IMPORTING
et_events = it_events
EXCEPTIONS
list_type_wrong = 1
OTHERS = 2.
IF sy-subrc = 0.
READ TABLE it_events INTO wa_event
WITH KEY name = 'TOP_OF_PAGE'.
IF sy-subrc EQ 0.
wa_event-form = 'TOP_OF_PAGE'.
APPEND wa_event TO it_events.
CLEAR wa_event.
ENDIF.
ENDIF.
ENDFORM. "BUILD_EVENTS
-->P_IT_LIST_TOP_OF_PAGE text
FORM sub_comment_build USING it_top_of_page TYPE slis_t_listheader.
DATA ls_line TYPE slis_listheader.
CLEAR ls_line.
ls_line-typ = 'H'.
ls_line-info = str1.
APPEND ls_line TO it_top_of_page.
CLEAR ls_line.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header[].
ENDFORM. " SUB_COMMENT_BUILD
*& Form SUB_SET_VARIANT
text
--> p1 text
<-- p2 text
FORM sub_set_variant .
CLEAR wa_variant.
wa_variant-report = sy-repid.
wa_variant-username = sy-uname.
wa_variant-variant = c_variant.
wa_variant-variant = p_layout.
ENDFORM. " SUB_SET_VARIANT
*& Form DISPLAY_ALV_REPORT
*Display Report Using ALV GRID
FORM display_alv_report.
CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
EXPORTING
i_buffer_active = 'X'
i_callback_program = sy-repid
i_callback_pf_status_set = c_pf_status
i_callback_user_command = c_user_command
is_layout = wa_layout
it_fieldcat = it_fcat
it_sort = it_sort[]
it_events = it_events
i_save = 'A'
is_variant = wa_variant
TABLES
t_outtab = it_main
EXCEPTIONS
program_error = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE text-204 " 'Error in Display the list'
TYPE 'I'.
LEAVE TO LIST-PROCESSING.
ENDIF.
ENDFORM. . "DISPLAY_ALV_REPORT
*ALV Report Header
FORM top_of_page.
DATA : t_header TYPE slis_t_listheader WITH HEADER LINE,
wa_header TYPE slis_listheader,
t_line LIKE wa_header-info,
ld_lines TYPE i,
ld_linesc(10) TYPE c.
wa_header-typ = 'H'.
T_HEADER-INFO = 'LIST OF GSM WISE OPEN SALE ORDERS'.
wa_header-info = str1.
APPEND wa_header TO t_header.
CALL FUNCTION 'REUSE_ALV_COMMENTARY_WRITE'
EXPORTING
it_list_commentary = t_header[].
ENDFORM. "TOP_OF_PAGE
here it_main internal table having all data. but output is showing few records only.
pl. give some idea.
Thanks & Regards
Srinivas. -
Report download to power point doesn't show all records
dear experts,
I have a report with a tape deck below, so it shows only records 1-25. When I click download to excel, every record is downloaded (1-all rows) and this is fine. But, if I download to power point, only the records shown on the dashboard (e.g. 1-25) are downloaded into power point.
Our quality assurance claims, that the behaviour for both download options should be the same, and not downloading to excel having every row and the power point showing limited rows.
Is there a way to download the whole report, each row, to power point (without clicking on tapedeck to show all) ??
Thanks in advance.
best regards,
Thomasproblem solved
modify report - results(answers) - click on printer icon (PDF and Print Control) - Print Rows - set to "All"
regards,
thomas -
How to show multipe records on a single record
Hi all,
I have a query which can contain 1 or Many records for each S.WAS_NO or APPL_NO even. A new record is created when the APPL_STATUS changes and a timestamp is created in APPL_STATUS_CHANGE_DATE.
select distinct
S.APPL_ID,
S.WAS_NO,
S.AS_STATUS,
S.STATUS_CHANGE_DATE,
dense_rank() over (partition by S.WAS_NO order by S.STATUS_CHANGE_DATE) rank
from table_a S, table b S2
where S.APPL_ID = S2.APPL_ID
order by S.WAS_NO, rank asc;
Current Results:
APPL_ID---WAS_NO---------------AS_STATUS----STATUS_CHANGE_DATE-----RANK
6628-------E4G0YL9B08V0V6---ASSIGNED-------25/10/2011----------------------1
6628-------E4G0YL9B08V0V6---USED--------------30/12/2011----------------------2
Desired Results:
APPL_ID--WAS_NO------------------AS_STATUS1----STATUS_CHANGE_DATE1----AS_STATUS2----STATUS_CHANGE_DATE2
6628-------E4G0YL9B08V0V6----ASSIGNED---------25/10/2011------------------------USED--------------30/12/2011The rank is based on the WAS_Number and ordered by the STATUS_CHANGE_DATE so i know which order they should go in.
I want to show 1 record per WAS_NO and show each status change with its date. There can only be a maximum of three status changes.
I have not been able to workout how to get Multiple records onto a singe record and in different columns.
Many thanksThis should do what you want:
WITH t AS
(SELECT 6628 appl_id, 'E4G0YL9B08V0V6' was_no, 'ASSIGNED' as_status, TO_DATE('25/10/2011', 'DD/MM/YYYY') status_change_date FROM dual UNION ALL
SELECT 6628 appl_id, 'E4G0YL9B08V0V6' was_no, 'USED' as_status, TO_DATE('30/12/2011', 'DD/MM/YYYY') status_change_date FROM dual UNION ALL
SELECT 6628 appl_id, 'E4G0YL9B08V0V6' was_no, 'COMPLETE' as_status, TO_DATE('15/01/2012', 'DD/MM/YYYY') status_change_date FROM dual UNION ALL
SELECT 6629 appl_id, 'A5AAFG1C07L0P2' was_no, 'ASSIGNED' as_status, TO_DATE('19/01/2012', 'DD/MM/YYYY') status_change_date FROM dual)
SELECT appl_id,
was_no,
MAX(CASE rank
WHEN 1 THEN as_status
ELSE NULL
END) as_status1,
MAX(CASE rank
WHEN 1 THEN status_change_date
ELSE NULL
END) status_change_date1,
MAX(CASE rank
WHEN 2 THEN as_status
ELSE NULL
END) as_status2,
MAX(CASE rank
WHEN 2 THEN status_change_date
ELSE NULL
END) status_change_date2,
MAX(CASE rank
WHEN 3 THEN as_status
ELSE NULL
END) as_status3,
MAX(CASE rank
WHEN 3 THEN status_change_date
ELSE NULL
END) status_change_date3
FROM (SELECT appl_id,
was_no,
as_status,
status_change_date,
DENSE_RANK() OVER (PARTITION BY was_no ORDER BY status_change_date) rank
FROM t)
GROUP BY appl_id,
was_no -
How do I count the number of records returned in the CMIS query
How do I count the number of records returned in the query CMIS?
SELECT COUNT(*) FROM ora:t:IDC:GlobalProfile WHERE ora:p:xRegionDefinition = \'RD_PROJETOS_EXCLUSIVOS\''}
Euler HomeroHi Euler,
interestingly enough, the reference guide for CMIS ( http://wiki.alfresco.com/wiki/CMIS_Query_Language ) that I found does not mention the COUNT function at all. On the other hand it states that: "The SELECT clause identifies which virtual columns to return in the result set. It can be either a comma-separated list of one or more queryNames of properties that are defined by queryable object types or * for all virtual columns."
There are, however, some other posts like e.g. http://alfrescoshare.wordpress.com/2010/01/20/count-the-total-number-of-documents-in-alfresco-using-sql/ which state that they could make it working.
Having asked in the WebCenter Portal forum, I assume that your content repository is WebCenter Content. The CMIS doc for the Content is available here: http://docs.oracle.com/cd/E23943_01/doc.1111/e15813.pdf (no COUNT there either). It does, however, mention explicitly that "CMIS queries return a Result Set where each Entry object will contain only the properties that were specified in the query.". This means your could rather investigate the Result Set. Note that there are also other means than CMIS how to get the requested result set (e.g. calling a search service directly via so-called RIDC).
In the given context I am also interested what your use case is. OOTB CMIS in WebCenter Portal is used, for instance, in Content Presenter, where it is content rather than "parameters" what's displayed. -
How to e-mail/not e-mail a scheduled report based on records returned
Hi Everyone,
Is there a way that there can be logic performed on a report that has been scheduled and ran before it gets sent via e-mail to the end users? We have scheduled reports that often end up with 0 records returned but users still get the e-mail with the report that contains 0 records. I would like to e-mail the reports only if the records returned is greater than 0.
We are on v3.1 so if there is a solution for 3.1 that would be great. If this capability exists in 4.0, that information would be very helpful as well.
Thank you for your time.
David HellingerApply an event on your report.
First go to Cmc, create an event based for example on a file that should be created in certain route if the query won't return 0 rows.
Then apply this event in your report Schedule option Event. -
Hi Experts,
Is it standard behavior for VL10A to show two records when a Sales Document has been blocked? Their only difference is the field Delivery Block. In VL10A, the first record has a delivery block of BLANK, the second has 99.
Here's how to replicate the issue.
Create sales order.
When you check VL10A, the Sales document is there.
Change sales order field (RSD) in VA02, Save.
When you check VL10A, there are now two records, one has a blank delivery block, the other has 99.
The expected result here is that after changing in VA02, there will be only 1 record in VL10A and it should have delivery block of 99.
Assumptions:
1. We know that VL10A retrieves its records from VEPVG. The problem is, in VEPVG, delivery block is a key field. So I think that during VA02, when the delivery block of 99 is assigned, this creates a record in VEPVG instead of updating the existing one. Is this standard behavior, and are my assumptions correct?
Thanks in advanced experts. Appreciate your prompt response,
JackHello Jack,
This is the standard behavior. When I check in our system, I too can see two entries but with different good issue date and delivery date and the block is specific to good issue date, delivery date.
So there is no problem in it. try to give the delivery date which includes two table entries delivery date and execute the transaction VL10A.
Regards,
TP -
Freight Carrier Form not showing all records
The Freight Carrier form is not showing all of the data that shows in the table
(ORG_FREIGHT). For the Organization that I am in (#23) the table shows 108 records but the form only shows
35 records. Why? How can I make the form see all of the records in the tables? I am in the middle of converting 11.0.3 to
11i.
Thanks
ShelbyWhat version of Visual Studio and the Crystal for Visual Studio SDK are you using?
-Dell
Maybe you are looking for
-
Can not select from gv$ table in trigger...please help.
I have the following SQL in my trigger which I am using in mt cursor. cursor sessioninfo is SELECT s.LOGON_TIME, i.INSTANCE_NAME, s.SERIAL#, s.MACHINE, s.PROGRAM, s.MODULE FROM gv$SESSI
-
Update several iPod's with same IOS download
Ok this is a simple question. All i want to know is that if i click download only (or download and update) when updating to the current IOS (5) is it possible to update other ipods without downloading the IOS again. For example i plug my ipod in and
-
Hi, I have a requirement to convert the below: Source Message: <Message> <Segment> ..............................0..unbounded <Field1>Value1</Field1> <Field2>Value2</Field2> <Field20>Value20</Field20> </Segment> <Segment> ............................
-
Was It Really That Easy?
I've had quite a few Macs over the years, but my new 20" iMac 2.4 arrived Friday. Setup and transfer from the old G5 went great, but the machine started making a high pitched buzz the next day. When the screen dimmed automatically after it sat for a
-
Why doesn't FF5 start with previous tabs & pinned tabs, & no Save or Quit at shudown.
First up, the Feedback form wouldn't submit, so my gripes are included here. Perhaps more word allowance is needed for complex issues? Or the form simply has a glitch in it. Using FF5. At shutdown last night FF did not ask if I wanted to save the pag