Select querry
hi experts.
SELECT * INTO CORRESPONDING FIELDS OF TABLE it_sym FROM ismp
JOIN ismitop ON ( ismpismnr = ismitopismnr )
JOIN ismitpr ON ( ismpismnr = ismitprismnr )
WHERE ismp~ismnr IN s_sympt.
i am using this select querry but when the ismnr is not mensioned in any of ismitop or ismitpr but is ther e in ismp. the table it_sym is null.
i want full join. how should i write.
plz suggest the code.
with regards
ajay
select ismp~ismnr
ismp~ismtp
ismp~ismart
ismp~objnr
ismp~valdtfrm
ismp~valdtto
ismitop~opgrp
ismitop~opcod
ismitpr~prgrp
ismitpr~prcod
from ( ismp LEFT JOIN ismitop ON ( ismpismnr = ismitopismnr )
LEFT JOIN ismitpr ON ( ismpismnr = ismitprismnr ) )
into corresponding fields of table IT_SYM
WHERE ismp~ismnr IN s_sympt.
even after writing this the record has not been fetched if the data is not mainsioned in any table of corresponding ismnr.
please help..
ajay
Similar Messages
-
Dynamic select querry in sender jdbc adapter
Hi,
We are working on a scenario where in we will be using different source database tables , we were trying to see if it is possible that the select querry can be made dynamic so that the same communication channel can be used for all the different source tables.
Request all to come up with suggestions as to if this is possible.
Thanks ,
Pravesh Puria.Hi All,
Thanks VJ for your reply.
Let me reframe my question.
I have multiple database instances at source side. On all instances I have same table name.
My requirement is to poll all these instances table and fetch data.
Do I need to create multiple sender agreements or there is a way to dynamically change the datbase name in sender Communication channel.
Any other solution is also appreciated.
Same is the case with JMS adapter, Multiple instances of JMS are there at source side sending similar structure data in there own queue.
Request you to kindly response.
Regards,
Pravesh -
Dynamic select querry in sender JDBC channel
Hi,
We are working on a scenario where we need to read data from various database tables , we were trying to see if it is possible that the select querry can be set dynamically so that the same channel can be used to read from the various tables.
Request all to please come up with suggestions as to whether this is possible.
Thanks ,
Pravesh Puria.Hi All,
Thanks VJ for your reply.
Let me reframe my question.
I have multiple database instances at source side. On all instances I have same table name.
My requirement is to poll all these instances table and fetch data.
Do I need to create multiple sender agreements or there is a way to dynamically change the datbase name in sender Communication channel.
Any other solution is also appreciated.
Same is the case with JMS adapter, Multiple instances of JMS are there at source side sending similar structure data in there own queue.
Request you to kindly response.
Regards,
Pravesh -
Problem in select querry with select option
Hi all,
How have a problem with the select querry, Pls correct my querry
select opbel gpart betrw fdgrp into table lt_balance from dfkkop
where fdgrp in s_augrp
and hvorg = '5000'
and tvorg = '0100'.
Thanx in advance,
LineHi
I have tried this select querry, but I am unable to fetch the data in the internal table
select opbel gpart betrw fdgrp into correspondiing fields of table it_balance
from dfkkop
where fdgrp in s_augrp
and hvorg = '5000'
and tvorg = '0100'.
Can you please tell me what is wrong in this querry,
Line -
Select querry for hr records.
hi all,
i was writing a hr report to to get the employee no's based on the employment status given in the selection screen. i was using the standard screen from PNP databse.
but when i was giving the from and to date and the employment status . and i am using GET PERNR to fetch the records. but it is not considering the status.
so i wrote a select querry to check the records fetched after GET PERNR matches with the employment status given in the selection screen. but the select querry is not working.
SELECT SINGLE STAT2 INTO PERNR-STAT2 FROM PA0000
WHERE PERNR = PERNR-PERNR
AND BEGDA GE PN-BEGDA
AND ENDDA LE PN-ENDDA
AND STAT2 IN PNPSTAT2.
CHECK PERNR-STAT2 IN PNPSTAT2.
IF SY-SUBRC NE 0.
REJECT.
ENDIF.
so please some one give the select querry to get the records from pa0000 tables based on the date range given and the employment status given.Hi Praveen,
welcome to SDN.
Please check that did you pass
<b>Infotypes: 0000.</b>
in the declaration part of the statement.
Get Pernr will consider the status then.
Regards,
Amit
P.S. Please close the issue and reward points to helpful answer once Query is solved.
Message was edited by: Amit Khare -
How to make SELECT querry to work for CONVERSION EXIT
Dear All,
I want to select some data from from table J_1IEXCTAX , and to limit that retrieval I have WHERE clause for fields VALIDFROM and VALIDTO
My select querry is like
SELECT SINGLE RATE ECSRATE
FROM J_1IEXCTAX
INTO (J_1IEXCTAX-RATE,J_1IEXCTAX-ECSRATE)
WHERE J_1ICHID = J_1IMTCHID-J_1ICHID and
( VALIDFROM LE T_GRREC-BUDAT and
VALIDTO GE T_GRREC-BUDAT ).
But the field VALIDFROM and VALIDTO have data (i.e. dates) in different format
So my selection doesnt happen..
these formats can be converted to desired format using CONVERSION EXITs at their domain level...
But that increases coding and worsens performance.....
Could anybody give me some other solution?
Thanks in advance................
Code Formatted by: Alvaro Tejada Galindo on Jan 8, 2009 10:58 AMHi,
write T_GRREC-BUDAT to gv_date as <specify the format>
now use gv_date in ur seelct query.
Regards,
Nagaraj -
Select querry using inner join
Hi Friends,
I need to fetch data from two tables, I used inner join but I am not able to fetch the data in some fields can any one tell me what is wrong in this select querry.
SELECT but000~partner
but000~name_org1
but000~name_first
but000~name_last
but000~bpext
FROM but000 INNER JOIN dfkkop ON but000partner = dfkkopgpart
INTO table lt_but000
WHERE but000~partner IN so_part
AND dfkkop~faedn IN so_faedn.
Thanx in advance,
Parvezhi Lutin,
SELECT but000~partner
but000~name_org1
but000~name_first
but000~name_last
but000~bpext
FROM but000 INNER JOIN dfkkop ON but000partner = dfkkopgpart <------check this condition,it has to *satisfy both table
INTO table lt_but000
WHERE but000~partner IN so_part
AND dfkkop~faedn IN so_faedn.
Regards,
siva
Message was edited by:
SivaKumar -
Select querry for maximum value
Hi,
I want to select fields A B C D from a database table TAB using some selection criteria from selection screen, but the greatest value of A has to be selected for all unique entries of B C and D. Please suggest an appropriate select querry.
PS: I cannot use SELECT and then DELETE ADJACENT DUPLICATES as it will effect performance in some cases.
Regards.Try using aggregate function MAX with SELECT statement.
MAX Returns the greatest value in the column determined by the database field f for the selected lines. Specifying DISTINCT does not change the result. NULL values are ignored unless all values in a column are NULL values. In this case, the result is NULL .
Have a look at below link:
[Select Clause|http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/select_c.htm]
I hope it helps.
Best Regards,
Vibha
Please mark all the helpful answers -
Hi all,
I want to clarify one thing...........
1. select F1 F2 F3
from X
into table itab
where F1 in s_F1
and F2 in s_F2.
2. Select * from X into table itab.
here itab type table of X.
which select statement will give less perfomence and is there any relation betwwen table size and perfomence of select querry?
If there is a relation let me know how to find it..........
Thanks,
kk.Hi Kusuma,
the answer is, it depends (as you already have read in the other postings):
If both ranges are filled and you have an index on both fields (as the two first columns of the index - may be with the client in the first place), the first statement will probably run faster than the second in most cases, because it has to read less blocks from disk. This could be also incorrect if the selectivity of your ranges is bad and your table is huge.
If your ranges in the query are not filled, than both statements are equivalent and read the same amount from disk. If the table has more columns than three, then the first query may be a bit faster because it has not as many data to transfer between database and application.
If only the second range is filled and you have no suitable index on column F2, than the first query could run even longer than the second because some databases (Oracle and DB2, may be MS SQL Server too) could create execution plans which reads the table multiple times. It depends on your indexes and their statistics if it happens or not. In most cases, it will run not longer than the second statements, but in rare situation it could run considerably longer.
You see, SQL is complex and the execution depends heavily on the implementation in the database management system itself.
One additional comment. If your ranges contains only single values, it would be much better for the stability of your coding if you use FOR ALL ENTRIES. The database interface could create suitable junks of values if you use FOR ALL ENTRIES. If you use IN range, this could not be done and if the range gets to big (bigger than the maximum statement size), you'll get a dump. For simple queries with only two ranges this is not very likely, but if your example grows, it's getting more and more likely.
Best regards
Ralph Ganszky -
Problem with for all entries in select querry
hi,
Hi,
I am using select queery like this
SELECT version COUNT( * )
from ztbi_default_va4
INTO CORRESPONDING FIELDS OF TABLE lit_new
FOR ALL ENTRIES IN lit_new1
WHERE network = lit_new1-network GROUP BY version.
this is not working showing error as:
The addition "FOR ALL ENTRIES" excludes all aggregate functions with
the exception of "COUNT( * )" as the single element of the SELECT clause.
I am using only count(*) ,not using othes like max,min etc,,,,,,,,,
please suggest any missing in syntax,,,,attach relavant code using count(*) with for all entreis
any help appriciated,,,,,
Thanks in advance,,,,Hi,
Try this -
TYPES: begin of t_data,
version TYPE version,
count type i,
end of t_data.
DATA: i_data TYPE STANDARD TABLE OF t_data,
wa_data TYPE t_data.
DATA: l_version TYPE version,
l_count TYPE i.
SELECT version COUNT( * )
from ztbi_default_va4
INTO CORRESPONDING FIELDS OF TABLE lit_new
FOR ALL ENTRIES IN lit_new1
WHERE network = lit_new1-network.
SORT lit_new.
LOOP AT lit_new INTO lwa_new.
IF lwa_new EQ l_version.
l_count = l_count + 1.
ELSE.
wa_data-version = l_version.
wa_data-count = l_count + 1.
APPEND wa_data TO i_data.
CLEAR: wa_data.
CLEAR: l_count.
ENDIF.
l_version = lwa_new-version.
CLEAR: lwa_new.
I hope this will do.
Make any necessary changes.
Regards,
Harsh Bansal -
Hi,
while debugging values are populating for mkpftbl but not to msegtbl. can anyone suggest where i am going wrong.
if sy-batch = 'X'.
select mblnr mjahr bldat cputm
from mkpf
into table mkpftbl
where bldat eq wtoday
and tcode2 eq ctcode2.
else.
select mblnr mjahr bldat cputm
into table mkpftbl
from mkpf
where mblnr in mblnr
and mjahr in mjahr
and tcode2 eq ctcode2.
endif.
if not mkpftbl[] is initial.
loop at mkpftbl.
select zeile charg matnr werks menge
into corresponding fields of table msegtbl
from mseg
Appending table msegtbl
for all entries in mkpftbl
where mblnr eq mkpftbl-wmblnr
and mjahr eq mkpftbl-wmjahr
and bwart eq cbwart
and werks eq splant.
*endloop.Hi Nihi
Try making the changes as highlighted below:
<u><b>Declaration:</b></u>
data: begin of mkpftbl occurs 0,
<b>wmblnr like mkpf-mblnr, "Material Document Number
wmjahr like mkpf-mjahr, "Material Document Year
wbldat like mkpf-bldat, "Document date in document
wcputm like mkpf-cputm, "Time of Entry</b>
end of mkpftbl.
data: begin of msegtbl occurs 0,
<b> wmblnr like mseg-mblnr, "Material Document Number
wmjahr like mseg-mjahr, "Material Document Year
wzeile like mseg-zeile, "Item in Material Document
wmatnr like mseg-matnr, "Material number
wwerks like mseg-werks, "plant
wcharg like mseg-charg, "batch number
wmenge like mseg-menge, "Quantity
wbldat like mkpf-bldat, "Document date in document
wcputm like mkpf-cputm, "Time of Entry</b>
end of msegtbl.
<u><b>Routine For Extraction:</b></u>
data: wrecord type i.
data: wtime type t.
data: wtoday type d.
move sy-datum to wtoday.
move sy-uzeit to wtime.
if wtime eq '000000'.
wtoday = wtoday - 1.
endif.
status = 1.
if sy-batch = 'X'.
select mblnr mjahr bldat cputm
from mkpf
into table mkpftbl
where bldat eq wtoday
and tcode2 eq ctcode2.
else.
select mblnr mjahr bldat cputm
into table mkpftbl
from mkpf
where mblnr in mblnr
and mjahr in mjahr
and tcode2 eq ctcode2.
endif.
if not mkpftbl[] is initial.
select <b>mblnr mjahr zeile matnr werks charg menge</b>
from mseg
<b>into table msegtbl</b>
for all entries in mkpftbl
where mblnr eq <b>mkpftbl-wmblnr</b>
and mjahr eq <b>mkpftbl-wmjahr</b>
and bwart eq cbwart
and werks eq splant.
status = 0.
endif.
Hope this helps you.
Kind Regards
Eswar -
PL/SQL: how to use in parameter in select sql where clause
Hi
in a procedure, I need to apply 'in parameter' in 'where clause' along with other table fields. Purpose is to create dynamic select querry with multiple conditions.
select count(*) from table xx
where y_code=2008 and v_type in ('SI', 'TI', 'DI') ;
my requirement is replace 'and v_type in ('SI', 'TI', 'DI')' with in parameter. pls note in paramter may contain null value.
Regards... e.g. why on earth do you want to pass in a string to be appended to the WHERE clause of an SQL.I second that and I strongly advice NOT to do it. If you really want to do it, then come back and show us, how you would prevent SQL injection. This approach is too dangerous (and too complex) IMHO.
Do it straight forward as in the article of Tom Kyte (link in the post of BluShadow above) -
Hi ,
I have a table with SM30.
and my Select query for SD report takes what are the user ID;s maintained in the Ztable.
But If the enduser is a Internal User and not maintained in the Ztable he should be able to see all the sales orders.
If the entered user is maintained in the table he should be able to see only the customers which are assigned to it.
if he tries to see the customer which is not asigned to him
it should throw a error message.
Please let me know what I should do.
My Select querry is
SELECT
kunnr
FROM zsd_c2c_auth
INTO CORRESPONDING FIELDS OF
TABLE gt_c2c_auth
WHERE kunnr IN s_kunnr
AND syuname = sy-uname.
Thanks,
VarunIf current user is end user,it will not return any records after your select query as this user is not maintained in Z table. In this case,write ur select query again without user condition. It will give you desired results.
SELECT
kunnr
FROM zsd_c2c_auth
INTO CORRESPONDING FIELDS OF
TABLE gt_c2c_auth
WHERE kunnr IN s_kunnr
AND syuname = sy-uname.
->> If current user is not maintained i.e. he is end user,display all records
if sy-subrc NE 0 OR gt_c2c_auth[] is initial.
SELECT
kunnr
FROM zsd_c2c_auth
INTO CORRESPONDING FIELDS OF
TABLE gt_c2c_auth
WHERE kunnr IN s_kunnr.
endif.
Regards,
Aparna Gaikwad -
Sender JDBC Communication Update SQL Command Problem!
Hi all,
I am trying to do a SENDER JDBC Scenario in XI.
I fetch the Records from the table Once per day based on the Current Date.
I do not have any Update Credentials in the table.
I can only perform Select Querry.
But when i am trying to configure the SENDER JDBC Channel its asking me to enter value for Update SQL Command in Sender JDBC communication channel Process Parameters.
Its not accepting BLANK or ' * ' Values.
But i have only Select Querry credentials in the table. I can only pick the values cant Update the tables but.
In the Above scenario how can i configure the Sender JDBC CC without Updating the Table after fetching the value?
Please Advice
Regards,
Senthilprakash.Hi,
Specify the Update SQL Statement value as .
http://help.sap.com/saphelp_nw04/helpdata/en/14/80243b4a66ae0ce10000000a11402f/frameset.htm
Thanks
SaNv...
Edited by: Sãnthosh Kûmãr V on Oct 8, 2008 10:44 AM
Edited by: Sãnthosh Kûmãr V on Oct 8, 2008 10:45 AM -
Hi Guru's
I have written a report which display output.and the output fields are 1-Plant, 2-Purchase oragnization , 3- Purchase Order and 4-Purchase item.
Plz check this program where i can mistake to write this program..
TABLES : EKKO,
EKPO.
DATA: BEGIN OF IT_EKKO OCCURS 1,
EBELN LIKE EKKO-EBELN,
EKORG LIKE EKKO-EKORG,
BEDAT LIKE EKKO-BEDAT,
END OF IT_EKKO.
DATA : BEGIN OF IT_EKPO OCCURS 1,
EBELN LIKE EKPO-EBELN,
EBELP LIKE EKPO-EBELP,
ELIKZ LIKE EKPO-ELIKZ,
WERKS LIKE EKPO-WERKS,
MENGE LIKE EKPO-MENGE,
END OF IT_EKPO.
DATA : BEGIN OF IT_FINAL OCCURS 1,
EBELN LIKE EKKO-EBELN,
EKORG LIKE EKKO-EKORG,
BEDAT LIKE EKKO-BEDAT,
WERKS LIKE EKPO-WERKS,
END OF IT_FINAL.
SELECTION-SCREEN : BEGIN OF BLOCK B1 WITH FRAME.
SELECT-OPTIONS : S_WERKS FOR EKPO-WERKS,
S_EKORG FOR EKKO-EKORG,
S_BEDAT FOR EKKO-BEDAT.
SELECTION-SCREEN : END OF BLOCK B1.
START-OF-SELECTION.
SELECT EBELN EKORG BEDAT FROM EKKO INTO TABLE IT_EKKO
WHERE EKORG IN S_EKORG AND
BEDAT IN S_BEDAT.
IF NOT IT_EKKO[] IS INITIAL.
SELECT EBELN EBELP ELIKZ WERKS MENGE FROM EKPO INTO TABLE IT_EKPO
FOR ALL ENTRIES IN IT_EKKO
WHERE EBELN = IT_EKKO-EBELN.
ENDIF.
LOOP AT IT_EKPO.
READ TABLE IT_EKKO WITH KEY EBELN = IT_EKPO-EBELN.
IF SY-SUBRC = 0.
IT_FINAL-EBELN = IT_EKKO-EBELN.
IT_FINAL-EKORG = IT_EKKO-EKORG.
IT_FINAL-BEDAT = IT_EKKO-BEDAT.
ENDIF.
MOVE-CORRESPONDING IT_EKPO TO IT_FINAL
APPEND IT_FINAL.
CLEAR IT_FINAL.
ENDLOOP.
LOOP AT IT_FINAL.
WRITE : / IT_FINAL-WERKS,
IT_FINAL-EKORG,
IT_FINAL-EBELN,
IT_FINAL-EBELP.
ENDLOOP.
THANKS
GOLU.The program is all correct except to minor errors.
I have changed accordingly.
However I would suggest to use Inner Join for both the tables and write one select querry ans also can avoid the read statement.
TABLES : ekpo, ekko.
DATA: BEGIN OF it_ekko OCCURS 1,
ebeln LIKE ekko-ebeln,
ekorg LIKE ekko-ekorg,
bedat LIKE ekko-bedat,
END OF it_ekko.
DATA : BEGIN OF it_ekpo OCCURS 1,
ebeln LIKE ekpo-ebeln,
ebelp LIKE ekpo-ebelp,
elikz LIKE ekpo-elikz,
werks LIKE ekpo-werks,
menge LIKE ekpo-menge,
END OF it_ekpo.
DATA : BEGIN OF it_final OCCURS 1,
ebeln LIKE ekko-ebeln,
ekorg LIKE ekko-ekorg,
bedat LIKE ekko-bedat,
werks LIKE ekpo-werks,
END OF it_final.
SELECTION-SCREEN : BEGIN OF BLOCK b1 WITH FRAME.
SELECT-OPTIONS : s_werks FOR ekpo-werks,
s_ekorg FOR ekko-ekorg,
s_bedat FOR ekko-bedat.
SELECTION-SCREEN : END OF BLOCK b1.
START-OF-SELECTION.
SELECT ebeln ekorg bedat FROM ekko INTO TABLE it_ekko
WHERE ekorg IN s_ekorg AND
bedat IN s_bedat.
IF NOT it_ekko[] IS INITIAL.
SELECT ebeln ebelp elikz werks menge FROM ekpo INTO TABLE it_ekpo
FOR ALL ENTRIES IN it_ekko
WHERE ebeln = it_ekko-ebeln.
ENDIF.
LOOP AT it_ekpo.
READ TABLE it_ekko WITH KEY ebeln = it_ekpo-ebeln.
IF sy-subrc = 0.
it_final-ebeln = it_ekko-ebeln.
it_final-ekorg = it_ekko-ekorg.
it_final-bedat = it_ekko-bedat.
ENDIF.
MOVE-CORRESPONDING it_ekpo TO it_final. "Changed
APPEND it_final.
CLEAR it_final.
ENDLOOP.
LOOP AT it_final.
WRITE : / it_final-werks,
it_final-ekorg,
it_final-ebeln.
* it_final-ebelp. "Changes
ENDLOOP.
Hope I answered you.
Shreekant
Maybe you are looking for
-
Has anyone else had this weird issue?
It doesn't happen every time, but often when I travel on a coach for a long distance journey my iPhone 5c starts going crazy. For example when I'm using an app such as Facebook, I might be in the middle of typing a post out and the screen might go ba
-
RE: Additional scripts to execute after creation of database for Oracle
Hi it is possilble to execute additional scripts such as CATALOG.SQL; CATAUDIT.SQL etc to enable v$session views? as these views are not created when i used the wizard in Oracle to create the database in 9i. Is this normal or am i not creating the da
-
How do you install photoshop onto another laptop?
I have a dead laptop, I need to install photoshop ontp my new one.
-
Animation symbol keeps looping
I am not sure if i am doing this even the way but here is what i did i created 3 animation symbols from scratch meaning (edit--insert--symbol--animation) i called them animi1, animi2, animi3 each of them has graphic symbols within them animi1 has 53
-
Email login recurring problems
For almost a week when I try to logiin I am getting an error message 'Web site not available' when trying via BT.com. Sometimes it works. Now it is becoming a problem more regularly. Telephone help said to try via www.mail.yahoo.com - this works. Whe