Help with Select Decode Round
Hi, If anyone could help me with this. I need to round all these numbers in the DECODE but without repeating ROUND.
This way works:
SELECT title "Title", category "Category",retail "Current Price",
DECODE(category,
'COMPUTER',(ROUND(retail * 1.1,2)),
'FITNESS', (ROUND(retail * 1.15,2)),
'SELF HELP', (ROUND(retail * 1.25,2)),
(ROUND(retail * 1.03,2)))"Revised Price"
FROM books
ORDER BY category, title;
But I need something more like this:
SELECT title "Title", category "Category",retail "Current Price",
DECODE (ROUND((category,
'COMPUTER',retail * 1.1,
'FITNESS', retail * 1.15,
'SELF HELP', retail * 1.25,
retail * 1.03)"Revised Price"),2)
FROM books
ORDER BY category, title;
so that ROUND is not repeated more than once..they all need to be rounded to two decimal places.
any help would be great. Thanks
your second is close. You need to round the decode statement. like this:
SELECT title "Title", category "Category",retail "Current Price",
ROUND(DECODE(category, 'COMPUTER',retail * 1.1,
'FITNESS', retail * 1.15,
'SELF HELP', retail * 1.25,
retail * 1.03),2) "Revised Price"
FROM books
ORDER BY category, title;Note that the alias (I assume) revised Proce needs to go outside of both the decode and the round.
John
Similar Messages
-
Help with Select Decode !
Hello all
I dont have a idea how to write this Select. But this need to be in SQL not PL/SQL .
I want recive answer Yes or No from two select in one query how i can do that ?
(select decode(count(1),0,'No','Yes') from zia_all_diagnoses dgs where dgs.mse_mse_id = ZiaVMessages_EO.MSE_ID and dgs.ccn_class_codcontain_case_type = 'DV0002')
(SELECT DECODE (COUNT (1), 0, 'No', 'Yes') FROM zia_all_diagnoses dgs WHERE dgs.cse_cse_id = SgrVcases_EO.CSE_ID AND dgs.ccn_class_codcontain_case_type = 'DV0002')The result need to be
If someone of query return yes then i need to get Yes , if both ar No then No
Thanks
ID.
Edited by: 1D10T on Oct 29, 2012 8:04 AMHi,
I would do something like that :select case
when exists (select null from zia_all_diagnoses dgs where dgs.mse_mse_id = ZiaVMessages_EO.MSE_ID and dgs.ccn_class_codcontain_case_type = 'DV0002') then 'Yes'
when exists (SELECT null FROM zia_all_diagnoses dgs WHERE dgs.cse_cse_id = SgrVcases_EO.CSE_ID AND dgs.ccn_class_codcontain_case_type = 'DV0002') then 'Yes'
else 'No' end chck
from dual; -
Help with SELECT - selecting range of numbers
Hi,
I need a help with SELECT statement. I want to select Dates starting from today and ending 30 days back. So the result would be like:
TRUNC(SYSDATE)
TRUNC(SYSDATE) - 1
TRUNC(SYSDATE) - 2
TRUNC(SYSDATE) - 3
TRUNC(SYSDATE) - 30I was thinking to simply select truncated SYSDATE in first column, and in second column numbers 0, 1, 2, ... 30. Then I would simply do a difference first column - second column. But how to select such sequence of numbers? I don't want to select each number (date) in separate select statement and then unioning them.
Does anybody have an idea?
Thanks for help, DanSQL> select trunc(sysdate) - level + 1 as dt
2 from dual
3 connect by level <= 31
4 ;
DT
07/01/2013
06/01/2013
05/01/2013
04/01/2013
03/01/2013
02/01/2013
01/01/2013
31/12/2012
30/12/2012
29/12/2012
28/12/2012
27/12/2012
26/12/2012
25/12/2012
24/12/2012
23/12/2012
22/12/2012
21/12/2012
20/12/2012
19/12/2012
DT
18/12/2012
17/12/2012
16/12/2012
15/12/2012
14/12/2012
13/12/2012
12/12/2012
11/12/2012
10/12/2012
09/12/2012
08/12/2012
31 rows selected -
Help with Nesting DECODE statements
Hello. I'm trying to write a sql script to generate data report for payments. I need to incorporate specific conditions to SUPPRESS BLANK ADDRESS field lines. I am pulling Address_Line1, Address_Line2, Address_Line3, plus CITY, STATE, ZIP as Address_Line4. If any fields are blank, I need to suppress the blank line and move the other lines up.
Here are my IF, THEN, ELSE conditions. There are 9 possible scenarios that I have identified. Can you please help me write this in SQL with the DECODE function?
IF CITY||STATE||ZIP IS NULL
THEN AD1='12115 Rainbow Road', AD2='Hartford Heights, MO 60226'
ELSE
IF ADDRESS_LINE1 IS NULL
IF ADDRESS_LINE2 IS NULL
IF ADDRESS_LINE3 IS NULL
THEN USE HOME ADDRESS
ELSE vAD1=ADDRESS_LINE3, vAD2=CITY||STATE||ZIP
ENDIF
ELSE
IF ADDRESS_LINE3 IS NULL
THEN vAD1=ADDRESS_LINE2, vAD2 = CITY||STATE||ZIP
ELSE vAD1=ADDRESS_LINE2, vAD2=ADDRESS_LINE3, vAD3=CITY||STATE||ZIP
ENDIF
ENDIF
ELSE
IF ADDRESS_LINE2 IS NULL
IF ADDRESS_LINE3 IS NULL
THEN vAD1=ADDRESS_LINE1, vAD2=CITY||STATE||ZIP
ELSE vAD1=ADDRESS_LINE1, vAD2=ADDRESS_LINE3, vAD3=CITY||STATE||ZIP
ENDIF
ELSE
IF ADDRESS_LINE3 IS NULL
THEN vAD1=ADDRESS_LINE1, vAD2=ADDRESS_LINE2, vAD3=CITY||STATE||ZIP
ELSE vAD1=ADDRESS_LINE1, vAD2=ADDRESS_LINE2, vAD3=ADDRESS_LINE3, vAD4=CITY||STATE||ZIP
ENDIF
ENDIF
ENDIF
ENDIF
This what I've got so far...
DECLARE
vADR1
vADR2
vADR3
vADR4
BEGIN
SELECT
DECODE(
END;
/Hi,
Here is the code along with some sample data. I substitute the "+" symbol for "/" becuase some addresses where using "c/o" in the address line.
The address fields are null, as shown by the query below (ref query results below):
SQL> select address_line1
2 from po.po_vendor_sites_all
3 where address_line1='3457 SOLUTIONS CENTER'
4 and address_line2 is null;
ADDRESS_LINE1
3457 SOLUTIONS CENTERHere is the script:
WITH got_delimited_list AS
SELECT address_line1 || ' +' ||
address_line2 || ' +' ||
address_line3 || ' +' ||
city ||', ' || state ||' ' || zip AS delimited_list
FROM po.po_vendor_sites_all
SELECT REGEXP_SUBSTR (delimited_list, '[^+]+', 1, 1) AS vad1
, REGEXP_SUBSTR (delimited_list, '[^+]+', 1, 2) AS vad2
, REGEXP_SUBSTR (delimited_list, '[^+]+', 1, 3) AS vad3
, REGEXP_SUBSTR (delimited_list, '[^+]+', 1, 4) AS vad4
FROM got_delimited_list;Sample of the data records returned:
VAD1
VAD2
VAD3
VAD4
3457 SOLUTIONS CENTER
CHICAGO, IL 60677-3004
VAD1
VAD2
VAD3
VAD4
5172 EAGLE WAY
CHICAGO, IL 60678-1517
VAD1
VAD2
VAD3
VAD4
RETAILERS' OCCUPATION TAX
SPRINGFIELD, IL 62796-0001
VAD1
VAD2
VAD3
VAD4
DEPT. NUMBER 478150
P.O. BOX 790100
ST LOUIS, MO 63179-9933
VAD1
VAD2
VAD3
VAD4
P.O. BOX 62251
BALTIMORE, MD 21264-2251
VAD1
VAD2
VAD3
VAD4
P.O. BOX 660481
DALLAS, TX 75266-0481
VAD1
VAD2
VAD3
VAD4
3525 PIEDMONT RD.
BUILDING FIVE
SUITE 300
ATLANTA, GA 30305 -
I need to decode to 4 different columns.....basically pivot from rows to columns.
current table setup:
columns:
vin, Command_id, command_result, status
I need to say where command_id for a vin = LT_FT_TR_PR and status = 1
show a column called LF_STATUS with the value of 1 in it
basically
vin, LT_FT_TR_PR, LF_STATUS will be the columns.
LT_FT_TR_PR is already decoded to be a column header with the corresponding command_result as it's value.try to post some sample data and output to further analyze your requirements.
for pivot maybe this example might be of some help:
SQL> select * from pivot_tab;
COL1 COL2
1 a
1 b
1 c
2 h
2 h
SQL> select p.col1,
2 substr(max(substr(sys_connect_by_path (p.col2,','),2)),1,60)
3 as col2
4 from (select col1,
5 col2,
6 row_number() over (partition by col1 order by col1, col2) rn
7 from pivot_tab) p
8 start with p.rn = 1
9 connect by p.rn = prior p.rn + 1
10 and prior p.col1 = p.col1
11 group by col1;
COL1 COL2
1 a,b,c
2 h,h
SQL> -
Help with selecting chuncks of data from a table
Hi all,
I need help with a query that should do the following.
I have a table with vessel messages, and I need to get the last "NumMsgs" messages from a group of vessels.
The problem I have is that if I order the table by Vessel_ID, MessageDate DESC, I can´t do ROWNUM < NumMsgs (<-- Then number of messages to be shown is a user parameter)
I know it should be something like:
select * from (
select *
from Messages m
where TRIM(m.V_ID) = '11597' /* I was trying for a single vessel atm */
order by m.V_ID, m.MESSAGEDATE desc
where rownum < :NumMsgs
Any ideas?
Thanks in advance !Hi,
What about :
select *
from (
select m.*, row_number() (order by m.V_ID, m.MESSAGEDATE desc) rn
from Messages m
where TRIM(m.V_ID) = '11597' /* I was trying for a single vessel atm */
where rn < :NumMsgsAnyway, I don't very well understand your problem, your query work fine, see for example :
SQL> ed
Wrote file afiedt.buf
1 select object_name, object_id
2 from
3 (select object_name, object_id, row_number() over (order by object_id desc) as rn
4 from dba_objects)
5* where rn < 4
SQL> /
PS_TL_MTCHD_118 71763
PS_TL_MTCHD_117 71762
PS_TL_MTCHD_116 71761
SQL> ed
Wrote file afiedt.buf
1 select object_name, object_id
2 from
3 (select object_name, object_id
4 from dba_objects
5 order by object_id desc)
6* where rownum < 4
SQL> /
PS_TL_MTCHD_118 71763
PS_TL_MTCHD_117 71762
PS_TL_MTCHD_116 71761
SQL> Nicolas.
Message was edited by:
N. Gasparotto -
Need help with select that month range with flexible first date
Hello everyone,
I am trying to create a selection of month range (will be in a WITH clause) for a report to display monthly data. But the first month start date can be any date. (Not necessarily the first date of the month)
Examples:
Report input parameters:
Start Date: 08/10/12
End Month: Dec 2012
I was trying to build a with select that will list
Month_Start, Month_End
08/10/12, 31/10/12
01/11/12, 30/11/12
01/12/12, 31/12/12
OR
Month_Start, Next_Month
08/10/12, 01/11/12
01/11/12, 01/12/12
01/12/12, 01/01/13
End month is optional, so if no value the select will list only
08/10/12, 01/11/12
Oracle Database Details is
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production
PL/SQL Release 11.1.0.7.0 - Production
My code so far is
VARIABLE P50_START_DATE VARCHAR2 (10)
VARIABLE P50_END_MONTH VARCHAR2 (10)
EXEC :P50_START_DATE := '10/10/2012';
EXEC :P50_END_MONTH := '31/12/2012';
SELECT to_char(:P50_START_DATE) AS start_date
, ADD_MONTHS( TRUNC(to_date(:P50_START_DATE,'DD/MM/YYYY'),'MONTH'), 1) AS next_month
FROM dual
union
SELECT to_char(ADD_MONTHS( TRUNC(to_date(:P50_START_DATE,'DD/MM/YYYY'),'MONTH'), ROWNUM-1)) AS start_date
, ADD_MONTHS( TRUNC(to_date(:P50_START_DATE,'DD/MM/YYYY'),'MONTH'), ROWNUM) AS next_month
--, rownum
from all_objects
where
rownum <= months_between(to_date(NVL(:P50_END_MONTH, :P50_START_DATE),'DD/MM/YYYY'), add_months(to_date(:P50_START_DATE,'DD/MM/YYYY'), -1))
and rownum > 1If I put comment – on line and rownum > 1, as
-- and rownum > 1The result I get is
START_DATE NEXT_MONTH
01/10/12 01/10/12
01/11/12 01/11/12
01/12/12 01/01/13
10/10/2012 01/11/12 But when I try to remove the duplicate period (of the first month) out by restrict rownum, it do not return any rows for the second select at all. The result I get is:
START_DATE NEXT_MONTH
10/10/2012 01/11/12 Can anyone advise what wrong with the select statement ?
Thanks a lot in advance,
AnnHi,
Here's one way:
WITH params AS
SELECT TO_DATE (:p50_start_date, 'DD/MM/YYYY') AS start_date
, TO_DATE (:p50_end_month, 'DD/MM/YYYY') AS end_date
FROM dual
SELECT GREATEST ( start_date
, ADD_MONTHS ( TRUNC (start_date, 'MONTH')
, LEVEL - 1
) AS month_start
, LEAST ( end_date
, ADD_MONTHS ( TRUNC (start_date, 'MONTH')
, LEVEL
) - 1
) AS month_end
FROM params
CONNECT BY LEVEL <= 1 + MONTHS_BETWEEN ( end_date
, TRUNC (start_date, 'MONTH')
;:p50_end_month doesn't have to be the last day of the month; any day will work.
If you want to generate a Counter Table containing the integers 1 througn x in SQL, you could say
SELECT ROWNUM AS n
FROM all_objects
WHERE ROWNUM <= x
;but, starting in Oracle 9.1, it's much faster to say
SELECT LEVEL AS n
FROM dual -- or any table containing exactly 1 row
CONNECT BY LEVEL <= x
;Also, x can be greater than the number of rows in all_objects. -
Hello,
My table looks similar to this, I have removed a few columns:
table1:
Forecast_id Forecast_name Freeze Enabled
100 Q12009 N Y
101 Q22009 N Y
table2:
forecast_id parameter_name parameter_value
100 StartDate 01/01/2009
100 EndDate 03/31/2009
100 Growth % 20
100 Retailer Walmart
101 StartDate 04/01/2009
101 EndDate 06/30/2009
101 Growth % 20
101 Retailer Walmart
What i need to do is
select from table 1, forecast name & freeze
where in table2 parameter = Retailer, Parameter value = Walmart and
Start Date = 01/01/2009 and End Date = 03/31/2009
here is my query is there a easy way this can be done. I have used decode function in the past for similar situation for counting and grouping.
SELECT i.FORECAST_ID,
i.FORECAST_NAME,
i.FREEZE_FLAG
FROM (
SELECT x.FORECAST_ID,
x.FORECAST_NAME,
x.FREEZE_FLAG
FROM (
SELECT A.FORECAST_ID,
A.FORECAST_NAME,
A.FREEZE_FLAG
FROM GC_FORECAST A, GC_FORECAST_PARAMETERS B
WHERE A.FORECAST_ID = B.FORECAST_ID
AND B.PARAMETER_NAME = 'Retailer'
AND B.PARAMETER_VALUE = 'Walmart'
) x, GC_FORECAST_PARAMETERS y
WHERE x.FORECAST_ID = y.FORECAST_ID
AND y.PARAMETER_NAME = 'StartDate'
AND y.PARAMETER_VALUE = '01/01/2009'
) i, GC_FORECAST_PARAMETERS j
WHERE i.FORECAST_ID = j.FORECAST_ID
AND j.PARAMETER_NAME = 'EndDate'
AND j.PARAMETER_VALUE = '03/31/2009';
Thank you for your time and help.
Vidhya
Edited by: snaraya9 on Dec 5, 2008 12:03 PM
Edited by: snaraya9 on Dec 5, 2008 12:06 PMSolution
SELECT gc_forecast.forecast_id, gc_forecast.forecast_name, gc_forecast.freeze,
gc_forecast.enabled
FROM gc_forecast,
(SELECT forecast_id,
MAX (CASE
WHEN parameter_name = 'StartDate'
AND parameter_value = '01/01/2009'
THEN 1
ELSE 0
END
) cond1,
MAX (CASE
WHEN parameter_name = 'EndDate'
AND parameter_value = '03/31/2009'
THEN 1
ELSE 0
END
) cond2,
MAX (CASE
WHEN parameter_name = 'Retailer'
AND parameter_value = 'Walmart'
THEN 1
ELSE 0
END
) cond3
FROM gc_forecast_parameters
GROUP BY forecast_id) gf
WHERE gc_forecast.forecast_id = gf.forecast_id
AND gf.cond1 = 1
AND gf.cond2 = 1
AND gf.cond3 = 1
Demo
SQL*Plus: Release 10.1.0.4.2 - Production on Ven. Déc. 5 15:34:14 2008
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connecté à :
Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit Production
With the Partitioning, OLAP and Data Mining options
SQL> /* Formatted on 2008/12/05 15:33 (Formatter Plus v4.8.8) */
SQL> WITH gc_forecast_parameters AS
2 (SELECT 100 forecast_id, 'StartDate' parameter_name,
3 '01/01/2009' parameter_value
4 FROM DUAL
5 UNION ALL
6 SELECT 100, 'EndDate', '03/31/2009'
7 FROM DUAL
8 UNION ALL
9 SELECT 100, 'Growth', '% 20'
10 FROM DUAL
11 UNION ALL
12 SELECT 100, 'Retailer', 'Walmart'
13 FROM DUAL
14 UNION ALL
15 SELECT 101, 'StartDate', '04/01/2009'
16 FROM DUAL
17 UNION ALL
18 SELECT 101, 'EndDate', '06/30/2009'
19 FROM DUAL
20 UNION ALL
21 SELECT 101, 'Growth', '% 20'
22 FROM DUAL
23 UNION ALL
24 SELECT 101, 'Retailer', 'Walmart'
25 FROM DUAL),
26 gc_forecast AS
27 (SELECT 100 forecast_id, 'Q12009' forecast_name, 'N' freeze, 'Y' enabled
28 FROM DUAL
29 UNION ALL
30 SELECT 101, 'Q22009', 'N', 'Y'
31 FROM DUAL)
32 SELECT gc_forecast.forecast_id, gc_forecast.forecast_name, gc_forecast.freeze,
33 gc_forecast.enabled
34 FROM gc_forecast,
35 (SELECT forecast_id,
36 MAX (CASE
37 WHEN parameter_name = 'StartDate'
38 AND parameter_value = '01/01/2009'
39 THEN 1
40 ELSE 0
41 END
42 ) cond1,
43 MAX (CASE
44 WHEN parameter_name = 'EndDate'
45 AND parameter_value = '03/31/2009'
46 THEN 1
47 ELSE 0
48 END
49 ) cond2,
50 MAX (CASE
51 WHEN parameter_name = 'Retailer'
52 AND parameter_value = 'Walmart'
53 THEN 1
54 ELSE 0
55 END
56 ) cond3
57 FROM gc_forecast_parameters
58 GROUP BY forecast_id) gf
59 WHERE gc_forecast.forecast_id = gf.forecast_id
60 AND gf.cond1 = 1
61 AND gf.cond2 = 1
62 AND gf.cond3 = 1;
FORECAST_ID FORECA F E
100 Q12009 N Y
SQL> -
Help with selecting files from script menu or drag and drop
I found this scale images applescript online. It works great when a bunch of files is dragged on top of the script but I would like it to also work when a folder or group of files is selected in the Finder and I activate it from the scripts menu.
I can't get my on run statement to work. I'm not really an Applescript guy so I'm really just asking if someone can help finish what I started in this on run.
-- save in Script Editor as Application
-- drag files to its icon in Finder
property target_width : 120
property save_folder : ""
on run
tell application "Finder"
activate
set folder_path to quoted form of (POSIX path of (the selection as alias))
set theItems to every file of folder_path
end tell
end run
on open some_items
-- do some set up
tell application "Finder"
-- get the target width, the default answer is the property target_width
set new_width to text returned of ¬
(display dialog "Target width:" default answer target_width ¬
buttons {"OK"} default button "OK")
if new_width as integer > 0 then
set target_width to new_width
end if
-- if the save_folder property has not been set,
-- set it to the folder containing the original image
if save_folder is "" then
set save_folder to ¬
(container of file (item 1 of some_items) as string)
end if
-- get the folder to save the scaled images in,
-- default folder is the property save_folder
set temp_folder to ¬
choose folder with prompt ¬
"Save scaled images in:" default location alias save_folder
set save_folder to temp_folder as string
end tell
-- loop through the images, scale them and save them
repeat with this_item in some_items
try
rescaleand_save(thisitem)
end try
end repeat
tell application "Image Events" to quit
end open
on rescaleand_save(thisitem)
tell application "Finder"
set new_item to save_folder & "scaled." & (name of this_item)
end tell
tell application "Image Events"
launch
-- open the image file
set this_image to open this_item
set typ to this_image's file type
copy dimensions of this_image to {current_width, current_height}
scale this_image by factor (target_width / current_width)
save this_image in new_item as typ
end tell
end rescaleandsaveWhen items are dragged to your script's icon they are passed in to the on open handler, so this triggers:
on open some_items
and the dragged items are passed in as some_items
In contrast, when you double-click on the script, or invoke it via the Script menu, this runs the on run handler:
on run
tell application "Finder"
activate
folder_path to quoted form of (POSIX path of (the selection as alias))
set theItems to every file of folder_path
end tell
end run
However, there's nothing in this block that actually does anything with the selection - you (dangerously) assume that the selection is a folder (you really should check first), and just set theItems to every file in that folder then you exit.
So to do what you want you'll need to edit your run handler to filter the selection and pass files over to the code that does the hard work.
You already have the basis for this - your rescaleandsave() handler, so it's just a matter of identifying the files in the selection and passing those over to that handler:
on run
tell application "Finder"
set cur_selection to (get selection) -- get the selection
repeat with each_item in cur_selection -- iterate through
if class of each_item is folder then -- do we have a folder?
set theFiles to every file of each_item -- if so, get its contents
repeat with each_file in theFiles -- iterate through them
my rescaleand_save(eachfile) -- and process them
end repeat
else if class of each_item is document file then -- do we have a file selected?
my rescaleand_save(eachitem) -- if so, process it
end if
end repeat
end tell
end run
So the idea here is that the run handler gets the selection and works through the (potentially-numerous) items. For each selected item it checks whether its a folder or a file, if its a folder it gets all the files within and passes them to the rescaleandsave handler.
Note that this is not recursive - it won't catch files within folders within folders - since it only looks at the top level of selected folders, but it wouldn't be hard to rework the script to handle that if that's what you need. -
Help with select code??
I have a calendar program in jsp. The users can enter description for the dates. These dates are stored in the database. I need to provide colors to those dates,which have a value 'N' in the weekender field. Am able to write the query, but am not able to provide the color. how can i do it? please help..
<%@ page import="java.util.List"%>
<%@page import="java.sql.*, java.util.*, java.text.*" %>
<%@page import="java.sql.Connection, java.sql.DriverManager,java.sql.ResultSet,java.sql.SQLException" %>
<html>
<head>
<title>Print a month page.</title>
<meta name="version">
<script>
var lastId = "";
var curId = "";
function selectDate(f)
if(document.forms[0].lastDateId != null)
lastId = document.forms[0].lastDateId.value;
if(lastId != document.forms[0].todayId.value)
if(document.getElementById(lastId).title == "")
document.getElementById(lastId).style.backgroundColor='white';
if(f.id != document.forms[0].todayId.value)
document.getElementById(f.id).style.backgroundColor='blue';
document.forms[0].lastDateId.value=f.id;
curId = f.id;
document.getElementById("descr").style.visibility='visible';
document.forms[0].descText.value = f.title;
function setTitle()
document.getElementById(curId).title=document.forms[0].descText.value;
if(document.forms[0].descText.value == "" && curId != document.forms[0].todayId.value)
document.getElementById(curId).style.backgroundColor='white';
else
if(document.forms[0].list.value == "" )
document.forms[0].list.value = curId+":"+document.getElementById(curId).title;
else
list = replaceList(document.forms[0].list.value,curId);
list = list+","+curId+":"+document.getElementById(curId).title;
document.forms[0].list.value = list;
document.getElementById("descr").style.visibility='hidden';
function replaceList(list,id)
arr = list.split(",");
newlist = "";
for(i in arr)
if(arr.match(id) == null)
if(newlist == "")
newlist = arr[i];
else
newlist += ","+arr[i]+",";
return newlist
function showCalendar()
location.href="CalendarPage.jsp?year="+document.forms[0].year.value;
</script>
</head>
<body bgcolor="#c6d9e4">
<%
Connection con = null;
response.setContentType("text/html");
try
String driverName = "com.mysql.jdbc.Driver";
Class.forName(driverName);
String serverName = "192.168.10.5";
String mydatabase = "Trainees";
String url = "jdbc:mysql://" + serverName + "/" + mydatabase;
String username = "venkat";
String password = "venkat";
con = DriverManager.getConnection(url, username, password);
Statement stmt = null;
ResultSet rset = null;
PreparedStatement PREPstmt1;
stmt = con.createStatement();
String year = request.getParameter("year");
out.println("year value is : "+year);
String date="",descr="";
String list = request.getParameter("list");
if(list != null)
String dateDescrList[] = list.split(",");
for(int i=0;i<dateDescrList.length;i++)
String listObj = dateDescrList[i];
if(!listObj.equals("") || !listObj.trim().equals(""))
date= year+"-"+listObj.substring(0,listObj.indexOf(":"));
descr = listObj.substring(listObj.indexOf(":")+1);
out.println("date is : "+date);
out.println("description is : "+descr);
String query = "insert into Holiday(HolidayDate, Description, Weekender) VALUES (?, ?, 'N')";
PREPstmt1=con.prepareStatement(query);
PREPstmt1.setString(1,date);
PREPstmt1.setString(2,descr);
PREPstmt1.executeUpdate();
catch(Exception e)
System.err.println("Exception: " + e.getMessage());
finally
try
if(con != null)
con.close();
catch(SQLException e)
%>
<%
Calendar c = Calendar.getInstance( );
boolean yyok = false;
int yy = 0, mm = 0;
String yyString = String.valueOf(c.get(Calendar.YEAR)); //setting calendar with current year
String STyear = request.getParameter("year"); //to get selected year
if(STyear != null) //If an year is selected, then set that year. Else Current Year
yyString=STyear;
if (yyString != null && yyString.length() > 0)
try
yy = Integer.parseInt(yyString);
yyok = true;
catch (NumberFormatException e)
out.println("Year " + yyString + " invalid");
if (!yyok)yy = c.get(Calendar.YEAR);
mm = c.get(Calendar.MONTH);
String todayId = "";
%>
<form method=get action="CalendarPage.jsp">
Enter Year : <select name="year">
<%
for(int i=2000;i<=2015;i++)
if(i==Integer.parseInt(yyString))
%>
<OPTION SELECTED= <%=i%> > <%=i%> </option>
<%
else
%>
<OPTION VALUE= <%=i%> > <%=i%> </option>
%>
<%
%>
</select>
<input type="button" value="Display" onClick="showCalendar()">
<br><br>
<div id="descr" style="visibility:hidden">Enter Description : <input type="text" name="descText" value=""> </div>
<br>
<%
String driverName = "com.mysql.jdbc.Driver";
Class.forName(driverName);
String serverName = "192.168.10.5";
String mydatabase = "Trainees";
String url = "jdbc:mysql://" + serverName + "/" + mydatabase;
String username = "venkat";
String password = "venkat";
con = DriverManager.getConnection(url, username, password);
Statement stmt = null;
ResultSet rset = null;
PreparedStatement PREPstmt1;
stmt = con.createStatement();
rset=stmt.executeQuery("select count(*) from Holiday where YEAR(HolidayDate)='"+yyString+"'");
int cnt=0;
boolean ALflag=false;
while(rset.next())
cnt= rset.getInt(1);
out.println("count is : "+cnt);
if(cnt>1)
ALflag=true;
%>
<%
rset=stmt.executeQuery("select count(*) from Holiday where Weekender='N'");
int cnte=0;
boolean SELflag=false;
while(rset.next())
cnte = rset.getInt(1);
out.println("count is : "+cnte);
if(cnte>1)
SELflag=true;
%>
<%!
String[] months = {
"January", "February", "March",
"April","May", "June",
"July", "August","September",
"October", "November", "December"
int dom[] = {
31, 28, 31, 30,
31, 30, 31, 31,
30, 31, 30, 31
%>
<%
int leadGap = 0;
%>
<table border="0" width="100%" align="Left">
<%
GregorianCalendar calendar =null;
for(int j=0;j<12;j++)
calendar = new GregorianCalendar(yy, j, 1);
if(j==0 || j%3==0)
%>
<tr>
<%
%>
<td halign="top" >
<table border="1" width="33%" align="Left"><tr align="right">
<th colspan=7>
<%= months[j] %>
<%= yy %>
</th>
</tr>
<tr>
<td>Sun<td>Mon<td>Tue<td>Wed<td>Thu<td>Fri<td>Sat
</tr>
<%
leadGap = calendar.get(Calendar.DAY_OF_WEEK)-1;
int daysInMonth = dom[j];
if (calendar.isLeapYear(calendar.get(Calendar.YEAR)) && j == 1)
++daysInMonth;
out.println("<tr>");
out.println(" ");
for (int i = 0; i < leadGap; i++)
out.print("<td> </td>");
for (int iday = 1; iday <= daysInMonth; iday++)
out.println("<td>");
int dayOfWeek = (leadGap + iday) % 7;
GregorianCalendar today = new GregorianCalendar();
if(today.get(Calendar.DATE) == iday && today.get(Calendar.MONTH) == j)
todayId = iday+"-"+(j+1);
%>
<div id="<%=((j+1)+"-"+iday)%>" onClick="selectDate(this)" style="background-color:#cccc00" title="" ><%=iday %></div>
<%
else
if(dayOfWeek <= 1)
String str = yyString+"-"+(j+1)+ "-"+ iday;
if((dayOfWeek == 0) && (ALflag==false))
String query = "insert into Holiday VALUES ('" + str + "','Saturday','Y')";
stmt=con.createStatement();
stmt.executeUpdate(query);
else if ((dayOfWeek == 1) && (ALflag==false))
String query = "insert into Holiday VALUES ('" + str + "','Sunday','Y')";
stmt=con.createStatement();
stmt.executeUpdate(query);
%>
<div id="<%=((j+1)+"-"+iday)%>" onClick="selectDate(this)" style="background-color:#cccccc" title=""> <%=iday %></div>
<%
else
%>
<div id="<%=((j+1)+"-"+iday)%>" onClick="selectDate(this)" style="background-color:white" title="" ><%=iday %></div>
<%
out.println("</td>");
if(calendar.getActualMaximum(Calendar.DAY_OF_MONTH) == iday)
out.println("</td></tr></table>");
else if ((leadGap + iday) % 7 == 0)
out.println("</tr>");
out.println("<tr>");
%>
</td>
<%
if((j+1)%3==0)
%>
</tr>
<%
%>
<input type="hidden" name="lastDateId" value="<%=todayId%>">
<input type="hidden" name="todayId" value="<%=todayId%>">
<input type="hidden" name="list" value="">
<input type="submit" value="Submit" onClick="setTitle()">
</form>
</body>
</table>
</html>
This is the extract of the above code. This is how i have provided the query. In which part of my above code should i provide the coloring aspect. If the (SELflag==false), then i want to provide the color. where should i give? please help
<%
rset=stmt.executeQuery("select count(*) from Holiday where Weekender='N'");
int cnte=0;
boolean SELflag=false;
while(rset.next())
cnte = rset.getInt(1);
out.println("count is : "+cnte);
if(cnte>1)
SELflag=true;
%>Here is the calendar code, which i have used. Where should i use the code to check . i am able to get the count of user inputted days. i want to use the code,
if(SELflag==false)
give color.
where can i give this if code, to get the color?
<%
rset=stmt.executeQuery("select count(*) from Holiday where Weekender='N'");
int cnte=0;
boolean SELflag=false;
while(rset.next())
cnte = rset.getInt(1);
out.println("count is : "+cnte);
if(cnte>1)
SELflag=true;
%>
<%!
String[] months = {
"January", "February", "March",
"April","May", "June",
"July", "August","September",
"October", "November", "December"
int dom[] = {
31, 28, 31, 30,
31, 30, 31, 31,
30, 31, 30, 31
%>
<%
int leadGap = 0;
%>
<table border="0" width="100%" align="Left">
<%
GregorianCalendar calendar =null;
for(int j=0;j<12;j++)
calendar = new GregorianCalendar(yy, j, 1);
if(j==0 || j%3==0)
%>
<tr>
<%
%>
<td halign="top" >
<table border="1" width="33%" align="Left"><tr align="right">
<th colspan=7>
<%= months[j] %>
<%= yy %>
</th>
</tr>
<tr>
<td>Sun<td>Mon<td>Tue<td>Wed<td>Thu<td>Fri<td>Sat
</tr>
<%
leadGap = calendar.get(Calendar.DAY_OF_WEEK)-1;
int daysInMonth = dom[j];
if (calendar.isLeapYear(calendar.get(Calendar.YEAR)) && j == 1)
++daysInMonth;
out.println("<tr>");
out.println(" ");
for (int i = 0; i < leadGap; i++)
out.print("<td> </td>");
for (int iday = 1; iday <= daysInMonth; iday++)
out.println("<td>");
int dayOfWeek = (leadGap + iday) % 7;
GregorianCalendar today = new GregorianCalendar();
if(today.get(Calendar.DATE) == iday && today.get(Calendar.MONTH) == j)
todayId = iday+"-"+(j+1);
%>
<div id="<%=((j+1)+"-"+iday)%>" onClick="selectDate(this)" style="background-color:#cccc00" title="" ><a href="#" style="text-decoration:none;color:808080"><%=iday %> </a></div>
<%
else
if(dayOfWeek <= 1)
String str = yyString+"-"+(j+1)+ "-"+ iday;
if((dayOfWeek == 0) && (ALflag==false))
String query = "insert into Holiday VALUES ('" + str + "','Saturday','Y')";
stmt=con.createStatement();
stmt.executeUpdate(query);
else if ((dayOfWeek == 1) && (ALflag==false))
String query = "insert into Holiday VALUES ('" + str + "','Sunday','Y')";
stmt=con.createStatement();
stmt.executeUpdate(query);
%>
<div id="<%=((j+1)+"-"+iday)%>" onClick="selectDate(this)" style="background-color:#cccccc" title=""> <a href="#" style="text-decoration:none;color:808080"><%=iday %> </a></div>
<%
else
%>
<div id="<%=((j+1)+"-"+iday)%>" onClick="selectDate(this)" style="background-color:white" title="" ><a href="#" style="text-decoration:none;color:808080"><%=iday %> </a></div>
<%
out.println("</td>");
if(calendar.getActualMaximum(Calendar.DAY_OF_MONTH) == iday)
out.println("</td></tr></table>");
else if ((leadGap + iday) % 7 == 0)
out.println("</tr>");
out.println("<tr>");
%>
</td>
<%
if((j+1)%3==0)
%>
</tr>
<%
%>
<input type="hidden" name="lastDateId" value="<%=todayId%>">
<input type="hidden" name="todayId" value="<%=todayId%>">
<input type="hidden" name="list" value="">
<input type="submit" value="Submit" onClick="setTitle()">
</form>
</body>
</table>
</html> -
Need help with select within select - daterange
I use Crystal Reports v12.3.0.601 - I am a beginner.
Problem:
TABLE: ACCOUNTBILLFEE
Columns are
FOLDERRSN
STAMPDATE
BILLNUMBER
PAYMENTAMOUNT
There are over 500,000 rows/ records...
And I need to report the FOLDERRSN which has at least one {ACCOUNTBILLFEE.STAMPDATE} in DateTime
(2014, 05, 01, 00, 00, 01) to DateTime (2014, 05, 31, 23, 59, 59)
Out-put required is:
FOLDERSN | STAMPDATE | BILLNUMBER | PAYMENTAMOUNT
Group by FOLDERRSN
1010234 May01,2014 1111 25000
May25, 2014 1112 5000
Jan 05, 2013 998 500
1034567 May5, 2014 11325 5000
1033999 May15, 2014 6752 15000
Dec5 , 2011 1132 25000
Please help -
The critical part for me, is to display payments not within the date range in 'select expert' statement.
Currenlty my report reflects only payments for FOLDERRSN, where {ACCOUNTBILLFEE.STAMPDATE} in DateTime
(2014, 05, 01, 00, 00, 01) to DateTime (2014, 05, 31, 23, 59, 59) and not other payments outside the date range specified.
Thank you for your time.Hi Abilash,
This worked !!!
My brother helped me with it here....ofcourse you have intiated the intial idea.
It worked when i used the following SQL at 'Add Command'
Select * from DATABASE_NAME.ACCOUNTBILLFEE A
Where A.FOLDERSN = any ( select B.FOLDERSN from DATABASE_NAME.ACCOUNTBILLFEE B
where B.STAMPDATE >= TO_DATE('20140501', 'YYYYMMDD')
AND B.STAMPDATE <= TO_DATE('20140531', 'YYYYMMDD'))
Excellent support - Thank you so much for your immediate attention and response.
I know, how hard it is to understand someones requirement and suggest solutions.
You are the best and most helpful I have ever come across in my life.
Thank you for your kind heart and extending help to me.
Regs,
Sridhar Lam -
Well guys, I have a problem here and I didn't find any solutions
So maybe someone of you, can help me!
My problem is:
I have 2 numbers (100 and -200) and I have to plot the greater value.
The problem is for me the signal of -(minus) doesn't means nothing....
For the program I'm making, the -200 is greater than 100
So I tryed put bouth as absolute value, but when I have the "answer" only appears the "200"
and I need it appears -200
So I thought about something like that:
I use a select function and maybe do something like that:
So I have to make something at True or False value at S to make this work!
If true I receive 100, if is false I receive -200
Thanks!I dont know why is in this section. I posted it on LabVIEW part!
Well Dennis I make it like that:
But now I have a problem
I do the same calc for 3 differents variables like A, B, C
and after that I have to calc which value is the "greater"
But my problem is, If I have the values "-350 300 -400"
the greater will be "300" but for me the "minus" don't mean anything
so I need the greater value is "400"
For all positive values, its works fine!
I compare A and B, after that the greater is compared with C and have a result!
but When I have negative values and positive values... I got that problem...
and When I have only negative values I have a problem too.
"-300 -400 -500" for me the greater value have to be "-500" but labview shows "-300"
because -300 is greater than -500 in algebriac.
And If I use absolute values I will always have a positive value... but I need to know if the value is negative or positive
Anyone, can help me with that?
Thanks
Message Edited by EduU on 10-29-2009 11:06 AM -
Help with select list item and dynamics action
G'Day Apex Gurus,
I having problems trying to achieve to trigger the help window of a select item automatically. A help window is triggered when the select item label is clicked but my client would like to be triguered automatically as soon as the user click to see the options in the select list.
I think that I should be able to do it with dynamic actions but I can not get it to work.
I know when someone click on the label of the select list item trigger this JavaScript
javascript:popupFieldHelp('277938589795252851','1545903379570909')
So I want to trigger the javascript also when the user click of the select list item and pull down the options and for that I think that Dynamic actions is the way to go but I can't get it right.
This is what I a doing:
I created a Dynamic option as follow:
Name : test
Sequence: 30
Even: Click
Selection type: Item(s)
Item(s): P1_RATING <- a selection list item
Condtion: - No Condition -
True Actions
Sequence: 10
Action : Execute JavaScript Code
Fire when event result is :True
Fire on page load: ticked
Code: javascript:popupFieldHelp('277938589795252851','1545903379570909')
I appreciate any one who can tell me what i am doing wrong here or provide a solution to my problem of achieving to trigger the help window of a select item automatically.
Kind regards
CarlosHi Carlos,
I set up a test case in exactly the same way and it worked fine for me. I created a page item called P1_DA_DEMO and added some static select list values then added some help text. The settings I used are below, I suggest you try again but also make sure you have no other Javascript errors on the page. Use a tool like firebug to check.
Name : Dynamic Action Demo
Sequence: 10
Even: Click
Selection type: Item(s)
Item(s): P1_DA_DEMO <- a selection list item
Condtion: - No Condition -
True Actions
Sequence: 10
Action : Execute JavaScript Code
Fire when event result is :True
Fire on page load: Not Ticked
Code: javascript:popupFieldHelp('277938589795252851','1545903379570909')
Event Scope set a s Bind.
Thanks
Paul -
Dear All,
I am new to SAP(ABAP) have been given this assignment sort of ....plz help
1. Write a program to fetch all the sales orders and line items with in a data range.
Selection screen fields: Sales Order Number
Document type
Sales order date.
To display in the output report should contain following fields:
1. Sales Order number
2. item number
3. net price
4. net value
5. document type
Use Tables :vbak and vbap.Hi,
Try this out.
REPORT yjjtest MESSAGE-ID zm.
TABLES: vbap, vbak.
DATA: BEGIN OF i_output OCCURS 0,
vbeln LIKE vbap-vbeln,
posnr LIKE vbap-posnr,
netwr LIKE vbap-netwr,
netpr LIKE vbap-netpr,
auart LIKE vbak-auart,
END OF i_output.
SELECTION-SCREEN BEGIN OF BLOCK blk1 WITH FRAME TITLE text-001.
" text-001 as Selection
SELECT-OPTIONS: s_vbeln FOR vbap-vbeln,
s_auart FOR vbak-auart ,
s_audat FOR vbak-audat.
SELECTION-SCREEN END OF BLOCK blk1.
START-OF-SELECTION.
SELECT a~vbeln
a~posnr
a~netwr
a~netpr
b~auart
INTO TABLE i_output
FROM vbap AS a
INNER JOIN vbak AS b
ON a~vbeln = b~vbeln
WHERE a~vbeln IN s_vbeln
AND b~auart IN s_auart
AND b~audat IN s_audat.
IF sy-subrc NE 0.
MESSAGE e000 WITH text-002. " No data found for the selection criteria
ENDIF.
WRITE:/ 'Program to fetch all the sales orders and line items'.
ULINE.
WRITE:/001 'Sales Order number',
012 'Item Number',
025 'Net Price',
050 'Net Value',
070 'Document Type'.
ULINE.
LOOP AT i_output.
WRITE:/001 i_output-vbeln,
012 i_output-posnr,
025 i_output-netwr,
050 i_output-netpr,
070 i_output-auart.
CLEAR i_output.
ENDLOOP.
Hope this solves ur query.
Sample output
TEST Program
Program to fetch all the sales orders and line items
Sales OrderItem Number Net Price Net Value Document Type
10000000 000010 0.00 0.00 ZNOR
10000000 000020 0.00 0.00 ZNOR
10000006 000010 0.00 0.00 ZNOR
10000007 000060 0.00 0.00 ZERO
10000007 000020 0.00 0.00 ZERO
10000007 000050 0.00 0.00 ZERO
10000007 000040 0.00 0.00 ZERO
10000007 000030 0.00 0.00 ZERO
10000007 000010 0.00 0.00 ZERO
10000008 000010 13,825.35 3,675.00 ZERO
10000009 000010 0.00 0.00 ZERO
10000010 000010 47,002.06 2,637.60 ZERO
10000011 000010 0.00 0.00 ZERO
10000012 000010 36,193.40 1,522.01 ZERO
10000014 000010 0.00 0.00 ZERO
10000015 000050 0.00 0.00 ZERO
10000015 000010 0.00 0.00 ZERO
10000015 000020 0.00 0.00 ZERO
Please reward points and clos ethe thread. -
I am stuck with a problem and I cannot figure it out. I need to be able to extract data based on the records in the BSIS table which do NOT have a corrosponding entries in the BSIK or the BSID table. I need only the GL records. I am trying the code below and I am not getting any data in the wt_bkpf table to use for selection the BSEG records. I have includedpart of my code that is relavant to this problem with hopes that someone could look at it and let me know what I am doing wrong
thanks in advance for the help.
REPORT y_tlh_extgl.
tables declaration
TABLES:
bkpf, " Accounting Document Header
bseg. " Accounting Document Segment
DATA: BEGIN OF t_upload_file OCCURS 0,
line(3000) TYPE c.
DATA: END OF t_upload_file.
variables declaration
DATA:
wv_index LIKE sy-index,
wv_item_index LIKE sy-index.
constants definition
DATA: BEGIN OF ws_bkpf,
belnr LIKE bkpf-belnr, " Reference
waers LIKE bkpf-waers, " Currency
bktxt LIKE bkpf-bktxt. " header text
INCLUDE STRUCTURE bkpf.
DATA: END OF ws_bkpf.
structures definition
DATA: BEGIN OF wt_bkpf OCCURS 0.
INCLUDE STRUCTURE ws_bkpf.
*INCLUDE STRUCTURE bkpf.
DATA: END OF wt_bkpf.
DATA: BEGIN OF wt_bkpf_hold OCCURS 0.
INCLUDE STRUCTURE ws_bkpf.
INCLUDE STRUCTURE bkpf.
DATA: END OF wt_bkpf_hold.
DATA: BEGIN OF ws_bseg,
belnr LIKE bseg-belnr, " Reference
hkont LIKE bseg-hkont, " G/L Account
bschl LIKE bseg-bschl,
wrbtr LIKE bseg-wrbtr,
dmbtr LIKE bseg-dmbtr,
dmbe2 LIKE bseg-dmbe2,
kostl LIKE bseg-kostl, " Cost center
sgtxt LIKE bseg-sgtxt, " Item text
aufnr LIKE bseg-aufnr, " Project
zuonr LIKE bseg-zuonr, " Assignment/Cntry of Dest
prctr LIKE bseg-prctr, " Profit center
vbund LIKE bseg-vbund, " Trading partner
umskz LIKE bseg-umskz, " Special G/L Indicator
mwskz LIKE bseg-mwskz. " Tax code
DATA: END OF ws_bseg.
DATA: BEGIN OF wt_bseg OCCURS 0.
INCLUDE STRUCTURE ws_bseg.
DATA: END OF wt_bseg.
DATA: BEGIN OF wt_gl_bsis OCCURS 0.
INCLUDE STRUCTURE bsis.
DATA: END OF wt_gl_bsis.
SELECTION-SCREEN BEGIN OF BLOCK blck WITH FRAME.
PARAMETERS:
p_bukrs LIKE bkpf-bukrs OBLIGATORY
DEFAULT wc_bukrs_5520.
SELECT-OPTIONS:
s_belnr FOR bkpf-belnr,
s_monat FOR bkpf-monat,
s_gjahr FOR bkpf-gjahr OBLIGATORY.
SELECTION-SCREEN SKIP 1.
PARAMETERS:
p_svfile LIKE rlgrap-filename
DEFAULT '/DEV/MFGPRO/TLH_EXTRACT_xx.txt'
NO-DISPLAY.
SELECTION-SCREEN END OF BLOCK blck.
SELECTION-SCREEN BEGIN OF BLOCK b2 WITH FRAME TITLE text-012 .
PARAMETERS:p_ipath TYPE rlgrap-filename OBLIGATORY." LOWER CASE.
SELECTION-SCREEN END OF BLOCK b2.
INITIALIZATION
INITIALIZATION.
PERFORM f_initialize_some_data.
AT SELECTION-SCREEN.
PERFORM f_preliminary_checks.
START-OF-SELECTION.
PERFORM f_get_data.
PERFORM f_split_data.
PERFORM f_transfer_data_to_server.
PERFORM write_data.
END-OF-SELECTION.
Routines definition
FORM f_initialize_some_data .
s_gjahr-option = 'BT'.
s_gjahr-sign = 'I'.
s_gjahr-low = '2005'.
s_gjahr-high = '2006'.
APPEND s_gjahr.
ENDFORM. " f_initialize_some_data
FORM f_get_data .
SELECT * INTO TABLE wt_GL_BSIS
FROM bsis
WHERE bukrs EQ p_bukrs
AND belnr IN s_belnr
AND gjahr IN s_gjahr.
IF sy-dbcnt IS INITIAL.
MESSAGE i208(00) WITH text-001.
STOP.
ENDIF.
loop at wt_GL_BSIS.
DATA: wa_bsik type bsik.
DATA: wa_bsid type bsid.
SELECT SINGLE * FROM BSIK
INTO CORRESPONDING FIELDS OF wa_bsik
WHERE bukrs EQ p_bukrs
AND belnr EQ wt_GL_BSIS-belnr
AND gjahr EQ s_gjahr.
if sy-subrc = 0.
exit.
ELSE.
SELECT SINGLE * FROM BSId
INTO CORRESPONDING FIELDS OF wa_bsid
WHERE bukrs EQ p_bukrs
AND belnr EQ wt_GL_BSIS-belnr
AND gjahr EQ s_gjahr.
if sy-subrc = 0.
exit.
ELSE.
write: / 'getting gl record'.
SELECT belnr waers bktxt
INTO TABLE wt_bkpf_hold
FROM bkpf
WHERE belnr EQ wt_gl_bsis-belnr
AND bukrs EQ wt_gl_bsis-bukrs
AND monat IN s_monat.
IF sy-dbcnt IS INITIAL.
MESSAGE i208(00) WITH text-001.
STOP.
ENDIF.
MOVE wt_bkpf_hold-belnr TO wt_bkpf-belnr.
MOVE wt_bkpf_hold-waers TO wt_bkpf-waers.
MOVE wt_bkpf_hold-bktxt TO wt_bkpf-bktxt.
APPEND wt_bkpf.
ENDIF.
ENDIF.
ENDLOOP.
SORT wt_bkpf BY belnr.
SELECT belnr hkont bschl wrbtr dmbtr dmbe2 kostl sgtxt aufnr zuonr
prctr vbund umskz mwskz
INTO TABLE wt_bseg
FROM bseg
FOR ALL ENTRIES IN wt_bkpf
WHERE bukrs EQ p_bukrs
AND belnr EQ wt_bkpf-belnr
AND gjahr EQ s_gjahr.
*ENDIF.
*ENDLOOP.
ENDFORM. " f_get_dataHi
If you want this:
SELECT * INTO TABLE wt_GL_BSIS
FROM bsis WHERE bukrs EQ p_bukrs
AND gjahr IN s_gjahr
AND belnr IN s_belnr
AND MONAT IS S_MONAT.
IF sy-dbcnt IS INITIAL.
MESSAGE i208(00) WITH text-001.
STOP.
ENDIF.
SORT WT_GL_BSIS BY BUKRS GJAHR BELNR.
LOOP AT WT_GL_BSIS.
u can have several items of the same document so u
should try to read BSEG and BKPF table once per every
document
IF WT_GL_BSIS-BUKRS <> OLDBUKRS OR
WT_GL_BSIS-BELNR <> OLDBELNR OR
WT_GL_BSIS-GJAHR <> OLDGJAHR.
Check if there're vendor or customer items
SELECT BUKRS FROM BSEG INTO WT_GL_BSIS-BUKRS
WHERE BUKRS = WT_GL_BSIS-BUKRS
AND BELNR = WT_GL_BSIS-BELNR
AND GJAHR = WT_GL_BSIS-GJAHR
Check vendor/customer item:
KOART = K ---> Vendor Item (BSIK)
KOART = D ---> Customer Item (BSID)
AND ( KOART = 'D' OR KOART = 'K' ).
EXIT.
ENDSELECT.
IF SY-SUBRC <> 0.
Get header data
SELECT SINGLE * INTO wt_bkpf_hold
FROM bkpf WHERE bukrs EQ wt_gl_bsis-bukrs
AND belnr EQ wt_gl_bsis-belnr
AND GJAHR EQ WT_GL_BSIS-GJAHR.
MOVE wt_bkpf_hold-belnr TO wt_bkpf-belnr.
MOVE wt_bkpf_hold-waers TO wt_bkpf-waers.
MOVE wt_bkpf_hold-bktxt TO wt_bkpf-bktxt.
APPEND wt_bkpf.
ENDIF.
OLDBUKRS = WT_GL_BSIS-BUKRS.
OLDBELNR = WT_GL_BSIS-BELNR.
OLDGJAHR = WT_GL_BSIS-GJAHR.
ENDLOOP.
Maybe you are looking for
-
How do i move open web pages back to the first page
When 'i go on the internet and after a while I have alot of web pages open, when using my pointer(mouse) and press the back arrow to go to previous pages, I am not able to use that function. So , what I wind up doing is closing Safari completely
-
Can Portal 3.0 and 8i/9i Database Software exist on same Machine?
Our current setup at work is webdb 2.1 and Oracle EE 8.0.5 residing on ONE physical server. (Sun Solaris)I need to upgrade the Software to Oracle EE 8.1.7 and Portal 3.0. We do not run Webdb as part of an internet or intranet site(These are controled
-
Once i download a pdf file to a word doc, how do i edit the doc
once i download a pdf file to a word doc how do i edit it
-
Help Required - Need to add current user as superuser
Is there a way to add my user account to the superuser group in Solaris 10? I need to install some pretty heavy software which involves unpacking and repacking war files so would like to be superuser throughout. I am using a VM and am not concerned w
-
2 tables: CREATE TABLE Requirement reqID int IDENTITY(1,1) PRIMARY KEY, req_result_id numeric(10,0) NOT NULL, description varchar(200), heading varchar(100), GO INSERT INTO Requirement VALUES (5296,'Cold pack','HH19_5'); INSERT INTO Requirement