NEED INPUT on this logic implementation .
Hi i have a req where in which .
a set of codes should process if the value of a variable is intitial or if it equal to the 1st value thats its populated with else its should give me an error message .
It like this
IF XYZ EQ INITIAL OR FIRST VALUE ITS POPULATED WITH
fuhgaofhf
ELSE
ERROR MEssage .
ENDIF .
Can u please suggest how to do this implementation.
Hi,
You can do like this
IF XYZ IS INITIAL OR XYZ EQ FIRST_VAL.
-do something-
ELSE
MESSAGE EXXX(msg_class).
ENDIF.
XXX must be your error number.
Hope this helps.
Regards,
Deepthi.
Similar Messages
-
Hi
I need a procedure 4 this logic,
Need to get 32+ inputs in procedure of same type varchar2,
If comp_id !=360
insert 32 inputs in table column-> value using custom-id
Note:
Column : brand-code,value,custom_name using custom_id
brand-code gets from comp-id from another table
i/p- from procedure comp_id and 32 inputs
This 32 inputs should use varray cocept
end if;
ex:
table 1
brand_code custom-id value editble
table 2
custom-id custom-name
Could you please share ur suggestionsCreate or replace procedure cdm_cl_proc is
v_sqnum number(3);
cursor c1 is
select dcn, pp_code from d_cl_ext;
Cursor c2 is
Select t_code, s_date, area_chrg, rc_pct from d_c_p_ext;
Begin
for v1 in c1
Loop
update d_cl set pp_code = v1.pp_code
where dcn=v1.dcn;
select d_sqnum into v_sqnum from d_cl
where dcn=v1.dcn;
For v2 in c2
Loop
Update d_c_p set area_chrg= v2.area_chrg, rc_pct=v2.rc_pct
Where t_code= v2.t_code and s_date = v2.s_date
and d_sqnum = v_sqnum;
if mod(c2%rowcount,1000)=0 then
commit;
end if;
End loop;
if mod(c1%rowcount,1000)=0 then
commit;
end if;
End loop;
Commit;
End;
I amable to load the data when dcn is matched but, if the dcn is not matched no data found error is coming. can u suggest error handling for this. -
Hi,
I need sequence for autogenerate of code
Table 1
id code
We need to autogenerate code for every new entity of id
ex:
id code
sbi sbi001
hsb hsb002
xyz xyz003
And
ex:
id code
sbi s001
hsb h002
xyz x003You can use a Sequence and Trigger in combination like this
create table t
id varchar2(10)
, code varchar2(25)
create sequence t_seq;
create or replace trigger t_trig before insert on t for each row
declare
l_seq integer;
begin
select t_seq.nextval into l_seq from dual;
:new.code := :new.id || to_char(l_seq, 'fm099');
end;
insert into t (id) values ('sbi');
insert into t (id) values ('hsb');
insert into t (id) values ('xyz');
select * from t; -
Need input for this requirement?
Hi All,
I got new requirement. In this i need to display one world map on that map i have so show blinking star for the customer countries.
if the user click on perticular blinking star i need to display some data.
How to achive this? please help me out.
Thanks and Regards,
Phani Kumar.Phani,
You can also use Google Maps API .You can find help in below links:
http://code.google.com/apis/maps/documentation/reference.html
http://net.tutsplus.com/javascript-ajax/this-is-how-you-use-the-google-maps-api/
-Suresh -
Hi,
Below is my table with columns like a,b,c
a b c
1 null null
null 2 null
null null 3
I need output like a b c
1 2 3Hi,
Here's one way
SELECT MIN (a) AS a
, MIN (b) AS b
, MIN (c) AS c
FROM my_table;
I hope this answers your question.
If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
Point out where the query above is giving the wrong results, and explain, using specific examples, how you get the correct results from the given data in those places. If you changed the query at all, post your code.Always say which version of Oracle you're using (e.g., 11.2.0.2.0).
See the forum FAQ: https://forums.oracle.com/message/9362002 -
Need query for this logic..
Hi,
Need a SQL query to achieve this..
Ex:
Select object_name from user_objects where object_name in('EMP','DEPT')
You will get 2 table names.
DEPT
EMP
Now I want to count how many records are there in each table
Output should be like
DEPT 4
EMP 13
Please let me know how can we write it ?
Thanks in Advance
DevenderYou need to create a function to cout rows.
Here is an example
CREATE OR REPLACE
FUNCTION get_rows (
t_owner IN varchar2 default user,
t_name IN varchar2
RETURN integer
IS
outVal integer;
BEGIN
select null
into outVal
from dba_tables
where ( owner=t_owner )
and ( table_name=t_name );
execute immediate 'select count(*) from '||t_owner||'.'||t_name into outVal;
RETURN outVal;
EXCEPTION
WHEN no_data_found THEN
return null;
END;
/And here is the query.
Processing ...
select owner,object_name,get_rows(owner,object_name) n_rows
from dba_objects
where object_name in('EMP','DEPT')
Query finished, retrieving results...
OWNER OBJECT_NAME ROWS
SCOTT EMP 14
SCOTT DEPT 4
2 row(s) retrieved -
How can I implement this logic
Hi,
I have 3 input parameters. One is a random value .
Inside a loop I read this random value . bsed on this value I would like to select between the other parameters.Let me use an example.
X is the random value. Y and Z are the other 2 parameters.
1- In the first iteration if X is greater than previous X , I would like to show the value of Z
2- In the second iteration If X< greater than preious X then I would like to keep showing Z if not I show Y
3- ( lets say we are showing y) In the 3rd iteration If X< greater than preious X then I would like to keep showing Y if not I show Z
So as said the value of X is used to toggle between Z and Y so when the condition is met we keep showing y or Z if not we show the other parameter.
Could you please help me to implement this logic in LV
ThanksYou only need a shift regsiter with a single output, your solution seems a bit convoluted.
Anyway, if you want to switch whenever the comparison is false, here's what you would do. Modify as needed.
LabVIEW Champion . Do more with less code and in less time .
Attachments:
Switch ValueMOD.vi 10 KB -
In this report i have marked one line..if this width < 30,i need to multiply by a number 0.3 and if the width >=30,it multiplies by 0.37...how to use this logic here..??? anyone can help??
Declare @FromDate Datetime
Declare @ToDate Datetime
Declare @SCCode nvarchar(30)
select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]'
select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
--Rcpt from PRDN (Condition checked for Return component exclusion also)
SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,
T2.DocNum AS 'WorkOrderNo',
b.DocNum as 'Issue Doc No',
ISNULL(d.DocNum,'') as 'Receipt Doc No',
b.U_IssPSCName as 'SubContractor Name',
T2.ItemCode as 'FG Item Code',
T3.ItemName as 'FG Item Name',
T2.PlannedQty as 'FG Planned Qty',
T2.U_OD as 'OD',
T2.U_ID as 'ID',
T2.U_OD/25.4 as 'Inches',
(T2.U_OD-T2.U_ID)/2 as 'Width',
0 as 'FG Pending Qty',
0 as 'FG Receipt Qty',
'' as 'Issue Item Code',
'' as 'Issue Item Name',
Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',
0 as 'Issue Item - Return Quantity',
'' as 'Return Doc No',
SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',
SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'
from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntry
INNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCode
LEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode not in (a.ItemCode)
LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode INNER JOIN OIGN d on c.DocEntry = d.DocEntry
WHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'
GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,T2.PlannedQty,T2.U_OD,T2.U_ID, T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2
UNION ALL
SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,
T2.DocNum AS 'WorkOrderNo',
b.DocNum as 'Issue Doc No',
ISNULL(d.DocNum,'') as 'Receipt Doc No',
b.U_IssPSCName as 'SubContractor Name',
T2.ItemCode as 'Item Code',
T3.ItemName as 'Item Name',
T2.PlannedQty as 'Planned Qty',
T2.U_OD as 'OD',
T2.U_ID as 'ID',
T2.U_OD/25.4 as 'Inches',
(T2.U_OD-T2.U_ID)/2 as 'Width',
(Select (T2.PlannedQty - (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum))) as 'Pending Qty',
(Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum) as 'Receipt Qty',
a.ItemCode as 'Issued Item Code',
a.Dscription as 'Issued Item Name',
Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',
(Select (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode))) as 'Issue Item - Return Quantity',
(ISNULL((Select (Select a2.DocNum from OIGN a2 where a2.DocEntry = a1.DocEntry) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode)),'')) as 'Return Doc No',
SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',
SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'
from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntry
INNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCode
LEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode in (a.ItemCode)
LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode LEFT JOIN OIGN d on c.DocEntry = d.DocEntry
WHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'
GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,T2.PlannedQty,T2.U_OD,T2.U_ID,T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2,a.ItemCode,a.Dscription order by T2.DocNum descHi,
Try this:
Declare @FromDate Datetime
Declare @ToDate Datetime
Declare @SCCode nvarchar(30)
select @FromDate = min(S0.Docdate) from dbo.OINM S0 where S0.Docdate >='[%0]'
select @ToDate = max(S1.Docdate) from dbo.OINM s1 where S1.Docdate <='[%1]'
--Rcpt from PRDN (Condition checked for Return component exclusion also)
SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,
T2.DocNum AS 'WorkOrderNo',
b.DocNum as 'Issue Doc No',
ISNULL(d.DocNum,'') as 'Receipt Doc No',
b.U_IssPSCName as 'SubContractor Name',
T2.ItemCode as 'FG Item Code',T3.ItemName as 'FG Item Name',T2.PlannedQty as 'FG Planned Qty',T2.U_OD as 'OD',T2.U_ID as 'ID',T2.U_OD/25.4 as 'Inches',(T2.U_OD-T2.U_ID)/2 as 'Width',case when ((T2.U_OD-T2.U_ID)/2) <30 then ((T2.U_OD-T2.U_ID)/2) *0.3 end, 0 as 'FG Pending Qty',0 as 'FG Receipt Qty','' as 'Issue Item Code','' as 'Issue Item Name',Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',0 as 'Issue Item - Return Quantity','' as 'Return Doc No',SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntryINNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCodeLEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode not in (a.ItemCode)LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode INNER JOIN OIGN d on c.DocEntry = d.DocEntryWHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,T2.PlannedQty,T2.U_OD,T2.U_ID, T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2UNION ALL SELECT T2.U_STKNO as 'PRN No', T2.PostDate as Date,T2.DocNum AS 'WorkOrderNo',
b.DocNum as 'Issue Doc No',
ISNULL(d.DocNum,'') as 'Receipt Doc No',
b.U_IssPSCName as 'SubContractor Name',
T2.ItemCode as 'Item Code',T3.ItemName as 'Item Name',T2.PlannedQty as 'Planned Qty',T2.U_OD as 'OD',T2.U_ID as 'ID',T2.U_OD/25.4 as 'Inches',(T2.U_OD-T2.U_ID)/2 as 'Width',case when ((T2.U_OD-T2.U_ID)/2) >=30 then ((T2.U_OD-T2.U_ID)/2) *0.37 end, (Select (T2.PlannedQty - (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum))) as 'Pending Qty',(Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum and a1.ItemCode in (b1.itemcode) where b1.DocNum = t2.DocNum) as 'Receipt Qty',
a.ItemCode as 'Issued Item Code',
a.Dscription as 'Issued Item Name',
Sum(ISNULL(a.Quantity,0)) as 'Total Issue Quantity',
(Select (Select ISNULL(sum(a1.Quantity),0) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry
where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode))) as 'Issue Item - Return Quantity',
(ISNULL((Select (Select a2.DocNum from OIGN a2 where a2.DocEntry = a1.DocEntry) from IGN1 a1 inner join OWOR b1 on a1.BaseRef = b1.DocNum inner join WOR1 b2 on b1.DocEntry = b2.DocEntry where b1.DocNum = t2.DocNum and a1.ItemCode in (b2.itemcode)),'')) as 'Return Doc No',
SUM(ISNULL(a.U_IssPTotWeight,0)) as 'Total Issue Weight',
SUM(ISNULL(c.U_Quantity,0)) as 'Total Receipt Weight'
from OWOR T2 inner join WOR1 T4 on T2.DocEntry = T4.DocEntry
INNER JOIN OITM T1 ON T1.ItemCode = T4.ItemCode inner join OITM T3 on T3.ItemCode = T2.ItemCode
LEFT join IGE1 a on T2.DocNum = a.BaseRef Inner JOIN OIGE b on a.DocEntry = b.DocEntry and T4.ItemCode in (a.ItemCode)
LEFT JOIN IGN1 c ON c.BaseRef = T2.DocNum and T2.ItemCode = c.ItemCode LEFT JOIN OIGN d on c.DocEntry = d.DocEntry
WHERE b.Series in('101','20') and T2.PostDate >= @FromDate and T2.PostDate <= @ToDate and b.U_IssPSCName = '[%2]'
GROUP BY T2.U_STKNO, T2.PostDate, T2.DocNum, b.DocNum, d.DocNum, b.U_IssPSCName,T2.ItemCode,T3.ItemName,
T2.PlannedQty,T2.U_OD,
T2.U_ID,T2.U_OD/25.4,(T2.U_OD-T2.U_ID)/2,a.ItemCode,a.Dscription
order by T2.DocNum desc
Thanks & Regards,
Nagarajan -
Help urgently needed, I have installed Logic Pro 9, since then my Final Cut Pro X keep freezing. Anyone what is wrong and how to solve it? I desperately need help on this. Apple support says I have to pay £85 for to help me. Thanks
Just a word of advice. Never ever use the word "urgent" on this forum
-
HELLO EVERYONE I AM NEW TO THIS LOGIC PRO 8 PROGRAM YES OF COURSE I GOT A MAC AND I WAS JUST WONDERING A FEW THINGS:
HOW DOES THE PIANO ROLL WORK?
HOW DO I RECORD WITH IT?
WHAT ARE THE NEEDS FOR ALL THE PROJECTS IF I WANNA COMPOSE RNB WHICH DO I CHOOSE?
AND ALSO WHAT INTERFACE IS COMPATABLE I AM USING A FANTOM X6 AS WELL HOW DO I HOOK IT UP TO MY LAPTOP?HOW DOES THE PIANO ROLL WORK?
Hmm...yes. I think you took the right pill.
HOW DO I RECORD WITH IT?
Every tuesday, between one and three.
WHAT ARE THE NEEDS FOR ALL THE PROJECTS IF I WANNA COMPOSE RNB WHICH DO I CHOOSE?
I believe that's a swedish car.
AND ALSO WHAT INTERFACE IS COMPATABLE I AM USING A FANTOM X6 AS WELL HOW DO I HOOK IT UP TO MY LAPTOP?
I think it was the butler but I'm not sure. -
How to write code for this logic, plz help me very urgent
Hi All,
i am new to sap-abap, i got this work and i m working on this can any body help me in writing code, plz help me, this is very very urgent.
here i m giving my logic, can anybody send me the code related to this logic.
this is very urgent .
this program o/p should be in ALV format and need to create one commond 'SAVE" on this o/t list if user clicks save processedon and processedby fields in ZFIBUE should be updated automatically.
i am creating one custom table zfibue having fields: (serialno, bukrs, matnr,prdha,hkont,gsber,wrbtr,budat, credate, cretime,processed, processedon, processedby,mapped)
fields of zfibue:
serailno = numc
bukrs = char
matnr = char
prdha = char
hkont = char
gsber = char
wrbtr = char
budat = date
credate = date
cretime = time
processed= char
processedon = date
processedby = char
mapped = char are belongs to above type data types
and seelct-optionfields: s_bukrs for bseg-bukrs
s_hkont for bseg-hkont,
s_budat for bkpf-budat,
s_processed for zfibue-processed,
s_processedon for zfibue-processedon,
s_mapped. for zfibue-mapped
parameters: p_chk1 as checkbox,
p_chk2 as checkbox.
p_filepath type rlgrap-filename.
1.1 Validate the user inputs (S_BUKRS and S_HKONT) against respective check tables (T001 and SKB1). If the validation fails, provide respective error message. Eg: Invalid input for Company Code.
1.2 Fetch SERIALNO, BUKRS, MATNR, PRDHA, HKONT, GSBER, WRBTR, BUDAT, CREDATE, CRETIME, PROCESSED, PROCESSEDON, PROCESSEDBY, MAPPED from table ZFIBUE into internal table GT_ZFIBUE where BUKRS IN S_BUKRS, HKONT IN S_HKONT, BUDAT IN S_BUDAT, PROCESSED IN S_PROCESSED, PROCESSEDON IN S_PROCESSEDON, and MAPPED IN S_MAPPED.
1.3 If P_CHK2 = X, go to step 1.11. Else continue.
1.4 If P_CHK1 = X, continue. Else go to step 1.9
1.5 Fetch MATNR, PRDHA from MARA into GT_MARA for all entries in GT_ZFIBUE where MATNR = GT_ZFIBUE-MATNR.
1.6 Sort and delete adjacent duplicates from GT_MARA based on MATNR.
1.7 Loop through GT_ZFIBUE where PRDHA = blank.
Read Table GT_MARA based on MATNR = GT_ZFIBUE-MATNR.
IF sy-subrc = 0.
Move GT_MARA-PRDHA to GT_ZFIBUE-PRDHA.
Modify Table GT_ZFIBUE. Update Product Hierarchy
Endif.
Fetch PRDHA, GSBER from ZFIBU into GT_ZFIBU for all entries in GT_ZFIBUE where PRDHA = GT_ZFIBUE-PRDHA.
Read Table GT_ZFIBU based on PRDHA = GT_ZFIBUE-PRDHA.
IF sy-subrc = 0.
Move GT_ZFIBU-GSBER to GT_ZFIBUE-GSBER.
Move X to GT_ZFIBUE-MAPPED.
Modify Table GT_ZFIBUE.
Endif.
Endloop.
1.8 Modify database table ZFIBUE from GT_ZFIBUE.
1.9 Fill the field catalog table GT_FIELDCAT using the details of output fields listed in section Inputs/Outputs (above).
Eg: LWA_ FIELDCAT -SELTEXT_L = 'Serial Number.
LWA_ FIELDCAT -DATATYPE = NUMC.
LWA_ FIELDCAT -OUTPUTLEN = 9.
LWA_ FIELDCAT -TABNAME = 'GT_ZFIBUE'.
LWA_ FIELDCAT-FIELDNAME = 'SERIALNO'.
Append LWA_FIELDCAT to GT_FIELDCAT
Note: a) The output field GT_ZFIBUE-PROCESSED will be editable marking INPUT = X in field catalog (GT_FIELDCAT).
b) The standard ALV functionality will be used to give the user option for selecting all or blocks of entries at a time.
c) The PF-STATUS STANDARD_FULLSCREEN from function group SLVC_FULLSCREEN will be copied to the program and modified to include a SAVE button.
1.10 Call the function module REUSE_ALV_GRID_DISPLAY passing output table GT_ZFIBUE and field catalog GT_FIELDCAT. Additional parameters like I_CALLBACK_PF_STATUS_SET (= ZFIBUESTAT) and I_CALLBACK_USER_COMMAND (=HANDLE_USER_ACTION) will also be passed to handle user events. Go to 2.14.
1.11 Download the file to P_FILEPATH using function module GUI_DOWNLOAD passing GT_ZFIBUE.
1.12 Exit Program.
Logic to be implemented in routine Handle_User_Action
This routine will have the following interface:
FORM Handle_User_Action USING r_ucomm LIKE sy-ucomm
rs_selfield TYPE slis_selfield.
ENDFORM.
Following logic will be implemented in this routine:
1. If r_ucomm = SAVE, continue. Else exit.
2. Loop through GT_ZFIBUE where SEL_ROW = X. Row is selected
a. IF GT_ZFIBUE-PROCESSED = X.
i. GT_ZFIBUE-PROCESSEDON = SY-DATUM.
ii. GT_ZFIBUE-PROCESSEDBY = SY-UNAME.
iii. MODIFY ZFIBUE FROM work area GT_ZFIBUE.
Endif.
Endloop.Hi Swathi,
If it's very very urgent then you better get on with it, don't waste time on the web. Chop chop. -
Why do I need to catch this exception?
Hello all
This is a question about exception handling. I have to build a diary application that lets you save reminders on particular dates using xml. Just to make it a little tougher, I was not allowed to use the Calendar class. This is the code I wrote:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.*;
import java.text.*;
import javax.xml.parsers.*;
import org.xml.sax.*;
import java.io.*;
import org.w3c.dom.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
import static java.lang.Math.*;
public class CalendarAssignment extends JFrame implements ActionListener
int MonthLength [] = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
public JButton [] days = new JButton[43];
private JLabel lbl, reminderlbl;
private JPanel top, grid, remindercenter, reminderbottom;
private JFrame reminderframe;
private JTextField year1, reminderinput, dayno;
private JComboBox months;
private Container container;
private JButton fetch, save, cancel;
private Document doc;
private File file;
private Node node;
private String year, month, day;
public static void main( String[] args ) {
CalendarAssignment c = new CalendarAssignment( );
c.setSize( 400, 300 );
c.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
c.show( );
public CalendarAssignment( ) {
int CurrentYear, CurrentMonth;
String YearString, MonthString, Now;
Date today;
container = getContentPane( );
container.setLayout( new BorderLayout( ) );
SimpleDateFormat DateFormatter;
DateFormatter = new SimpleDateFormat( "MM.yyyy" );
today = new Date( );
Now = DateFormatter.format( today );
MonthString = Now.substring( 0,2 );
YearString = Now.substring( 3,7 );
CurrentMonth = Integer.valueOf( MonthString );
CurrentYear = Integer.valueOf( YearString );
top = new JPanel( );
String [] items = { "January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November",
"December" };
months = new JComboBox( items );
months.setEditable( false );
months.setSelectedIndex( CurrentMonth - 1 );
year1 = new JTextField( );
year1.setText( YearString );
year1.setEditable( true );
year1.setHorizontalAlignment( year1.CENTER );
fetch = new JButton( "Fetch Month" );
fetch.addActionListener( this );
top.setLayout( new GridLayout( 1, 3, 20, 0 ) );
top.add( months );
top.add( year1 );
top.add( fetch );
grid = new JPanel( );
grid.setLayout( new GridLayout( 7, 7, 0, 0 ) );
String [] week = { "Mon", "Tue", "Wed", "Thur", "Fri", "Sat", "Sun" };
for ( int a = 0; a < 7; a ++ ) {
JLabel lbl = new JLabel( week[a], JLabel.CENTER );
grid.add( lbl );
for ( int i = 0; i < 42; i ++ ) {
days[i] = new JButton( );
grid.add( days[i] );
days.addActionListener( this );
DrawCalendar( CurrentMonth, CurrentYear );
container.add( top, BorderLayout.NORTH );
container.add( grid, BorderLayout.CENTER );
private void DrawCalendar( int SelectMonth, int SelectYear ) {
int DisplayMonthLength, Buttons;
String ButtonID = "";
int OffSet = MonthStart( SelectMonth, SelectYear );
DisplayMonthLength = MonthLength [SelectMonth - 1];
if ( SelectMonth == 2 )
DisplayMonthLength += LeapYear( SelectYear );
for ( Buttons = 1; Buttons < 43; Buttons ++ ) {
if ( ( Buttons <= OffSet ) || ( Buttons > ( DisplayMonthLength + OffSet ) ) ) {
ButtonID = "";
days[Buttons-1].setEnabled( false );
else {
ButtonID = Integer.toString( Buttons - OffSet );
days[Buttons-1].setEnabled( true );
days[Buttons-1].setLabel( ButtonID );
grid.add( days[Buttons-1] );
private int LeapYear( int year ) {
int FourHundred, OneHundred, Fourth;
FourHundred = year % 400;
OneHundred = year % 100;
Fourth = year % 4;
if( ( ( FourHundred == 0 ) ) || ( ( OneHundred != 0 ) && ( Fourth == 0 ) ) )
return ( 1 );
else
return ( 0 );
private int MonthStart( int Month, int Year ) {
int OffSet, LastMonths, BeforeOrAfter, Years;
int AllDays = 0;
int YearDays = 365;
int YearMonths = 12;
BeforeOrAfter = Year - 2006;
Years = abs( BeforeOrAfter );
if( BeforeOrAfter != 0 )
BeforeOrAfter = BeforeOrAfter / Years;
switch( BeforeOrAfter ) {
case 1:
for( int a = 2006; a < Year; a ++ ) {
AllDays += YearDays + LeapYear( a );
AllDays += LastMonthsCalc( Month, Year );
break;
case -1:
for( int a = 2005; a > Year; a -- ) {
AllDays += YearDays + LeapYear( a );
for( LastMonths = YearMonths; LastMonths >= Month; LastMonths -- ) {
AllDays += MonthLength[LastMonths - 1];
if( LastMonths == 2 )
AllDays += LeapYear( Year );
break;
default:
if( Month > 1 )
AllDays += ( LastMonthsCalc( Month, Year ) );
OffSet = AllDays % 7;
if( BeforeOrAfter ==( -1 ) )
return( 6 - OffSet );
else if( OffSet > 0 )
return( OffSet - 1 );
else
return( 6 );
private int LastMonthsCalc( int Month, int Year ) {
int Counter;
int days = 0;
for( Counter = 1; Counter < Month; Counter ++ ) {
days += MonthLength[Counter - 1];
if( Counter == 2 )
days += LeapYear( Year );
return( days );
public void CreateReminder( String buttonID, String yearID, String monthID ) {
reminderframe = new JFrame( );
reminderlbl = new JLabel( );
reminderframe.setLayout( new GridLayout( 2, 1, 0, 0 ) );
remindercenter = new JPanel( );
reminderlbl = new JLabel( "Please type in reminder to be saved for " + buttonID + " " + monthID + " " + yearID + ":", JLabel.CENTER );
reminderinput = new JTextField( 30 );
reminderinput.setHorizontalAlignment( reminderinput.CENTER );
reminderinput.setEditable( true );
remindercenter.setLayout( new GridLayout( 2, 1, 0, 0 ) );
remindercenter.add( reminderlbl );
remindercenter.add( reminderinput );
reminderbottom = new JPanel( );
save = new JButton( "Save" );
save.addActionListener( this );
cancel = new JButton( "Cancel" );
cancel.addActionListener( this );
dayno = new JTextField( buttonID );
dayno.setEditable( false );
dayno.setEnabled( false );
dayno.show( false );
reminderbottom.setLayout( new FlowLayout( ) );
reminderbottom.add( save );
reminderbottom.add( cancel );
reminderbottom.add( dayno );
reminderframe.setSize( 500, 75 );
reminderframe.add( remindercenter );
reminderframe.add( reminderbottom );
reminderframe.pack( );
reminderframe.show( );
public void SaveReminder( String dayID, String yearID, String monthID ) throws Exception {
file = new File( "Diary.xml" );
doc = DocumentBuilderFactory.newInstance( ).newDocumentBuilder( ).parse( file.toURL( ).toString( ) );
String year = yearID;
String month = monthID;
String day = dayID;
//System.out.println( year );
//System.out.println( month );
//System.out.println( day );
CreateEntry( doc.getDocumentElement( ) );
writeXmlFile( );
public boolean CreateEntry( Node node ) {
Node searchNode;
searchNode = getYear( node );
if( searchNode == null ) {
Element newNode = doc.createElement( "Year" );
searchNode = node.appendChild( newNode );
newNode.setAttribute( "Id", year );
node = searchNode;
searchNode = getMonth( node );
if( searchNode == null ) {
Element newNode = doc.createElement( "Month" );
searchNode = node.appendChild( newNode );
newNode.setAttribute( "Id", month );
node = searchNode;
searchNode = getDay( node );
if( searchNode == null ) {
Element newNode = doc.createElement( "Day" );
searchNode = node.appendChild( newNode );
newNode.setAttribute( "Id", day );
node = searchNode;
String entry = reminderinput.getText( );
Node textNode = doc.createTextNode( entry );
node.appendChild( textNode );
return true;
private Node getYear( Node node ) {
node = node.getFirstChild( );
while( node != null ) {
if(node.getNodeName( ).equals( "Year" ) && String.valueOf( node.getAttributes( ).item( 0 ).getNodeValue( ) ) == year )
return node;
node = node.getNextSibling( );
return null;
private Node getMonth( Node node ) {
node = node.getFirstChild( );
while( node != null ) {
if( node.getNodeName( ).equals( "Month" ) && String.valueOf( node.getAttributes( ).item( 0 ).getNodeValue( ) ) == month )
return node;
node = node.getNextSibling( );
return null;
private Node getDay( Node node ) {
node = node.getFirstChild( );
while( node != null ) {
if( node.getNodeName( ).equals( "Day" ) && String.valueOf( node.getAttributes( ).item( 0 ).getNodeValue( ) ) == day )
return node;
node = node.getNextSibling( );
return null;
private void writeXmlFile( ) throws Exception {
Source source = new DOMSource( doc );
Result result = new StreamResult( file );
Transformer xformer = TransformerFactory.newInstance( ).newTransformer( );
xformer.setOutputProperty( OutputKeys.INDENT,"yes" );
xformer.setOutputProperty( OutputKeys.DOCTYPE_SYSTEM,"Diary.dtd" );
xformer.transform( source, result );
public void actionPerformed( ActionEvent e ) {
String IDButton = e.getActionCommand( );
String IDYear = year1.getText( );
Object IDMonthObj = months.getSelectedItem( );
if( e.getSource( ) == fetch ) {
String YearText = year1.getText( );
int YearNumber = Integer.valueOf( YearText );
int MonthsIndex = months.getSelectedIndex( ) + 1;
DrawCalendar( MonthsIndex, YearNumber );
else if( e.getSource( ) == cancel ) {
reminderframe.hide( );
else if( e.getSource( ) == save ) {
String IDDay = dayno.getText( );
String IDMonth = String.valueOf( IDMonthObj );
SaveReminder( IDDay, IDYear, IDMonth );
else {
String IDMonth = String.valueOf( IDMonthObj );
Toolkit.getDefaultToolkit( ).beep( );
int n = JOptionPane.showConfirmDialog( null, "Set reminder on this date?", "Question", JOptionPane.YES_NO_OPTION );
if( n == JOptionPane.YES_OPTION ) {
CreateReminder( IDButton, IDYear, IDMonth );
If you compile it, you will realise that I get an error about exception handling. My lecturer gave me an example code of how to do the same thing without using a GUI:
import javax.xml.parsers.*;
import org.xml.sax.*;
import java.io.*;
import java.util.*;
import org.w3c.dom.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.*;
import javax.xml.transform.stream.*;
public class CallDOM
Document doc;
File file;
Scanner input;
int year, month, day;
String currentYear, currentMonth;
public static void main(String args[]) throws Exception
CallDOM cd=new CallDOM();
CallDOM() throws Exception
file=new File("Diary.xml");
//create DOM from file
doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().parse(file.toURL().toString());
input=new Scanner(System.in);
System.out.println("1) Create entry");
System.out.println("2) Read entry");
System.out.println("3) Show Diary");
System.out.println("4) Quit");
int choice=input.nextInt();
while(choice!=4)
switch(choice)
case 1: GetDate();CreateEntry(doc.getDocumentElement());break;
case 2: GetDate();ReadEntry(doc.getDocumentElement());break;
case 3: ShowDiary(doc.getDocumentElement());
System.out.println("1) Create entry");
System.out.println("2) Read entry");
System.out.println("3) Show Diary");
System.out.println("4) Quit");
choice=input.nextInt();
writeXmlFile();
public void GetDate()
System.out.println("Enter date (dd mm yyyy)");
day=input.nextInt();
month=input.nextInt();
year=input.nextInt();
public boolean ReadEntry(Node node)
node = getYear(node);
if(node==null) return false;
node = getMonth(node);
if(node==null) return false;
node = getDay(node);
if(node==null) return false;
node = node.getFirstChild();
while(node!=null)
System.out.println(node.getNodeValue().trim());
node=node.getNextSibling();
return true;
public boolean CreateEntry(Node node)
Node searchNode;
searchNode = getYear(node);
if(searchNode==null)
Element newNode = doc.createElement("Year");
searchNode = node.appendChild(newNode);
newNode.setAttribute("Id",Integer.toString(year));
node = searchNode;
searchNode = getMonth(node);
if(searchNode==null)
Element newNode = doc.createElement("Month");
searchNode = node.appendChild(newNode);
newNode.setAttribute("Id",Integer.toString(month));
node = searchNode;
searchNode = getDay(node);
if(searchNode==null)
Element newNode = doc.createElement("Day");
searchNode = node.appendChild(newNode);
newNode.setAttribute("Id",Integer.toString(day));
node = searchNode;
System.out.println("Enter Text");
String entry=input.next();
entry+=input.nextLine();
Node textNode = doc.createTextNode(entry);
node.appendChild(textNode);
return true;
public void ShowDiary(Node node)
Stack<Node> stack=new Stack<Node>();
Node child;
stack.push(node);
while(!stack.empty())
node = stack.pop();
if(ProcessNode(node))
child = node.getLastChild();
while(child!=null)
stack.push(child);
child = child.getPreviousSibling();
private boolean ProcessNode(Node node)
if(node.getNodeName().equals("Year"))
currentYear=node.getAttributes().item(0).getNodeValue();
if(node.getNodeName().equals("Month"))
currentMonth=node.getAttributes().item(0).getNodeValue();
if(node.getNodeName().equals("Day"))
System.out.print(node.getAttributes().item(0).getNodeValue()+"/"+
currentMonth+"/"+currentYear+": ");
node=node.getFirstChild();
while(node!=null)
System.out.println(node.getNodeValue().trim());
node=node.getNextSibling();
return false;
return true;
private Node getYear(Node node)
node=node.getFirstChild();
while(node!=null)
if(node.getNodeName().equals("Year")
&& Integer.valueOf(node.getAttributes().item(0).getNodeValue())==year)
return node;
node = node.getNextSibling();
return null;
private Node getMonth(Node node)
node=node.getFirstChild();
while(node!=null)
if(node.getNodeName().equals("Month")
&& Integer.valueOf(node.getAttributes().item(0).getNodeValue())==month)
return node;
node = node.getNextSibling();
return null;
private Node getDay(Node node)
node=node.getFirstChild();
while(node!=null)
if(node.getNodeName().equals("Day")
&& Integer.valueOf(node.getAttributes().item(0).getNodeValue())==day)
return node;
node = node.getNextSibling();
return null;
private void writeXmlFile() throws Exception
Source source = new DOMSource(doc);
Result result = new StreamResult(file);
Transformer xformer = TransformerFactory.newInstance().newTransformer();
xformer.setOutputProperty(OutputKeys.INDENT,"yes");
xformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM,"Diary.dtd");
xformer.transform(source, result);
}My question is, why does the exceptions in the example code not need to be caught? And why do I have to catch the exceptions in my code? Several exceptions are thrown in the example code, but there is no catch statement.
Thanks for any advice!!Since your question didn't come with any relevant details, and since you have huge steaming piles of irrelevant code, all I can give is a general answer to "Why do I need to catch this exception?"
[url http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html]Exception tutorial at http://java.sun.com/docs/books/tutorial/essential/exceptions/index.html
Here's a quick overview of exceptions:
The base class for all exceptions is Throwable. Java provides Exception and Error that extend Throwable. RuntimeException (and many others) extend Exception.
RuntimeException and its descendants, and Error and its descendants, are called unchecked exceptions. Everything else is a checked exception.
If your method, or any method it calls, can throw a checked exception, then your method must either catch that exception, or declare that your method throws that exception. This way, when I call your method, I know at compile time what can possibly go wrong and I can decide whether to handle it or just bubble it up to my caller. Catching a given exception also catches all that exception's descendants. Declaring that you throw a given exception means that you might throw that exception or any of its descendants.
Unchecked exceptions (RuntimeException, Error, and their descendants) are not subject to those restrictions. Any method can throw any unchecked exception at any time without declaring it. This is because unchecked exceptions are either the sign of a coding error (RuntimeException), which is totally preventable and should be fixed rather than handled by the code that encounters it, or a problem in the VM, which in general can not be predicted or handled. -
Could you please provide me any inputs for this interesting requirement
Hi Experts,
I need to create a <b>report to diplay all reports</b> (such as z or A or any reports) <b>accessible through the SA38</b>, its title, last used (in past 1 year), how many time it was used per past 1 year, and number of different users. Any inputs on this would be very much helpful.
Thanks in advance,
VivenInteresting but not possible, to do that you need to have already implemented a trace function inside each program one year ago.
SAP didn't save this kind of data.
You could always have a look of the transaction STATTRACE.
Fred -
Help needed Regarding a business logic
Hi all,
My business requirement is
requires to get a checksum from the KIOSK field. This would be something like a rule that for a given KIOSK generates a number from 0 to 9.
The Field value contains alphanumerical
Can any of guys help me in this logic.how to generate a checksum for a given field..
Thanks & Regards;
VinitAlright I found something I am not sure if it is of use to you , A checksum is generally used to detect the integrity of file
it is calculated oin basis of hash algorithms so how it is useful to for incoming filed values i m not sure
Please find the links below
http://en.wikipedia.org/wiki/Checksum
http://www.fastsum.com/support/online-help/checksums.php
http://www.flounder.com/checksum.htm
http://www.mkyong.com/java/how-to-generate-a-file-checksum-value-in-java/
If it is useful , you need to implement a hash algorithm
regards
Ninad -
I need to add the logic for posting key,
I need to add the logic for posting key, if posting key = 50 then amount is credit (add negative sign in amount field).
I creadted this scenario in mapping, We wanted to make sure that the negative sign was placed in the amount field if the posting key was = 50. So it seems we are good. We will just need to test.
How i can test this case?
Please do needful.
Thanks in advance.Hi,
You need to use an IfElse node function in your mapping in which the input should be the posting key from the source structure.
You need to check in the IfElse statement whether the posting key=50, if it is true, then use concat node function to concat the negative sign("-") along with the original value to be passed to the amount field on the target side. Else, if the condition is false(i.e posting key!=50), then simply pass the value to the amount field as it is without adding the negative sign.
After the mapping is done, go to the test tab and then insert the values in the source fields and then execute from the lower left button showing start transformation. You need to test with the value of posting key=50 once and with the value not equal to 50 once.In the first case, the output amount field should have the negative sign, which should not be present in the second case.
You will find your target structure in the righter half of your screen. That's it mate
Thanks
Biswajit
Maybe you are looking for
-
Can I upgrade my processor in my pavilion dv7 4179nr laptop?
Can I upgrade my processor in my pavilion dv7 4179nr laptop from a 1.70 GHz to a 2.0+ GHz processor & if so, what kind & how much do they usually run? I am running Windows 7 Home Premium 64 bit.
-
How do I view images side by side in CS6?
In Photoshop CS5 I could click on a button to view images side by side or above and below. In CS6 my button is gone. How do I view images side by side/above and below?
-
Failed installing app on iphone 4s
helllo everyone, i just downloaded a game called SIXGUNS from itunes..its abot a 440Mb file. then i tryed to sync on my FACTORY UNLOCKED IPHONE 4S which is not jailbroken.. it completely synced but during installation it said SIX GUNS failed to insta
-
User settings not syncing in Premiere Pro CC
Searched around the forum and the rest of the web for help, couldn't quite find anything. My company just hired another videographer/editor and so I got upgraded from the old Production Premium 5.5 to CS CC so we'd be running the same version. My pro
-
Change Encore Project into a adobe air desktop application with password
Good afternoon, I am trying to find a a way that i can change or inport a Encore project into a adobe air desktop application so that a can password protect it. I have a training simulator built in Encore that has a large number of menus and videos t