How to replace Below Joins in select query ?
SELECT ko~ebeln ko~lifnr a1~name1
ko~bsart " Purchasing Document Type
po~menge " PO quantity
po~meins " PO Unit
po~netpr " Net Price
ko~kdate " End of validity period
po~pstyp " Item category in PO
po~wepos " Goods Receipt indicator
ko~spras " Language Key
ko~frggr " Release group
ko~frgsx " Release strategy
ko~frgke " Release Indicator
po~matnr
po~txz01
po~ebelp
po~werks
po~lgort
ko~waers
ko~ernam
ko~aedat
po~netwr
po~repos
INTO TABLE itab_details
FROM ekko AS ko INNER JOIN ekpo AS po
ON ko~ebeln = po~ebeln
INNER JOIN t161 AS t1
ON ko~bsart = t1~bsart
AND ko~bstyp = t1~bstyp
INNER JOIN lfa1 AS a1
ON ko~lifnr = a1~lifnr
WHERE ko~ebeln IN s_ebeln
AND po~loekz IN s_loekz
AND po~werks IN s_werks
AND po~lgort IN s_lgort
AND ko~lifnr IN s_lifnr
AND ko~bukrs IN s_bukrs
AND t1~bsart IN s_bsart
AND po~matnr IN s_matnr
AND ko~ernam IN s_ernam
AND ko~aedat IN s_aedat
AND po~knttp IN s_knttp
AND ko~ekgrp IN s_ekgrp
AND po~pstyp IN s_pstyp.
HI Amresh,
Try like this.
use inner join between Ekko and Ekpo.
Then use for all entries for table t161
and finally use for all entries for table lfa1
and use read in loop.
Regards,
Vijay
Similar Messages
-
How to make outer join in Sub Query?
Hi!
I'm facing one problem. Can anyone tell me - how to make outer join in sub query?
I'm pasting one sample code -
select e.empno, e.ename,e.job,e.sal,d.deptno,d.dname
from d_emp e, d_dept d
where e.deptno(+) = (
case
when d_dept.deptno = 10
then
select deptno
from d_dept
where dname = 'SALES'
else
d_dept.deptno
end
SQL>
ERROR at line 15:
ORA-01799: a column may not be outer-joined to a subqueryHow to resolve this issue?
Regards.And any luck with this?
SQL> with emp as
2 (select 100 empno, 'Abcd' ename, 1000 sal, 10 deptno from dual
3 union all
4 select 101 empno, 'RRR' ename, 2000 sal, 20 deptno from dual
5 union all
6 select 102 empno, 'KKK' ename, 3000 sal, 30 deptno from dual
7 union all
8 select 103 empno, 'PPP' ename, 4000 sal, 10 deptno from dual
9 )
10 ,dept as
11 (select 10 deptno, 'FINANCE' dname from dual
12 union all
13 select 20 deptno, 'SALES' dname from dual
14 union all
15 select 30 deptno, 'IT' dname from dual
16 union all
17 select 40 deptno, 'HR' dname from dual
18 )
19 select e.empno, e.ename, e.sal, d.deptno, d.dname
20 from emp e,
21 (select decode(a.deptno, 10, b.deptno, a.deptno) deptno, decode(a.deptno, 10, b.dname, a.dname) dname
22 from dept a, (select deptno, dname
23 from dept
24 where dname = 'SALES'
25 ) b
26 ) d
27 where e.deptno(+) = d.deptno
28 /
EMPNO ENAM SAL DEPTNO DNAME
101 RRR 2000 20 SALES
101 RRR 2000 20 SALES
102 KKK 3000 30 IT
40 HR
SQL> Cheers
Sarma. -
Replacing GET by a SELECT query
hi all.
i have a get+check options syntax in a report.
i want to replace the code with a select query..
i want to replace GET + CHECKby SELECT+WHERE...
but when does this GET statement end? like if i replace it with select, then i would have to put ENDSELECT somewhere.. i guess there is no ENDGET in the report..
the code is like as follows...
START-OF-SELECTION.
GET ekko FIELDS bstyp ebeln ekorg ekgrp bedat ernam lifnr.
CHECK select-options.
CHECK ekko-bstyp = 'F'.
PERFORM some_subroutine
IF sy-subrc EQ 0.
"LOTS OF CODE PROCESSING"
ENDIF.
TOP-OF-PAGE.
"some code"
END-OF-SELECTION.
so, how do i replace it with the select query?
does the GET statement is executed for entire START-OF-SELECTION event?
also, whenever this GET is executed, does it fetch a single entry from the database table to work-area?something like this:
parameters:EBELN like ekko-EBELN.
data: begin of it_ekko occurs 0,
bstyp like ekko-bstyp,
EBELN like ekko-EBELN,
ekorg like ekko-ekorg,
ekgrp like ekko-ekgrp,
bedat like ekko-bedat,
ernam like ekko-ernam,
lifnr like ekko-lifnr,
end of it_ekko.
start-of selection
select bstyp ebeln ekorg ekgrp bedat ernam lifnr
into corresponding fields of table it_ekko from
ekko where ebeln = ebeln.
END-OF-SELECTION.
loop at it_ekko.
endloop. -
How to re-write this big SELECT Query with INNER JOINs?
Hi Experts
I have a performance killer SELECT query with an inner join of 3 tables u2013 VBAP, VBAK and VBEP together, which populates records to an internal table INT_COLL_ORD. Based on these records selected, in another SELECT query, records are fetched from VBUK table to the internal table INT_VBUK.
SELECT A~VBELN A~POSNR A~MATNR A~KWMENG A~KBMENG A~ERDAT A~ERZET A~PSTYV D~AUART E~ETTYP E~EDATU
INTO TABLE INT_TAB_RES
FROM VBAP AS A INNER JOIN VBAK AS D
ON D~VBELN EQ A~VBELN AND D~MANDT EQ A~MANDT
INNER JOIN VBEP AS E
ON E~VBELN EQ A~VBELN AND E~POSNR EQ A~POSNR AND E~MANDT EQ A~MANDT
WHERE A~VBELN IN s_VBELN AND
D~auart in s_auart AND
D~vkorg in s_vkorg AND
D~vbtyp eq 'C' AND
( ( matnr LIKE c_prefix_sp AND zz_msposnr NE 0 AND kbmeng EQ 0 )
OR ( matnr LIKE c_prefix_fp AND kwmeng NE A~kbmeng ) ) AND
A~ABGRU EQ SPACE AND
A~MTVFP IN R_MTVFP AND
A~PRCTR IN R_PRCT AND
E~ETENR EQ '1'.
SORT INT_COLL_ORD BY VBELN POSNR ETTYP.
DELETE ADJACENT DUPLICATES FROM INT_TAB_RES COMPARING VBELN POSNR.
CHECK NOT INT_TAB_RES [] IS INITIAL.
SELECT VBELN UVALL CMGST INTO TABLE INT_VBUK
FROM VBUK FOR ALL ENTRIES IN INT_TAB_RES
WHERE VBELN = INT_TAB_RES-VBELN AND UVALL NE 'A'.
Now, the requirement is:
I want to split this query. Like, first join VBAK and VBUK first. With this selection, go to the inner join of VBAP and VBEP (on key VBELN) to get the results. How can I re-write this Query?
Please help.
Thx n RgdsHi Nagraj
As of your suggestion, I have re-written the query as below:
* Declarations
TYPES: BEGIN OF TYP_COLL_ORD,
VBELN LIKE VBAK-VBELN,
POSNR LIKE VBUP-POSNR,
MATNR LIKE VBAP-MATNR,
KWMENG LIKE VBAP-KWMENG,
KBMENG LIKE VBAP-KBMENG,
ERDAT LIKE VBAK-ERDAT,
ERZET LIKE VBAK-ERZET,
PSTYV LIKE VBAP-PSTYV,
AUART LIKE VBAK-AUART, u201Calready exists in type
ETTYP LIKE VBEP-ETTYP,
EDATU LIKE VBEP-EDATU.
TYPES: END OF TYP_COLL_ORD.
DATA: INT_COLL_ORD TYPE TABLE OF TYP_COLL_ORD WITH HEADER LINE.
TYPES: BEGIN OF TYP_VBUK,
AUART LIKE VBAK-AUART, u201Chave added this field
VBELN LIKE VBUK-VBELN,
UVALL LIKE VBUK-UVALL,
CMGST LIKE VBUK-CMGST.
TYPES: END OF TYP_VBUK.
DATA: INT_VBUK TYPE TABLE OF TYP_VBUK WITH HEADER LINE.
*QUERY#1 u2013 for VBAK & VBUK Join
SELECT A~AUART B~VBELN B~UVALL B~CMGST
INTO TABLE INT_VBUK
FROM VBAK AS A INNER JOIN VBUK AS B
ON A~VBELN EQ B~VBELN
WHERE A~VBELN IN s_VBELN AND
A~auart in s_auart AND
A~vkorg in s_vkorg AND
A~vbtyp eq 'C' AND
B~UVALL NE 'A'.
IF NOT INT_VBUK[] IS INITIAL.
SORT INT_VBUK BY VBELN.
DELETE ADJACENT DUPLICATES FROM INT_VBUK COMPARING VBELN.
*QUERY#2 u2013 for VBAP & VBEP Join
SELECT A~VBELN A~POSNR A~MATNR A~KWMENG A~KBMENG A~ERDAT A~ERZET A~PSTYV B~ETTYP B~EDATU
INTO TABLE INT_COLL_ORD
FROM VBAP AS A INNER JOIN VBEP AS B
ON B~VBELN EQ A~VBELN AND B~POSNR EQ A~POSNR AND B~MANDT EQ A~MANDT
FOR ALL ENTRIES IN INT_VBUK
WHERE A~VBELN = INT_VBUK-VBELN AND
( ( matnr LIKE c_prefix_sp AND zz_msposnr NE 0 AND kbmeng EQ 0 )
OR ( matnr LIKE c_prefix_fp AND kwmeng NE A~kbmeng ) ) AND
A~ABGRU EQ SPACE AND
A~MTVFP IN R_MTVFP AND
A~PRCTR IN R_PRCT AND
B~ETENR EQ '1'.
ENDIF.
SORT INT_COLL_ORD BY VBELN POSNR ETTYP.
DELETE ADJACENT DUPLICATES FROM INT_COLL_ORD
COMPARING VBELN POSNR.
CHECK NOT INT_COLL_ORD[] IS INITIAL.
LOOP AT INT_COLL_ORD.
CLEAR: L_MTART,L_ATPPR,L_ETTYP.
IF L_PREVIOUS_ETTYP NE INT_COLL_ORD-ETTYP OR
L_PREVIOUS_AUART NE INT_COLL_ORD-AUART.
READ TABLE INT_OVRCTL WITH KEY AUART = INT_COLL_ORD-AUART ETTYP = INT_COLL_ORD-ETTYP.
CHECK SY-SUBRC NE 0.
Now, the issue is:
Please note that declaration for INT_COLL_ORD has a field AUART, which is used in further parts of program (see the statement just above)
But, since neither VBAP nor VBEP contains AUART field, it cannot be fetched through the QUERY#2. So this value is not populated into INT_COLL_ORD through SELECT Query.
Since this field is used in later part of program & that the internal table has no value for this field, it dumps!!
How to include this value into the INT_COLL_ORD?
Plz suggest.... -
How to fit results of the select query into next REPLACE statement
Hello All,
example:--
select @DBName = Name from sys.sysdatabases WHERE dbid = DB_ID('DBA')
PRINT @DBName (Answer is DBA)
Now, I want to use this @DBName result in the following statement EVERYTIME:--
SET @NewDBName = SELECT REPLACE('DBA ' ,' DBA', 'DBANew') ----------i need help with this syntex...
HOW CAN I WRITE ABOVE REPLACE STATEMENT CORRECTLY, WHICH EVERYTIME USE THE RESULT OF THE FIRST SELECT QUERY?
Thank you in advance....Thank you for quick reply.
how about this situation:--
i want to replace 'Z' with '\\sqlserver\Z$', how can i do this?
DECLARE @OriginalBackupFile VARCHAR(100)
SET @OriginalBackupFile = 'Z'
DECLARE @cmd VARCHAR(100)
SET @cmd = (SELECT REPLACE (@OriginalBackupFile, @OriginalBackupFile,????????)
PRINT @cmd -
How to reduce functions with simple select query?
I have a function to identify the root parent of a particular id. I use this in function in select query,which invokes function for every row in table.I need to merge the function inside the query itself.Please suggest me.
Function
CREATE OR REPLACE FUNCTION fnroot(v_id int ) return int as
v_left int;
v_right int;
v-result int;
begin
select left,right into v_left,v_right from sam where id=v_id;
select id into v_result from sam
where id in (select id from mst m where m.depth=2 )
and left < v_left and right > v_right;
return v_result;
end
query:
select fnroot(s.id) from master s;Hi,
Ramin's idea is very good. You must use joins in function as below
CREATE OR REPLACE FUNCTION fnroot(v_id int ) return int as
v_result int;
Begin
select s.id into v_result
from sam s on s.id = v_id
left join sam s2 on (s2.id in (select id from mst m where m.depth = 2) and s2.left < s.left and s2.right > s.right)
return v_result;
End;
Regards
Mahir M. Quluzade -
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 -
How to compare dates in a select query in open sql
Hi
How can I retrieve data pertaining to a specified date using a select query.
I have inserted date using the following code:
String dateString = "2009-03-11";
java.sql.Date date = java.sql.Date.valueOf(dateString);
PreparedStatement stmt =con.prepareStatement("insert into DATEACCESS"
+ "(DATETEST)"
+ "values (?)");
stmt.setDate(1,date);
stmt.executeUpdate();
How can I pass this in a select query,the below mentioned query did not fetch me any results.
Select * from DATEACCESS where DATETEST='2009-03-11'Hi
Has ur date problem resolved ?
If not resolved u can do the following
As u already have sql date today declared . You want to get the data depending on that date
As ur query is
if( today != null)
String query2 = select * from DATEACCESS where DATETEST<= ?
PreparedStatement ps = conn.prepareStatement(query2);
ps.setDate(1,today)
ResultSet rs = ps.executeQuery();
While(rs.next)
////// Here u will get data from query u needed ///
If this also does not work just print the date and check in which format is it returning u .
Regards
Anuradha Rao
Edited by: Anuradha Rao on Mar 20, 2009 10:16 AM -
How to assign table name for select query in loop.
Hi friends my requirement is count the no of records of all the database table which comes into an internal table ."Check the below coding". Iam fetching the tables from dd03l table into an internal table .plz give me a sujjesion how to assign a table name in select query in a loop.
SELECT tabname FROM dd09l
INTO TABLE i_dd09l
WHERE protokoll = 'X'.
IF sy-subrc = 0.
SORT i_dd09l BY tabname.
ENDIF.
LOOP AT i_dd09l.
SELECT COUNT(*) INTO val FROM i_dd09l-tabname.
IF sy-subrc = 0.
i_dd09l-count = val.
ENDIF.
MODIFY i_dd09l INDEX sy-index.
CLEAR val.
ENDLOOP.
error : 'I_DD09L-TABNAME' is not defined in the abap dictionary as a table.data: dy_table type ref to data,
dy_line type ref to data,
xfc type lvc_s_fcat,
ifc type lvc_t_fcat,
dy_field type ref to data.
LOOP AT i_dd09l.
perform get_structure using i_dd09l-tabname .
CREATE DATA dy_table TYPE TABLE OF (_dd09l-tab_name).
UNASSIGN <dyn_table>.
ASSIGN dy_table->* TO <dyn_table>.
SELECT COUNT(*) INTO val FROM <dyn_table>.
IF sy-subrc = 0.
i_dd09l-count = val.
ENDIF.
MODIFY i_dd09l INDEX sy-index.
CLEAR val.
ENDLOOP.
form get_structure using p_table.
data : idetails type abap_compdescr_tab,
xdetails type abap_compdescr.
data : ref_table_des type ref to cl_abap_structdescr.
Get the structure of the table.
ref_table_des ?=
cl_abap_typedescr=>describe_by_name( p_table ).
idetails = ref_table_des->components.
loop at idetails into xdetails.
clear xfc.
xfc-fieldname = xdetails-name .
xfc-datatype = xdetails-type_kind.
xfc-inttype = xdetails-type_kind.
xfc-intlen = xdetails-length.
xfc-decimals = xdetails-decimals.
append xfc to ifc.
endloop.
endform. "get_structure
Try like this hope it will work.
Regards,
madan. -
Hi All,
I need to do an enhancement in the following Select query.
SELECT
MARA data
a~matnr
MARC data
b~werks
MARA data
a~normt
a~ean11
a~labor
a~mstae
a~mstde
a~bismt
a~spart
a~zzsc
a~zzmc
a~zzpc
a~zzbu
a~zz4tpc
a~zz6tpc
a~kosch
a~iprkz
g~bmatn
a~normt
g~mfrnr
a~bstme
a~zeifo
a~ersda
MARC data
b~mtvfp
b~sernp
b~herkl
b~ekgrp
b~dispo
b~insmk
b~disgr
b~ladgr
b~lgfsb
b~mtver
b~perkz
b~eprio
b~wzeit
MVKE data
c~dwerk
c~kondm
c~bonus
c~mtpos
c~provg
c~mvgr1
c~mvgr2
c~mvgr3
c~prat9
c~prat1
MBEW data
d~bklas
d~stprs
INTO TABLE i_materials
FROM ( marc as b
inner jOIN mara AS a ON amatnr = bmatnr
inner JOIN mvke AS c ON cmatnr = amatnr
inner JOIN ampl AS g ON gbmatn = amatnr
LEFT OUTER JOIN mbew AS d ON dmatnr = bmatnr
AND dbwkey = bwerks )
WHERE a~matnr IN s_matnr
AND a~normt IN s_normt
AND a~mstae IN s_mstae
AND a~zz4tpc IN s_zz4tpc
AND a~zz6tpc IN s_zz6tpc
AND a~bismt IN s_bismt
AND a~iprkz IN s_iprkz
AND a~spart IN s_spart
AND a~zzsc IN s_zzsc
AND a~zzpc IN s_zzpc
AND a~zzmc IN s_zzmc
AND a~zzbu IN s_zzbu
AND a~ersda IN s_ersda
MARC Data
AND b~werks IN s_werks
AND b~ekgrp IN s_ekgrp
AND b~disgr IN s_disgr
AND b~perkz IN s_perkz
AND b~sernp IN s_sernp
AND b~ladgr IN s_ladgr
AND b~mtvfp IN s_mtvfp
AND b~lgfsb IN s_lgfsb
AND b~mtver IN s_mtver
AND b~eprio IN s_eprio
AND b~wzeit IN s_wzeit
AND b~herkl IN s_herkl
MVKE data
AND c~mtpos IN s_mtpos
AND c~kondm IN s_kondm
AND c~bonus IN s_bonus
AND c~provg IN s_provg
AND c~mvgr1 IN s_mvgr1
AND c~mvgr2 IN s_mvgr2
AND c~mvgr3 IN s_mvgr3
AMPL Data
AND g~reoam <> 'X'.
This query will pick the materials only if it is maintained across all the tables MARA,MARC,MVKE,AMPL,MBEW.
Now the requirement is, the program should pick the materials that are maintained in MARA table, doesn't matter if the material is not maintained in the other tables.
Please tell me how to modify this Select query. I dont have any idea on JOINs.
Thanks in Advance,
Neethu.Hi Manoj,
I have modified the query like
select fields
FROM ( mara as a
left outer join marc AS b ON amatnr = bmatnr
left outer Join mvke AS c ON amatnr = cmatnr
left outer Join ampl AS g ON amatnr = gbmatn
left outer Join mbew AS d ON amatnr = dmatnr )
WHERE a~matnr IN s_matnr
AND a~normt IN s_normt
AND a~mstae IN s_mstae
AND a~zz4tpc IN s_zz4tpc
AND a~zz6tpc IN s_zz6tpc
AND a~bismt IN s_bismt
AND a~iprkz IN s_iprkz
AND a~spart IN s_spart
AND a~zzsc IN s_zzsc
AND a~zzpc IN s_zzpc
AND a~zzmc IN s_zzmc
AND a~zzbu IN s_zzbu
AND a~ersda IN s_ersda
MARC Data
AND b~werks IN s_werks
AND b~ekgrp IN s_ekgrp
AND b~disgr IN s_disgr
AND b~perkz IN s_perkz
AND b~sernp IN s_sernp
AND b~ladgr IN s_ladgr
AND b~mtvfp IN s_mtvfp
AND b~lgfsb IN s_lgfsb
AND b~mtver IN s_mtver
AND b~eprio IN s_eprio
AND b~wzeit IN s_wzeit
AND b~herkl IN s_herkl
MVKE data
AND c~mtpos IN s_mtpos
AND c~kondm IN s_kondm
AND c~bonus IN s_bonus
AND c~provg IN s_provg
AND c~mvgr1 IN s_mvgr1
AND c~mvgr2 IN s_mvgr2
AND c~mvgr3 IN s_mvgr3
AMPL Data
AND g~reoam <> 'X'.
I am getting the error, "No fields from the right-hand table of a LEFT OUTER JOIN may appear in the WHERE condition:"B~WERKS".
Now prob. is with WHERE condition. If you know the solution please let me know. -
Problem with JOINs in SELECT query
The parameter wa_dob-e_dob is not getting its definition ....
it contains DOB in current yr.
As i am using Joins also Workarea.... so is it coz Joins & WA cant be used simultaneously in a SELECT query....
Is there any other option to do the same...?
* Global Structure
TYPES : BEGIN OF t_data , "Structure
emp_dob TYPE pa0002-gbdat,
emp_Mailid TYPE pa0105-usrid,
END OF t_data,
BEGIN OF t_dob,
e_dob TYPE pa0002-gbdat,
e_pernr type pa0002-pernr,
END OF t_dob.
* Global Internal Tables (I_)
DATA : i_data TYPE TABLE OF t_data, "Internal Table for output data
i_dob TYPE TABLE OF t_dob. "Internal table for Dob
* Global Work Area (WA_)
DATA : wa_data TYPE t_data, "Work Area for output data
wa_dob TYPE t_dob. "Work Area for Dob
*this is the query where i am getting error
* Field "WA_DOB-E_DOB" Not found.
LOOP AT i_dob INTO wa_dob.
SELECT pa0002~gbdat pa0105~usrid INTO CORRESPONDING FIELDS OF wa_data
FROM pa0002
INNER JOIN pa0105
ON pa0002~pernr = pa0105~pernr
WHERE pa0105~subty EQ 'MAIL' AND
wa_dob-e_dob BETWEEN w_sysdate AND w_edit_sysdate.
ENDSELECT.
APPEND wa_data TO i_data.
CLEAR wa_data.
CLEAR wa_dob.
CLEAR l_temp_dob.
ENDLOOP.Hi,
you are checking the work area in the SELECT. IN WHERE condition of the select u should specify fields in either of the tables pa0002 , pa0105 for data population.
The select is on the database table and not on the work area.for checking the data in the work area do this way:
loop at it_dob into wa_dob.
if wa_dob-e_dob between the range u want (w_sysdate AND w_edit_sysdate)
endif.
endloop.
ie: wa_dob-e_dob >w_sysdate AND wa_dob-e_dob < w_edit_sysdate or
wa_dob-e_dob < w_sysdate AND wa_dob-e_dob > w_edit_sysdate
watever ur requirement is..
regards,
madhu -
How to formulate where clause in select query at runtime..??
I am facing a problem..
I have to generate a select query during runtime..For Ex: when user selects a row in an alv report, particular date field is to be read and another report is to be opened for that data..
I know how to make drill down report but my problem is concatenating date field...
Plz tell a solution....Hi,
Try like this....
refresh : gt_tvarvc_temp[].
gt_tvarvc_temp[] = lt_tvarvc[].
loop at gt_tvarvc_temp into gs_tvarvc_temp
where name = 'CREDIT_MEMO_DOC_TYPE'.
r_blart-sign = gs_tvarvc_temp-sign.
r_blart-option = gs_tvarvc_temp-opti.
r_blart-low = gs_tvarvc_temp-low.
append r_blart.
clear r_blart.
endloop.
concatenate 'BLART IN ' 'r_blart' into lv_condition
separated by space.
if not lv_customer_cond is initial.
if lv_condition is initial.
concatenate lv_customer_cond lv_condition
into lv_condition separated by space.
else.
concatenate lv_condition 'AND' lv_customer_cond
into lv_condition separated by space.
endif.
endif.
select bukrs belnr gjahr appending corresponding fields
of table lt_potential_credits
from bsid
where (lv_condition).
Hope its helps -
How should I change the following SELECT QUERY?
Requirement:
There are checks in the program for material group 2, z93 AND z94 which should be skipped if the sales org = 'JP40'.
sales organisation is taken from the layout(SE51) dictionary fields (MODULE POOL PROGRAM)
The select query is:
select single matnr
into t_mvke-matnr "dummy
from mvke
where matnr = t_9000-matnr
and vkorg = vbak-vkorg
and vtweg = vbak-vtweg
and mvgr2 in (c_z93,c_z94).
How should I skip the material group c_z93, c_z94 only for JP40(vbak-vkorg) sales organisation, except JP40 material group should be there for other sales org. but for JP40 material group should be skipped.
What would be the select query or should I give any kind of IF conditions before select query.
Please help me out.Hi Rani K
You can try like
IF VBAK-VKORG = 'JP40'.
select single matnr
into t_mvke-matnr "dummy
from mvke
where matnr = t_9000-matnr
and vkorg = vbak-vkorg
and vtweg = vbak-vtweg.
ELSE.
select single matnr
into t_mvke-matnr "dummy
from mvke
where matnr = t_9000-matnr
and vkorg = vbak-vkorg
and vtweg = vbak-vtweg
and mvgr2 in (c_z93,c_z94).
ENDIF.
Thanks
Gaurav -
Upto how many characters will accept in SELECT query SENDER JDBC (PI 7.1)
Hi Friends,
I have to use Sender JDBC adapter in SAP PI 7.1, I need to use SELECT query only.
I have a SELECT query is around 2 pages. Is this will accepet in SENDER JDBC in PI 7.1
Thanks in advance.Hi Challarapu,
You can check it out and if it is not accepted by the same then you need to check the maximal length @ DB settings or JDBC Settings whether it is limited. If not then you are allowed.
Hope this helps.
Regards
Pothana -
How do i display an sql SELECT query in a jtextarea?
Hi,
I have a program that takes any SQL string from an inputArea JtextArea and displays "command executed successfuly" in the outputArea JTextArea if it works.
My question is how do i make the outputArea display the actual query of the SELECT statment? Thanks!
public void create(String SQLCommand) {
String query = SQLCommand;
try {
Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
outputArea.setText("Command Executed Sucessfully: \n" + query);
rs.close();
stmt.close();
} catch (SQLException sqlex) {
outputArea.setText("Unable to Execute Command: \n" + query);
sqlex.printStackTrace();
}It's a variation of the sample code I provided on the last post. Use a Vector of Vector of Objects to store the result set data (row and column data) and use another Vector to store the column names (for the JTable header). Then use the JTable constructor that accepts two Vector parameters to create your table. Eventually you'll want to customize your JTable by creating your own table model and custom cell editor and renderer. For now the sample code below will suffice.
For more on using JTable see the following:
http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
Vector header = new Vector();
Vector result = new Vector();
int columns = rsmd.getColumnCount();
/* Retrieve column names */
for (int i = 1; i <= columns; i++)
header.add(rsmd.getColumnName(i));
while (rs.next())
Vector row = new Vector();
/* Columns numbers offset from one */
for (int i = 1; i <= columns; i++)
row.add(rs.getObject(i));
result.add(row);
JTable table = new JTable(result,header);
Maybe you are looking for
-
Gif not animating when on the Internet
Hopefully some one can help as I have tried everything i can think of I have create a animation using Flash 8 I have exported this as a Animated gif to my computer. I can open the file and it animates fine on my pc. When i upload to myspace it does n
-
how do i make a hyperlink when clicked on by a visitor goto my mail.html page and input into a field in my mail form, on that page, the URL of the page the hyperlink was clicked on im new to this all suggestions welcomed
-
I have a 42" Samsung Digital Plasma HDTV. From time to time while watching Verizon FIOS TV my TV will switch from a picture to a message on the screen that states "NOT SUPPORT MODE" or I will turn the TV on and it gives me the same message. I have c
-
hi can you give me an application that will keep keep all the applications on the mac up to date thanks
-
Adobe connect is showing maintenance
- Maintenance #21100 Started 9:30 AM - 2/10/2015 Maintenance started for the following: Adobe Connect - Meeting (NA11), Webinar (NA11), Recording Conversion (NA3, NA4, NA5, NA7, NA10, NA11), Telephony (NA3, NA4, NA5,