Regarding the select query
Hi Experts,
I have a select query as follows:
select field1 field2 from db1 into table it1.
Now suppose the it1-field1 contains values a,b and c.
Now I want to select fields a,b and c from another db table db2.
Instead of hard coding like this:
select a b c from db2 into table it2.....
How can I do this?
Points will be awarded.
Regards,
Soumya.
Hi Soumya ,
Pleas use FOR ALL ENTRIES syntax , in this way you can select the records from db2 which are available or selected in db1.
Like Header And Item table.
You select records frm header table . then for corres ponding header records you select from detail table db2 .....
Condition is the field containg a,b,c is key field in both tables ...
Reward points if it helps you .
Regards
Amber S
Similar Messages
-
Need some help with the Select query.
Need some help with the Select query.
I had created a Z table with the following fields :
ZADS :
MANDT
VKORG
ABGRU.
I had written a select query as below :
select single vkorg abgru from ZADS into it_rej.
IT_REJ is a Work area:
DATA : BEGIN OF IT_REJ,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
This is causing performance issue. They are asking me to include the where condition for this select query.
What should be my select query here?
Please suggest....
Any suggestion will be apprecaiated!
Regards,
DeveloperHello Everybody!
Thank you for all your response!
I had changes this work area into Internal table and changed the select query. PLease let me know if this causes any performance issues?
I had created a Z table with the following fields :
ZADS :
MANDT
VKORG
ABGRU.
I had written a select query as below :
I had removed the select single and insted of using the Structure it_rej, I had changed it into Internal table
select vkorg abgru from ZADS into it_rej.
Earlier :
IT_REJ is a Work area:
DATA : BEGIN OF IT_REJ,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
Now :
DATA : BEGIN OF IT_REJ occurs 0,
VKORG TYPE VBAK-VKORG,
ABGRU TYPE VBAP-ABGRU,
END OF IT_REJ.
I guess this will fix the issue correct?
PLease suggest!
Regards,
Developer. -
How to insert the select query result into table?
How to insert the select query result into table?
SELECT top 20 creation_time
,last_execution_time
,total_physical_reads
,total_logical_reads
,total_logical_writes
, execution_count
, total_worker_time
, total_elapsed_time
, total_elapsed_time / execution_count avg_elapsed_time
,SUBSTRING(st.text, (qs.statement_start_offset/2) + 1,
((CASE statement_end_offset
WHEN -1 THEN DATALENGTH(st.text)
ELSE qs.statement_end_offset END
- qs.statement_start_offset)/2) + 1) AS statement_text
FROM sys.dm_exec_query_stats AS qs
CROSS APPLY sys.dm_exec_sql_text(qs.sql_handle) st
ORDER BY total_elapsed_time / execution_count DESC;
Thanks,
Tirumala1. SELECT INTO
Below method will create table when data is inserted from one table to another table. Its useful when you need exactly same datatype as source table.
Use AdventureWorks2008R2;
Go
---Insert data using SELECT INTO
SELECT AddressLine1, City
INTO BothellAddresses
FROM Person.Address
where City = 'Bothell';
GO
---VERIFY DATA
Select AddressLine1, City
FROM BothellAddresses
---DROP TABLE
DROP TABLE BothellAddresses
GO
2. INSERT INTO SELECT
Below method will need table to be created prior to inserting data. Its really useful when table is already created and you want insert data from
another table.
Use AdventureWorks2008R2;
Go
---Create Table
CREATE TABLE BothellAddresses (AddressLine1 NVARCHAR(60), City NVARCHAR(30))
---Insert into above table using SELECT
INSERT INTO BothellAddresses(AddressLine1, City)
SELECT AddressLine1, City
FROM Person.Address
where City = 'Bothell';
---VERIFY DATA
Select AddressLine1, City
FROM BothellAddresses
---DROP TABLE
DROP TABLE BothellAddresses
GO
Regards,
Vishal Patel
Blog: http://vspatel.co.uk
Site: http://lehrity.com -
Using case when statement in the select query to create physical table
Hello,
I have a requirement where in I have to execute a case when statement with a session variable while creating a physical table using a select query. let me explain with an example.
I have a physical table based on a select table with one column.
SELECT 'VALUEOF(NQ_SESSION.NAME_PARAMETER)' AS NAME_PARAMETER FROM DUAL. Let me call this table as the NAME_PARAMETER table.
I also have a customer table.
In my dashboard that has two pages, Page 1 contains a table with the customer table with column navigation to my second dashboard page.
In my second dashboard page I created a dashboard report based on NAME_PARAMETER table and a prompt based on customer table that sets the NAME_ PARAMETER request variable.
EXECUTION
When i click on a particular customer, the prompt sets the variable NAME_PARAMETER and the NAME_PARAMETER table shows the appropriate customer.
everything works as expected. YE!!
Now i created another table called NAME_PARAMETER1 with a little modification to the earlier table. the query is as follows.
SELECT CASE WHEN 'VALUEOF(NQ_SESSION.NAME_PARAMETER)'='Customer 1' THEN 'TEST_MART1' ELSE TEST_MART2' END AS NAME_PARAMETER
FROM DUAL
Now I pull in this table into the second dashboard page along with the NAME_PARAMETER table report.
surprisingly, NAME_PARAMETER table report executes as is, but the other report based on the NAME_PARAMETER1 table fails with the following error.
Error Codes: OPR4ONWY:U9IM8TAC:OI2DL65P
State: HY000. Code: 10058. [NQODBC] [SQL_STATE: HY000] [nQSError: 10058] A general error has occurred. [nQSError: 16001] ODBC error state: S1000 code: 1756 message: [Oracle][ODBC][Ora]ORA-01756: quoted string not properly terminated. [nQSError: 16014] SQL statement preparation failed. (HY000)
SQL Issued: SET VARIABLE NAME_PARAMETER='Novartis';SELECT NAME_PARAMETER.NAME_PARAMETER saw_0 FROM POC_ONE_DOT_TWO ORDER BY saw_0
If anyone has any explanation to this error and how we can achieve the same, please help.
Thanks.Hello,
Updates :) sorry.. the error was a stupid one.. I resolved and I got stuck at my next step.
I am creating a physical table using a select query. But I am trying to obtain the name of the table dynamically.
Here is what I am trying to do. the select query of the physical table is as follows.
SELECT CUSTOMER_ID AS CUSTOMER_ID, CUSTOMER_NAME AS CUSTOMER_NAME FROM 'VALUEOF(NQ_SESSION.SCHEMA_NAME)'.CUSTOMER.
The idea behind this is to obtain the data from the same table from different schemas dynamically based on what a session variable. Please let me know if there is a way to achieve this, if not please let me know if this can be achieved in any other method in OBIEE.
Thanks. -
How to optimize the select query that is executed in a cursor for loop?
Hi Friends,
I have executed the code below and clocked the times for every line of the code using DBMS_PROFILER.
CREATE OR REPLACE PROCEDURE TEST
AS
p_file_id NUMBER := 151;
v_shipper_ind ah_item.shipper_ind%TYPE;
v_sales_reserve_ind ah_item.special_sales_reserve_ind%TYPE;
v_location_indicator ah_item.exe_location_ind%TYPE;
CURSOR activity_c
IS
SELECT *
FROM ah_activity_internal
WHERE status_id = 30
AND file_id = p_file_id;
BEGIN
DBMS_PROFILER.start_profiler ('TEST');
FOR rec IN activity_c
LOOP
SELECT DISTINCT shipper_ind, special_sales_reserve_ind, exe_location_ind
INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
FROM ah_item --464000 rows in this table
WHERE item_id_edw IN (
SELECT item_id_edw
FROM ah_item_xref --700000 rows in this table
WHERE item_code_cust = rec.item_code_cust
AND facility_num IN (
SELECT facility_code
FROM ah_chain_div_facility --17 rows in this table
WHERE chain_id = ah_internal_data_pkg.get_chain_id (p_file_id)
AND div_id = (SELECT div_id
FROM ah_div --8 rows in this table
WHERE division = rec.division)));
END LOOP;
DBMS_PROFILER.stop_profiler;
EXCEPTION
WHEN NO_DATA_FOUND
THEN
NULL;
WHEN TOO_MANY_ROWS
THEN
NULL;
END TEST;The SELECT query inside the cursor FOR LOOP took 773 seconds.
I have tried using BULK COLLECT instead of cursor for loop but it did not help.
When I took out the select query separately and executed with a sample value then it gave the results in a flash of second.
All the tables have primary key indexes.
Any ideas what can be done to make this code perform better?
Thanks,
Raj.As suggested I'd try merging the queries into a single SQL. You could also rewrite your IN clauses as JOINs and see if that helps, e.g.
SELECT DISTINCT ai.shipper_ind, ai.special_sales_reserve_ind, ai.exe_location_ind
INTO v_shipper_ind, v_sales_reserve_ind, v_location_indicator
FROM ah_item ai, ah_item_xref aix, ah_chain_div_facility acdf, ah_div ad
WHERE ai.item_id_edw = aix.item_id_edw
AND aix.item_code_cust = rec.item_code_cust
AND aix.facility_num = acdf.facility_code
AND acdf.chain_id = ah_internal_data_pkg.get_chain_id (p_file_id)
AND acdf.div_id = ad.div_id
AND ad.division = rec.division;ALSO: You are calling ah_internal_data_pkg.get_chain_id (p_file_id) every time. Why not do it outside the loop and just use a variable in the inner query? That will prevent context switching and improve speed.
Edited by: Dave Hemming on Dec 3, 2008 9:34 AM -
How can i use index in select query.. facing problem with the select query.
Hi Friends,
I am facing a serious problem in one of the select query. It is taking a lot of time to fetch data in Production Scenario.
Here is the query:
SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
FROM ztftelat LEFT JOIN ztfzberep
ON ztfzberep~gjahr = st_input-gjahr
AND ztfzberep~poper = st_input-poper
AND ztfzberepcntr = ztftelatrprctr
WHERE rldnr = c_telstra_accounting
AND rrcty = c_actual
AND rvers = c_ver_001
AND rbukrs = st_input-bukrs
AND racct = st_input-saknr
AND ryear = st_input-gjahr
And rzzlstar in r_lstar
AND rpmax = c_max_period.
There are 5 indices present for Table ZTFTELAT.
Indices of ZTFTELAT:
Name Description
0 Primary key( RCLNT,RLDNR,RRCTY,RVERS,RYEAR,ROBJNR,SOBJNR,RTCUR,RUNIT,DRCRK,RPMAX)
005 Profit (RCLNT,RPRCTR)
1 Ledger, company code, account (RLDNR,RBUKRS, RACCT)
2 Ledger, company code, cost center (RLDNR, RBUKRS,RCNTR)
3 Account, cost center (RACCT,RCNTR)
4 RCLNT/RLDNR/RRCTY/RVERS/RYEAR/RZZAUFNR
Z01 Activity Type, Account (RZZLSTAR,RACCT)
Z02 RYEAR-RBUKRS- RZZZBER-RLDNR
Can anyone help me out why it is taking so much time and how we can reduce it ? and also tell me if I want to use index number 1 then how can I use?
Thanks in advance.Hi Shiva,
I am using two more select queries with the same manner ....
here are the other two select query :
***************1************************
SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
FROM ztftelpt LEFT JOIN ztfzberep
ON ztfzberep~gjahr = st_input-gjahr
AND ztfzberep~poper = st_input-poper
AND ztfzberepcntr = ztftelptrprctr
WHERE rldnr = c_telstra_projects
AND rrcty = c_actual
AND rvers = c_ver_001
AND rbukrs = st_input-bukrs
AND racct = st_input-saknr
AND ryear = st_input-gjahr
and rzzlstar in r_lstar
AND rpmax = c_max_period.
and the second one is
*************************2************************
SELECT * APPENDING CORRESPONDING FIELDS OF TABLE tbl_summary
FROM ztftelnt LEFT JOIN ztfzberep
ON ztfzberep~gjahr = st_input-gjahr
AND ztfzberep~poper = st_input-poper
AND ztfzberepcntr = ztftelntrprctr
WHERE rldnr = c_telstra_networks
AND rrcty = c_actual
AND rvers = c_ver_001
AND rbukrs = st_input-bukrs
AND racct = st_input-saknr
AND ryear = st_input-gjahr
and rzzlstar in r_lstar
AND rpmax = c_max_period.
for both the above table program is taking very less time .... although both the table used in above queries have similar amount of data. And i can not remove the APPENDING CORRESPONDING. because i have to append the data after fetching from the tables. if i will not use it will delete all the data fetched earlier.
Thanks on advanced......
Sourabh -
Problem in the "select" query....Just check out and help me
Hi there !!
I am getting the following errors while trying to execute the "select" query from JSP page:
java.sql.SQLException: [Microsoft][ODBC Driver Manager] Invalid cursor state
My code is :
String reg_no=(String)session.getAttribute("reg_no");
ResultSet rs=stmt.executeQuery("SELECT * FROM reg WHERE regno = "+reg_no);
(Note: the "regno" in the database is of numeric datatype)
Try to help me...
Thanx,
Ram.Just so everyone knows:
Ram Mohan joined the forum on 7-Sep-2003 and received
his 25 Dukes for joining.
Since then, he's posted three questions, each one
promising 5-10 Dukes, and never once awarded them.
His strategy seems to be to wave Dukes, ask his
hit-and-run question, and then bolt.
Answer his questions if you wish, but don't do it
expecting Dukes. - MODDuffy, you're getting just as cranky as I have. See what hanging around these forums does to oneself? :) -
Restricting record in the select query
Is there any way to restrict the number of search (e.g 10) records in the SELECT query ?
Hi,
You can use as below:
select <fieldname> up to 10 rows from <tablename> into itab.
Thanks,
Sriram Ponna. -
Performance of the select query
i want to know wheter the conversion of the select query
SELECT * FROM mchb
WHERE matnr EQ mch1-matnr
AND charg EQ mch1-charg
AND werks EQ plant-werks.
itab-lgort = mchb-lgort.
itab-clabs = mchb-clabs.
APPEND itab.
ENDSELECT.
into following pattern
select lgort clabs
from mchb
into corresponding fields of itab
WHERE matnr EQ mch1-matnr
AND charg EQ mch1-charg
AND werks EQ plant-werks.
ENDSELECT.
will give the same results ?Hi,
It will results in performance issue because of end select statement.
select lgort clabs
from mchb
into table itab
WHERE matnr EQ mch1-matnr
AND charg EQ mch1-charg
AND werks EQ plant-werks.
Use like this you will get the values of lgort and clabs in the internal table itab.
Then use loop statement to use that values further.
Dont use end select it will be a performance issue.
In this code there is no need to use of ENDSELECT and use corresponding fields of table itab.
select lgort clabs
from mchb
into corresponding fields of itab
WHERE matnr EQ mch1-matnr
AND charg EQ mch1-charg
AND werks EQ plant-werks.
ENDSELECT.
Thanks,
Sakthi -
Using order by in the select query
Hi All,
I have query in which I need the latest record. To get the latest record, I can
1) Select all entries into an internal table and sort them descending and get the first one
2) Select all entries into an internal table and order by in the select statement itself.
Then read the first one.
Which approach should be better as for as the performance is concern.
The query is on MKPF table and I have the material document number. I need the latest entry.
Regards,
ShahuHi,
The first one would be better.At the most we should not use order by in select statement bcoz it directly sorts the data according to that in database itself reverting performance issues.
Otherwise you can use select max* if records are less.
Reward points if helpful.
Thanks,
Ponraj.s. -
How to write the select query with complex where condition
Hi all,
Can u help me in writing following select query.
select * from zu1cd_corr where time_stamp between firstday and lastday .
In the above query time_stamp contains the date and time.
where as firstday and lastday contains the dates.
I need to compare the date in the time_stamp with the firstday and lastday.
But time_stamp contains the time also and it is char of 14 characters length.Hi,
If that is the case u can do as advait specified....
if the firstday and secondday are select-options then declare two more variables having 14 character length and then concatenate '000000' to firstday variable and '240000' to last day variable and then write ur query.
CLEAR : lv_firstday,
lv_lastday.
concatenate firstday '000000' to lv_firstday.
concatenate lastday '240000' to lv_lastday.
ranges : r_Date for zu1cd_corr-time_stamp.
r_date-sign = 'I'.
r_date-option = 'BT'.
r_Date-low = lv_firstday.
r_Date-high = lv_lastday.
append r_date.
select * from zu1cd_corr into table it_zu1cd_corr where time_stamp in r_Date.
I hope it helps.
Regards,
Nagaraj -
Performance issue with the Select query
Hi,
I have an issue with the performance with a seclet query.
In table AFRU - AUFNR is not a key field.
So i had selected the low and high values into s_reuck and used it in Where condition.
Still i have an issue with the Performance.
SELECT SINGLE RUECK
RMZHL
IEDD
AUFNR
STOKZ
STZHL
FROM AFRU INTO table t_AFRU
FOR ALL ENTRIES IN T_ZSCPRT100
WHERE RUECK IN S_RUECK AND
AUFNR = T_ZSCPRT100-AUFNR AND
STOKZ = SPACE AND
STZHL = 0.
I had also cheked by createing an index for AUFNR in the table AFRU...it does not help.
Is there anyway that we can declare Key field while declaring the Internal table....?
ANy suggestions to fix the performance issue is apprecaited!
Regards,
KittuHi,
Thank you for your quick response!
Rui dantas, i have lill confusion...this is my code below :
data : t_zscprt type standard table of ty_zscprt,
wa_zscprt type ty_zscprt.
types : BEGIN OF ty_zscprt100,
aufnr type zscprt100-aufnr,
posnr type zscprt100-posnr,
ezclose type zscprt100-ezclose,
serialnr type zscprt100-serialnr,
lgort type zscprt100-lgort,
END OF ty_zscprt100.
data : t_zscprt100 type standard table of ty_zscprt100,
wa_zscprt100 type ty_zscprt100.
Types: begin of ty_afru,
rueck type CO_RUECK,
rmzhl type CO_RMZHL,
iedd type RU_IEDD,
aufnr type AUFNR,
stokz type CO_STOKZ,
stzhl type CO_STZHL,
end of ty_afru.
data : t_afru type STANDARD TABLE OF ty_afru,
WA_AFRU TYPE TY_AFRU.
SELECT AUFNR
POSNR
EZCLOSE
SERIALNR
LGORT
FROM ZSCPRT100 INTO TABLE T_ZSCPRT100
FOR ALL ENTRIES IN T_ZSCPRT
WHERE AUFNR = T_ZSCPRT-PRTNUM
AND SERIALNR IN S_SERIAL
AND LGORT IN S_LGORT.
IF sy-subrc <> 0.
MESSAGE ID 'Z2' TYPE 'I' NUMBER '41'. "BDCG87
stop."BDCG87
ENDIF.
ENDIF.
SELECT RUECK
RMZHL
IEDD
AUFNR
STOKZ
STZHL
FROM AFRU INTO TABLE T_AFRU
FOR ALL ENTRIES IN T_ZSCPRT100
WHERE RUECK IN S_RUECK AND
AUFNR = T_ZSCPRT100-AUFNR AND
STOKZ = SPACE AND
STZHL = 0.
Using AUFNR, get AUFPL from AFKO
Using AUFPL, get RUECK from AFVC
Using RUEKC, read AFRU
In other words, one select joining AFKO <-> AFVC <-> AFRU should get what you want.
This is my select query, would you want me to write another select query to meet this criteria..
From AUFNR> I will get AUFPL from AFKO> BAsed on AUFPL I will get RUECK, based on RUEKC i need to read AFRU..but i need to select few field from AFRu based on AUFNR....
ANy suggestions wil be appreciated!
Regards
Kittu -
hi All,
I have one requirement.I wonder whether i can do it in a single SQL Statement or not.
I have tab1 with columns c1,c2,c3,c4,....,Logon_time
I have tab2 with columns C1,c2,c3,c4.....,Logoff_time
All the columns are same for two tables except that logon_time and logoff_time as mentioned above.
tab1 will have all the information of user who logon to database.
tab2 will have all the information of user who logoff from DB.
Now i i have to generate a report which shows all the user info and logon Duration.For that i can use logoff_time - logon_time.but the challenge here is logoff_time dont contain rows for the users who logon to database byt yet to logoff.
So for them logoff_time-logon_time showing -ve Duration.
So I want Duration as logoff_time-logon_time for all the rows.But for those users who yet to logoff i want duration as "YET to Logoff"
Is this possible with single Select Query.
Thanks
PramodHi, Pramod,
You need to join tab_1 to tab_2. Since not every row in tab_1 will have a matching row in tab_2, make it an outer join.
How do you know which row in tab_1 matches which row in tab_2?
I assume there's some column (let's say c1) that identifies a user. A user can have several sessions going at the same time, however.
The following query matches the n-th logon_time in tab_1 with the n-th logoff_time in tab_2 for the same user:
WITH numbered_tab_1 AS
SELECT c1, c2, c3, c4, ..., logon_time
, ROW_NUMBER () OVER ( PARTITION BY c1 -- or whatever identifies user
ORDER BY logon_time
) AS r_num
FROM tab_1
, numbered_tab_2 AS
SELECT c1, c2, c3, c4, ..., logon_time
, ROW_NUMBER () OVER ( PARTITION BY c1 -- or whatever identifies user
ORDER BY logoff_time
) AS r_num
FROM tab_2
SELECT t1.c1, t1.c2, t1.c3, t1.c4, ..., t1.logon_time -- or whatever you want
, t2.c1, t2.c2, t2.c3, t2.c4, ..., t2.logoff_time
, NVL ( TO_CHAR (24 * (t2.logff_time - t1.logon_time)) -- duration in hours
, 'Yet to Logoff'
) AS duration
FROM numbered_tab_1 t1
LEFT OUTER JOIN numbered_tab_2 t2 ON t1.c1 = t2.c1
AND t1.r_num = t2.r_num
;I can test this if you'll post some sample data and the results you want from that data.
The query above matches logons and logoffs only by user and time
For example, say I log on at 10:00.
At 10:45, I open another window and log on again, but log off at 10:50 after 5 minutes.
At 11:30 I log off the first session.
If you were interested in sessions that lasted over 1 hour, the query above would not be accurate. It would show one session starting at 10:00 and ending at 10:50, and another session starting at 10:45 and ending at 11:30. To know that the first session to end was the second sessiion in order of beginning, you would have to have another column, say a unique session id.
If you're only interested in the number of sessions, or the total time connected per user, then the query above will be good enough.
Edited by: Frank Kulash on Jul 6, 2009 12:07 PM -
Hi ,
Can we write a select query where we can pass varray in the where condition.
I have this query in my stored procedure.
eg :
SELECT * from emp
WHERE deptno in l_data1;
where l_data is varray of type varchar2(40) where I have all the deptno in l_data.
Thanks.This is business requirement.
Here is my code.
create or replace PROCEDURE getAttribute (p_product_model varchar2)
AS
l_data pattern_str_type := pattern_str_type();
l_count NUMBER;
l_child_name VARCHAR2(200);
l_product_model VARCHAR2(40);
l_data1 getAttrforModel := getAttrforModel();
i NUMBER;
BEGIN
i := 1;
l_data :=getattr();
for i in 1 .. l_data.count loop
l_data.extend;
l_data1.extend;
if(l_data(i).child_type = 'Attribute' and l_data(i).product_model_name <> p_product_model)THEN
l_data1(i):=l_data(i).child_name;
dbms_output.put_line(l_data1(i));
END If;
end loop;
SELECT count(*) into l_count from
WOC_ATTRIBUTE_CATEGORY WHERE category_name = 'Software' and Attribute_Name in l_data1;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END ;
CREATE OR REPLACE FUNCTION getAttr RETURN pattern_str_type
IS
l_data pattern_str_type := pattern_str_type();
l_count NUMBER;
l_child_name VARCHAR2(200);
l_product_model VARCHAR2(40);
i NUMBER;
cursor getattr IS select child_name,child_type, product_model_name from woc_pattern_Structure;
BEGIN
i := 1;
for rec in getattr loop
l_data.extend;
l_data(i) := temp_table(rec.child_name,rec.child_type,rec.product_model_name);
--dbms_output.put_line(l_data(i).child_name||' '||l_data(i).child_type||' '||l_data(i).product_model_name);
i := i + 1;
end loop;
RETURN l_data;
EXCEPTION
WHEN OTHERS THEN
RAISE;
END ; -
Help reagrding the selection query
Hi All...
I have VBELN
LFART
VKORG
KUNNR
ERDAT
LFDAT
VSTEL
ROUTE in my selection-screen. All the fields are from LIKP.
Now I need to add one more field LAND1 from the table VBPA in the selection screen.
This is my logic to filter the previous requirement. Now how to validate the LAND1?
-> LIKP
select vbeln
into table i_likp
from likp
where vbeln in s_vbeln
and lfart in s_lfart
and vkorg in s_vkorg
and kunnr in s_kunnr
and erdat in s_erdat
and lfdat in s_lfdat
and vstel = p_vstel
and route in s_route.
if sy-subrc = 0.
-> LIPS
select vbeln posnr bwtar volum
into table i_lips
from lips
for all entries in i_likp
where vbeln = i_likp-vbeln.
Please help me in that. I will reward u with good points.
Reagrds
Arjun JainFor LAND1 validation do as below.
AT SELECTION-SCREEN ON s_land1.
SELECT land1 FROM t005
into t005-land1
where land1 IN s_land1.
if sy-subrc NE 0.
message e000 WITH 'Enter valid Land value'.
endif.
For the query u can use join
select a~vbeln b~posnr b~bwtar b~volum
from likp as a inner join lips as b
on a~vbeln =b~vbeln
into table i_tab
where a~vbeln in s_vbeln
and a~lfart in s_lfart
and a~vkorg in s_vkorg
and a~kunnr in s_kunnr
and a~erdat in s_erdat
and a~lfdat in s_lfdat
and a~vstel = p_vstel
and a~route in s_route.
This will solve ur problem.
U can reward for the helpful answers.
Maybe you are looking for
-
Moving video clips efficiently
I made a 5 hour movie containing 3 high school basketball games played 20 years ago (28-0 team yeh for us. :] ) . I added effects such as slow motion and titles flashing score and player names after each basket. It is 114 GB. I now realize that a DVD
-
My ipod keeps on freezing with every two songs.
my ipod keeps on freezing.i have read the other post but mine is different.recently every time i listen to my ipod it keeps on freezeing on the song list with every other song as in one song would work..the3n the next it would freeze and nothing can
-
Load balancing algorithm for groups in RZ12
Hello, I would like to know the load balancing algorithm for groups defined in RZ12. I know that log on groups for external connections are administered via SMLG and table RZLLICLASS. I also know that RFC resources can be managed for RFC logon groups
-
Importing third-party java libraries
I have just downloaded jakarta httpclient and am trying to get it to work with a program I am writing. Are there instructions somewhere on importing third-party libraries? I've searched these forums, the tutorials, and even google and haven't found a
-
Need photoshop elements 11 download site
Need photoshop elements 11 download.