Code for select statements needed
Hi Please give the code for this
Code (BUKRS), Vendor (LIFNR), Vendor Name (ZNAME1), PO_Date (AEDAT), PO Creator (ERNAM) from EKKO table
2. For the corresponding PO number (EBELN) from EKKO table, get PO Item Text (TXZ01) from EKPO table
3. For the corresponding PO number (EBELN) from EKKO table, get PO_Iten_No(EBELP), from EKPO table
4. For the corresponding PO number (EBELN) from EKKO table get the GR_Posting Dt(BUDAT) from EKBE table when PO History cat (HCT-EKBE) is equal to E .
a) For getting the first GR Posting date and first Invoice posting date, sort the column (BUDAT) of table, get the 1st GR_Posting_dt(BUDAT) when PO History cat (HCT-EKBE) is equal to E AND get the 1st Inv_Posting_Dt(BUDAT) when PO when PO History cat (HCT-EKBE) is equal to Q For this corresponding invoice date (when when PO History cat (HCT-EKBE) is equal to Q ) get the invoice number (BELNR) .
b) IF 1ST GR_POSTING_DATE < 1ST INVOICE_POSTING_DATE, DO NOT DISPLAY THE RESULT
5. For the corresponding PO number (EBELN) from EKKO table and Invoice_No (BELNR) (from step4,a),get Inv_Creator (ERNAM), Inv_Amount(REEWR), Currency (WAERS) from EKBE table when PO History cat (Hct-EKBE) is equal to Q
You might try reading the docs. There's a method selectAll() in JTextComponent
Similar Messages
-
Code for selection screen, urgent
Hi Everyone,
I need code for selection screen.
I have four radio buttons, p1, p2,p3,p4(assume)
If I select second radiobutton, remaining three radiobuttons should be in disable mode and also the information under them should be in disable mode. Give the coding details. Thanks in advance. U will be rewarded.
Regards,
NagarajuHi,
REPORT ZTEST222 .
PARAMETERS : p_add RADIOBUTTON GROUP radi
USER-COMMAND radio MODIF ID MOD,
p_disp RADIOBUTTON GROUP radi DEFAULT 'X' MODIF ID pod,
p_chng RADIOBUTTON GROUP radi MODIF ID rad,
p_er_log RADIOBUTTON GROUP radi MODIF ID cod.
SELECT-OPTIONS : s_idn FOR vendor MODIF ID mod,
s_pcode FOR ws_c_pcode MODIF ID pod.
PARAMETERS: p_plant LIKE zaw_pol_plan-plant MODIF ID rad,
p_zzvend LIKE zaw_pol_plan-zzvendor MODIF ID cod.
AT SELECTION-SCREEN OUTPUT.
LOOP AT SCREEN.
IF p_add EQ 'X'.
IF screen-group1 EQ 'MOD'.
screen-active = 1.
MODIFY SCREEN.
ELSE.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
IF p_disp EQ 'X'.
IF screen-group1 EQ 'POD'.
screen-active = 1.
MODIFY SCREEN.
ELSE.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
IF p_chng EQ 'X'.
IF screen-group1 EQ 'RAD'.
screen-active = 1.
MODIFY SCREEN.
ELSE.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
IF p_er_log EQ 'X'.
IF screen-group1 EQ 'COD'.
screen-active = 1.
MODIFY SCREEN.
ELSE.
screen-active = 0.
MODIFY SCREEN.
ENDIF.
Pls. reward if useful
ENDLOOP.
Pls. reward if useful -
Error handling return code for Provide Statement
Hi Experts,
For select statement we have error handling return code sy-subrc.
What is the error handling return code for provide.. end provide statement.
Thanks,
RaguRagu,
Same thing.
Check sy-subrc.
sy-subrc is the return code for all ABAP statements as far as I know.
Regards,
Dilek -
Timesten create a lock for select statement through sqldev
When use ttisql connect to TimesTen Release 7.0.6.15.0 at autocommit=1, there is no lock for select statement.
but when I use sql developer (driver is ttjdbc5.jar, regardless of version) to connect, even with autocommit=1, there will be locks for select statement.
Is it a bug? How can I achieve the same no locks for select statement through sql developer?Thanks.-your update tells me that you are connected to a remote timesten data store using the client driver
-the ttXactAdmin output indicates that SqlNavigator has a shared lock on the database itself: this will not interfere with anybody else' read operations, and I believe that until such time as you actually attempt some kind of DML against the data store that th IX lock on the database lock will not interfere with any other DML either.
-a shared database lock will always be acquired for any transaction in TimesTen. You can test this for yourself from ttisql: set autocommit off, perform a simple update and do not commit the transaction. Then open a separate session and execute ttxactadmin - you will the IX database lock as well as the various locks on tables and indexes.
-I believe this pretty much proves my original thinking: that sqlDeveloper attaches to TimesTen in transaction mode. However, the IX lock on the database will not interfere with anybody else's work and should not be a problem. -
Function in select statement need to be called only for the last record.
Select state,
local,
fun_state_loc_other_details(19) details
from state_local
where pm_key=19
resuts:_
State Local Details
AP APlocal details1
UP UPLocal details1
MP MPLocal details1
i) The above query returns 100 records
ii) fun_state_loc_other_details is also getting called 100 times. But I want this function to be called only for the last record that is 100th record.
is there any way to do that?Thanks amatu.
One more small query. Can I do it on condition based.
Select state,
local,
fun_state_loc_other_details(19) details
from state_local
where pm_key=19
Like if one state it need to be called once.
AP -- 50 records
UP - 20 records
MP -- 10 records.
fyi: this record no. varies
I want the function to be called for AP once, UP once, MP once. -
Need to Improve pefromance for select statement using MSEG table
Hi all,
We are using a select statement using MSEG table
which takes a very long time to run the program which is scheduled in back ground.
Please see the history below.;
1) Previously this program was using SELECT-ENDSELECT statement inside the loop i.e.
LOOP AT I_MCHB.
To get Material Doc. Details
SELECT MBLNR
MJAHR
ZEILE INTO (MSEG-MBLNR,MSEG-MJAHR,MSEG-ZEILE)
UP TO 1 ROWS
FROM MSEG
WHERE CHARG EQ I_MCHB-CHARG
AND MATNR EQ I_MCHB-MATNR
AND WERKS EQ I_MCHB-WERKS
AND LGORT EQ I_MCHB-LGORT.
ENDSELECT.
Endloop.
The program was taking 1 hr for 20 k data
2)The above statement was replaced by ALL ENTRIES to remove the SELECT-ENDSELECT from the loop.
***GET MATERIAL DOC NUMBER AND FINANCIAL YEAR DETAILS FROM MSEG TABLE
SELECT MBLNR
MJAHR
ZEILE
MATNR
CHARG
WERKS
LGORT
INTO TABLE I_MSEG
FROM MSEG
FOR ALL ENTRIES IN I_MCHB
WHERE CHARG EQ I_MCHB-CHARG
AND MATNR EQ I_MCHB-MATNR
AND WERKS EQ I_MCHB-WERKS
AND LGORT EQ I_MCHB-LGORT.
3)After getting the further technical analysis from BASIS team , And with the suggestion to optimize the program by changing the INDEX RANGE SCAN to
MSEG~M.
SELECT MBLNR
MJAHR
ZEILE
MATNR
CHARG
WERKS
LGORT
INTO TABLE I_MSEG
FROM MSEG
FOR ALL ENTRIES IN I_MCHB
WHERE MATNR EQ I_MCHB-MATNR
AND WERKS EQ I_MCHB-WERKS
AND LGORT EQ I_MCHB-LGORT.
At present the program is taking 3 to 4 hrs in back ground .
The table is complete table scan using index
MSEG~M.
Please suggest to improve the performance of this
many many thanks
deepakThe benchmark should be the join, and I can not see how any of your solutions can be faster than the join
SELECT .....
INTO TABLE ....
UP TO 1 ROWS
FROM mchb as a
INNER JOIN mseg as b
ON amatnr EQ bmatnr
AND awerks EQ bwerks
AND algort EQ blgort
And acharg EQ bcharg
WHERE a~ ....
The WHERE condition must come from the select on MCHB, the field list from the total results
you want.
If you want to compare, must compare your solutions plus the select to fill I_MCHB.
Siegfried
Edited by: Siegfried Boes on Dec 20, 2007 2:28 PM -
Dynamic sql for select statement
Hi,
Please help me with the below code:
It is updating null if the select statment returns one values. If it fetches multiple values then it throughs the below error msg when running the program.
Please let me know how to modify the below code. Or let me know is there anyother way to write this code.
Logic for development:
* View name should be passed as dynamic.
CREATE OR REPLACE
PROCEDURE "PKEP_LOAD_SO_EU" (p_var1 IN VARCHAR2)
IS
lv_sql VARCHAR2 (4000);
lv_name VARCHAR2 (20);
BEGIN
lv_sql :=
' SELECT DISTINCT LEVEL2
FROM BIIO_SALES_OB_IMPORT_'|| p_var1;
EXECUTE IMMEDIATE lv_sql
INTO lv_name;
BEGIN
UPDATE BIIO_SALES_OB_IMPORT_NA2 --table name for updation
SET SOB_1 = NULL,
SOB_DATE_1 = NULL
WHERE level2 = lv_name; -- validation ( eg. Select distinct level2 from biio_sales_ob_import_'||p_var1)
COMMIT;
EXCEPTION
WHEN OTHERS
THEN
DBMS_OUTPUT.put_line (SQLERRM);
NULL;
END;
END;
BEGIN
PKEP_LOAD_SO_EU ('NA1');
end;
Error report:
ORA-01422: exact fetch returns more than requested number of rows
ORA-06512: at "DEMANTRA.PKEP_LOAD_SO_EU", line 11
ORA-06512: at line 2
01422. 00000 - "exact fetch returns more than requested number of rows"
*Cause: The number specified in exact fetch is less than the rows returned.
*Action: Rewrite the query or change number of rows requested
Thanks.
PadmaPadu wrote:
Please let me know whether is anyother way to write this code as im a beginner for SQl.You dont need to have a seperate SELECT statement. Just a single UPDATE will do the job for you.
create or replace procedure pkep_load_so_eu
p_var1 in varchar2
as
begin
lSql := ' update biio_sales_ob_import_na2 ' ||
' set sob_1 = null ' ||
' , sob_date_1 = null ' ||
' where level2 in ( ' ||
' select level2 ' ||
' from biio_sales_ob_import_' || p_var1 ||
execute immediate lSql;
end; -
Runtime error for SELECT statement
Hi All,
I have written a SELECT statement as follows in my code.
select budat pernr aufnr vornr from AFRU
into corresponding fields of table it_vornr
for all entries in it_cats_tmp
where budat = it_cats_tmp-workdate
and pernr = it_cats_tmp-pernr
and aufnr = it_cats_tmp-rnplnr.
The table IT-CATS_TMP is having around 3000+ lines.
When control moves to this statement, the system is throwing Runtime error or its taking around 30 minutes time to execute.
If i query the same table (AFRU) in SE11 for the same set of conditions, the table displays relevent data immediately.
What might be the reason for this delay/Runtime Error?
Shall i need to change the syntax for better performance?
Your guidelines are highly appreciated......
Regards
PavanHi
1. Try to put WHERE conditions for KEY FIELDS.
Solution: Create a RANGE for the key fields & put that in SELECT Query.
DATA: gr_rueck TYPE RANGES OF afru-rueck.
SELECT .. WHERE rueck IN gr_rueck.
2. Avoid using CORRESPONDING FIELDS OF TABLE in SELECT.
Solution: Change internal table fields ORDER.
TYPES:
BEGIN OF TY_VORNR,
budat TYPE ..
pernr TYPE ..
aufnr TYPE ..
vornr TYPE ..
... " Other fields
END OF TY_VORNR.
SELECT .. INTO TABLE IT_VORNR ... -
Build SVG graphic for Select statement
I asked an earlier question and need to refine it or even ask it differently.. So here goes..
I have a report, that is built using a select statement.. In this report I need to have an item that is a barcode printed.
I have a function that is from a member here, that will produce a svg bar code, in an HTML region, using an application process.. I wish to modify this and make it return an SVG string to be used in the select statement..
Is this possible?
Thank you,
Tony Miller
UTMB/EHNThe answer is in the last frame of you cartoon. Read it again.
If you are letting users type if values that will be used unfiltered, you have a lot bigger problems on your hands than SQL insertion.
Why are you letting operators type in their name? Never let operators type in their own name. In fact don't let users type at all except as a last resort.
Likewise, lot number or id or whatever should not be typed. Selected, yes. Scanned, yes. But not typed.
Mike...
Certified Professional Instructor
Certified LabVIEW Architect
LabVIEW Champion
"... after all, He's not a tame lion..."
Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps -
Create object type from multiple tables for select statement
Hi there,
I have 3 tables as given below and I wish to create an object type to group selected columns as 'attribute' from multiple tables.
I need to create 2 input parameters to pass in - 'attribute' and 'attribute value' in PL/SQL and these 2 parameters will be
passing in with 'column name' and 'column value'. e.g. 'configuration' - the column name, 'eval' - the column value.
Then, the PL/SQL will execute the select statement with the column and column value provided to output the record.
Pls advise and thank you.
table ccitemnumber
name null type
ccitemnumber not null varchar2(20)
configuration varchar2(20)
item_type varchar2(30)
table productmodel
productmodelnumber not null varchar2(6)
description varchar2(60)
accesstimems number
numberofheads varchar2(2)
generation varchar2(10)
numberofdiscs varchar2(2)
factoryapplication varchar2(150)
table topmodel
stmodelnumber not null varchar2(30)
productfamily varchar2(60
formfactor varchar2(10)
modelheight varchar2(10)
formattedcapacity number
formattedcapacity_uom varchar2(20)
object type in database
configuration varchar2(20)
item_type varchar2(30)
numberofheads varchar2(2)
generation varchar2(10)
numberofdiscs varchar2(2)
factoryapplication varchar2(150)
modelheight varchar2(10)
formattedcapacity number
formattedcapacuser12043838 wrote:
Reason to do this as these fields are required to be grouped together as they are created in different tables. They are treated as 'attribute' (consists of many columns) of the part number. So, the PL/SQL is requested to design in a way able for user to pass in the column name and column value or part number, then the select statement should be able to query for the records. Another reason is a new column can be added easily without keep modifying those effected programs. Reuseable too.This basically equates to ... hard to code, hard to maintain, and poor performance.
Are you really sure you want to do this? This isn't going to be easy-street as you seem to think it is, but it's a one way street to a poorly performing system with security vulnerabilities (google SQL Injection).
I would highly recommend you reconsider your design decision here. -
Performance Tuning -To find the execution time for Select Statement
Hi,
There is a program that takes 10 hrs to execute. I need tune its performance. The program is basically reading few tables like KNA1,ANLA,ANLU,ADRC etc and updates to Custom table. I did my analysis and found few performance techniques for ABAP coding.
Now my problem is, to get this object approved I need to submit the execution statistics to client.I checked both ST05 and SE30. I heard of a Tcode where we can execute a select statement and note its time, then modify and find its improved Performance. Can anybody suggest me on this.
Thanks,
Rajani.Hi,
This is documentation regarding performance analysis. Hope this will be useful
It is a general practice to use Select * from <database> This statement populates all the values of the structure in the database.
The effect is many fold:-
It increases the time to retrieve data from database
There is large amount of unused data in memory
It increases the processing time from work area or internal tables
It is always a good practice to retrieve only the required fields. Always use the syntax Select f1 f2 fn from <database>
e.g. Do not use the following statement:-
Data: i_mara like mara occurs 0 with header line.
Data: i_marc like marc occurs 0 with header line.
Select * from mara
Into table i_mara
Where matnr in s_matnr.
Select * from marc
Into table i_marc
For all entries in i_mara
Where matnr eq i_mara-matnr.
Instead use the following statement:-
Data: begin of i_mara occurs 0,
Matnr like mara-matnr,
End of i_mara.
Data: begin of i_marc occurs 0,
Matnr like marc-matnr,
Werks like marc-werks,
End of i_marc.
Select matnr from mara
Into table i_mara
Where matnr in s_matnr. -
Standard Match Code for Selection Options with Example
Hi Guys,
Can anybody tell me Standard Match Code or Search help for Selection Options.
ex: MBEW-MATNR , MBEW-BWKEY and MBEW-BWTAR. can anybody tell how to keep Search Help or Match Code for the Above Fields in ECC 6.0 with Example
Very Urgent.
Thanks,
Gopi.Well Gopi.. as per your requirement no need to use collective search help.
I guess you have three fields in selection-screen,out 3 fields you have two fields contains search help.
Create your user defined search help BWTAR ..
Check the below links for creation search help :
http://help.sap.com/saphelp_46c/helpdata/EN/cf/21ee2b446011d189700000e8322d00/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/41/f6b237fec48c67e10000009b38f8cf/content.htm
Hope you got it.
Thanks
Seshu -
hi all,
in selectin screen i have to populate two fields VIQMEL-KDAUF(sales order) & VIQMEL-QMNUM( shop visit notification),
here i have to give any of the inputs.like, if i give the SALES ORDER as input, SVN should be retrived& if SVN is given as input SO should be retrived.
depending on the given input the second input also should be retrived and passed to others as input.
can any one send me the code for this..i need it immediately.Hi,
Tables: viqmel.
Data: begin of it_itab occurs 0,
ls_qmnum like viqmel-qmnum,
ls_kdauf like viqmel-kdauf,
end of it_itab.
select-options: s_qmnum for viqmel-qmnum,
s_kdauf for viqmel-kdauf.
select QMNUM KDAUF
from VIQMEL
into table it_itab
where qmnum in s_qmnum
OR kdauf in s_kdauf.
loop at itab.
write: /it_itab-ls_kdauf, it_itab-ls_qmnum.
endloop.
Reward pts if helpfull -
Code please(select statements)
Can somebody please help me out in writing an ABAP program for the following requirement?
Use "select" statement in your ABAP program to select the database table contents depending upon the query that user has entered at the selection screen.
Display the selected records of database table (point 3) on the output report.
Selection screen:
Below are the selection screen parameters/options that you need to provide
for the user
1. Employee ID
2. Employee Name (either Emp ID or name should be mandatory).
3. Employee Dept/ Designation / joining date
4. Another parameter should be "Age". Thus, if user enters 27 on Age field, every employee under 27 age should be displayed on the report.
Output report:
Employee ID with name / dept / designation / joining date and age should be displayed as details.This short sample program should get you started.
report zrich_0002.
* declare the internal table
data: ipa0001 type table of pa0001 with header line.
* define the selection screen
select-options: s_pernr for ipa0001-pernr,
s_SNAME for ipa0001-SNAME.
start-of-selection.
* Select the data from database
select * into corresponding fields of table ipa0001
from pa0001
where pernr in s_pernr
and sname in s_sname
and ENDDA = '99991231'.
* Write out the data in a list
loop at ipa0001.
write:/ ipa0001-pernr, ipa0001-sname.
endloop.
Regards,
Rich Heilman -
How to code for select all& deselect all?using menu buttons
hai,
i have generated a report with a single field from a database table and
i have a checkbox for each record/item in the report.
i need help in the following ..
now that i have menu buttons say "select all" and "deselect all"..
if select all is clicked then all checkboxes should be selected.
if deselect all is clicked, then all checkboxes should be deselected
i know that we have to use functional code and use case sy-ucomm etc.
when "selectall" etc..
can someone help me how to code for this to work exactly?it did not work for the code u had suggested...
plz check it out and send me the exact working code..
REPORT ZINTRACTIVE_PROJ .
TABLES : SFLIGHT.
DATA : BEGIN OF IT OCCURS 0,
CARRID LIKE SFLIGHT-CARRID, FLDATE LIKE SFLIGHT-FLDATE,
END OF IT.
DATA : BOX TYPE C,
LINE TYPE I.
SELECT CARRID FLDATE FROM SFLIGHT INTO TABLE IT.
LOOP AT IT.
WRITE : / BOX AS CHECKBOX, IT-CARRID.
ENDLOOP.
LINE = SY-LINNO .
SET PF-STATUS 'SELECT'.
AT USER-COMMAND.
CASE SY-UCOMM.
WHEN 'SELECT'.
DO LINE TIMES.
READ LINE SY-INDEX FIELD VALUE BOX.
IF BOX = 'X'.
NEW-PAGE.
WRITE : / IT-FLDATE.
ENDIF.
ENDDO.
<b>WHEN 'SELECTALL'.
LOOP AT IT.
IT-CARRID = 'X'.
MODIFY IT TRANSPORTING CARRID WHERE CARRID = IT-CARRID.
EXIT.
ENDLOOP.
WHEN 'DESELECTALL'.
LOOP AT IT.
IT-CARRID = ''.
MODIFY IT TRANSPORTING CARRID WHERE CARRID = 'X'.
EXIT.
ENDLOOP.</b>ENDCASE.
Maybe you are looking for
-
Error in running the fds-tomcat zip
Hi, I am a beginner to Flex, I tried to run the tomcat server bundles in fds-tomact (after all the install instructions), and when I run that I get C:\Program Files\fds-tomcat\bin>catalina run Using CATALINA_BASE: C:\Program Files\fds-tomcat Using CA
-
I need help! Can't seem to figure out how to update the captions in my imageViewer
I am creating an image viewer in which needs to update photos and update captions with next and previous features. I got the next, previous and image update to work. However, I am stuck on the captions. This is my code: I have a main.as: public class
-
Trying to link my Kobo with ADE and my Macbook
I just downloaded ADE to my Macbook (version 10.5). I was able to authorize my computer and my Kobo, but my kobo doesn't show up on ADE anymore. When it was linked was only reading the kobo info, not the book I had purchased. Cannot figure out how to
-
Outlook prompting for password with new Exchange 2013
I have Exchange 2007 and 2013. I want to migrate to 2013 but I'm having issues in the testing phase. I have a test account that I moved the mailbox to the new server. I have a test PC with a modified hosts file that points to the new Exch 2013 ser
-
All of a sudden my iPad 2 is unresponsive. Show a blank screen & cannot turn off. Any suggestions?